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
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
51
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}", "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 }", "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}", "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.8138161", "0.7955729", "0.78994995", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.67363167", "0.6730652", "0.6653417", "0.6602539", "0.6594027", "0.6594027", "0.6594027", "0.6594027", "0.6594027", "0.6594027", "0.6594027", "0.6594027", "0.6594027", "0.6594027", "0.6594027", "0.6594027", "0.6594027", "0.6594027", "0.6594027", "0.6594027", "0.6594027", "0.6585053", "0.6576577", "0.6576577", "0.6570218", "0.6553834", "0.6533432", "0.65160185", "0.65160185", "0.6502225", "0.6502225", "0.6502225", "0.6502225", "0.6502225", "0.6502225", "0.6502225", "0.6502225", "0.6502225", "0.6502225", "0.6502225", "0.64975256", "0.6487674", "0.6487674", "0.6487674", "0.6487674", "0.6487674", "0.6487674", "0.6487674", "0.6395024", "0.6376676", "0.63576466", "0.63576466", "0.63576466", "0.6329979", "0.6313028", "0.6236398", "0.6236398", "0.6236398", "0.6174128", "0.6076178", "0.6076178", "0.60117877", "0.5940334", "0.5922144", "0.5922144", "0.59141004", "0.5909108", "0.5893816" ]
0.7955896
14
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.7517868", "0.7517113", "0.7476506", "0.74503416", "0.74503416", "0.7446208", "0.74452215", "0.7421781", "0.7421781", "0.7421781", "0.7421781", "0.7421781", "0.7421781", "0.7421781", "0.7409264", "0.73805326", "0.73805326", "0.7374713", "0.7374713", "0.7374713", "0.7374713", "0.7374713", "0.7374713", "0.7374713", "0.7374713", "0.7374713", "0.7374713", "0.7374713", "0.7333642", "0.6777745", "0.6777745", "0.6777745", "0.6777745", "0.6668187", "0.59837526", "0.5930885", "0.59023196", "0.59023196", "0.59023196", "0.59023196", "0.59023196", "0.59023196", "0.59023196", "0.59023196", "0.59023196", "0.59023196", "0.59023196", "0.59023196", "0.59023196", "0.59023196", "0.59023196", "0.59023196", "0.59023196", "0.58605206", "0.58605206", "0.58605206", "0.58605206", "0.58605206", "0.58605206", "0.58605206", "0.58605206", "0.58605206", "0.58605206", "0.58605206", "0.58605206", "0.58605206", "0.58320916", "0.58175737", "0.5672617", "0.56612235", "0.5655406", "0.5655406", "0.5655406", "0.5655406", "0.5655406", "0.5655406", "0.5655406", "0.5655406", "0.5655406", "0.5655406", "0.5655406", "0.5655406", "0.5655406", "0.5655406" ]
0.74197316
26
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 }", "setSelectionRange(start, end, direction) {\n this.getInput().setSelectionRange(start, end, direction);\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});}", "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 }", "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 }", "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 }", "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 }", "insertAfterPart(ref){ref.__insert(this.startNode=createMarker());this.endNode=ref.endNode;ref.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 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;}", "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.66458386", "0.6270682", "0.6186922", "0.6150116", "0.6106729", "0.60771316", "0.60734135", "0.600438", "0.6004206", "0.5984542", "0.5984542", "0.5984542", "0.59713507", "0.59500116", "0.59500116", "0.59500116", "0.5949384", "0.593691", "0.58875495", "0.58433455", "0.58354026", "0.58354026", "0.58266723", "0.58152455", "0.5796558", "0.5794397", "0.57914037", "0.57914037", "0.57914037", "0.57648784", "0.57591045", "0.5757318", "0.5757318", "0.5741503", "0.57213306", "0.5720582", "0.5705966", "0.5700328", "0.5699123", "0.56919193", "0.5678192", "0.56726575", "0.5670407", "0.5669808", "0.5669808", "0.5669808", "0.5669808", "0.5669808", "0.5669808", "0.5669808", "0.5665911", "0.5653023", "0.56479317", "0.56424546", "0.56391555", "0.56391555", "0.56391555", "0.56391555", "0.56391555", "0.56391555", "0.56391555", "0.56391555", "0.56391555", "0.56391555", "0.56391555", "0.5635656", "0.56294376", "0.56294376", "0.5627845", "0.56270957", "0.56270957", "0.5618675", "0.5618675", "0.5618675", "0.5618675", "0.5615262", "0.56121534", "0.56121534", "0.5608988", "0.5608988", "0.5608988", "0.5608988", "0.5608988", "0.5608988" ]
0.56655955
65
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}", "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 }", "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 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.621044", "0.5764168", "0.5717833", "0.5717603", "0.5717603", "0.5697177", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56391287", "0.56391287", "0.56391287", "0.56391287", "0.56391287", "0.56391287", "0.56391287", "0.56391287", "0.56391287", "0.56388366", "0.5623294", "0.5623294", "0.5623294", "0.5623294", "0.5623294", "0.5623294", "0.5623294", "0.5623294", "0.56146437", "0.5603489", "0.5593734", "0.5593734", "0.5593734", "0.5593734", "0.55931616", "0.55931616", "0.55870533", "0.5581747", "0.55711675", "0.55461824", "0.55461824", "0.55461824", "0.5513021", "0.54690313", "0.54556835", "0.54409623", "0.5440227", "0.5429919", "0.5402373", "0.5318943", "0.5313838", "0.52884907", "0.52884907", "0.52884907", "0.52884907", "0.52884907", "0.52884907", "0.52884907", "0.52884907", "0.52884907", "0.52884907", "0.52884907", "0.52884907", "0.52884907", "0.52884907", "0.52884907", "0.5286594", "0.5276869", "0.52751434", "0.52751434", "0.5273467", "0.52667445", "0.5262425", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963", "0.5259963" ]
0.0
-1
Perform a change on the document data structure.
function updateDoc(doc, change, markedSpans, estimateHeight$$1) { function spansFor(n) {return markedSpans ? markedSpans[n] : null} function update(line, text, spans) { updateLine(line, text, spans, estimateHeight$$1); 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$$1)); } 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$$1)); 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", "iterChanges(f, individual = false) {\n iterChanges(this, f, individual);\n }", "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 }", "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 opf(f) {\n // Get the document title\n // Depending on the browser, namespaces may or may not be handled here\n var title = $(f).find('title').text(); // Safari\n var author = $(f).find('creator').text();\n $('#content-title').html(title + ' by ' + author);\n // Firefox\n if (title == null || title == '') {\n\t$('#content-title').html($(f).find('dc\\\\:title').text() + ' by ' + $(f).find('dc\\\\:creator').text());\n }\n // Get the NCX\n var opf_item_tag = 'opf\\\\:item';\n if ($(f).find('opf\\\\:item').length == 0) {\n\topf_item_tag = 'item';\n }\n\n $(f).find(opf_item_tag).each(function() {\n\t// Cheat and find the first file ending in NCX\n\tif ( $(this).attr('href').indexOf('.ncx') != -1) {\n\t ncx_file = epub_dir + '/' + oebps_dir + '/' + $(this).attr('href');\n\t jQuery.get(ncx_file, {}, toc);\n\t}\n });\n\n}" ]
[ "0.7287167", "0.7266578", "0.7266578", "0.7266578", "0.7266578", "0.7266578", "0.7266578", "0.7266578", "0.7241715", "0.7241715", "0.7241715", "0.72227263", "0.7220414", "0.7196992", "0.7166822", "0.7166822", "0.7166822", "0.7166822", "0.7166822", "0.7166822", "0.7166822", "0.7166822", "0.7166822", "0.7166822", "0.7166822", "0.71549785", "0.71549785", "0.56668353", "0.5448494", "0.5378869", "0.53597337", "0.5319664", "0.528161", "0.5215053", "0.5163509", "0.5070972", "0.50379854", "0.502955", "0.4999666", "0.49859524", "0.49714288", "0.49685583", "0.49676147", "0.49610114", "0.4916877", "0.49038535", "0.48997432", "0.48975202", "0.48975202", "0.48975202", "0.48649094", "0.485095", "0.48505655", "0.48230723", "0.4813881", "0.48105296", "0.4778177", "0.476854", "0.47638386", "0.47532716", "0.47093397", "0.47072023", "0.46814477", "0.46803975", "0.46748608", "0.4660625", "0.46492144", "0.4642975", "0.46422955", "0.46406308", "0.46324354", "0.46288475", "0.46237606", "0.4617341", "0.46058932", "0.46000832", "0.45997125", "0.4598037", "0.45943132", "0.45812398", "0.4577378", "0.45754912", "0.45739666", "0.45718074" ]
0.7237167
22
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
36
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.6958748", "0.69447005", "0.69312567", "0.69312567", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.6918998", "0.6918998", "0.6918998", "0.6907962", "0.6907962", "0.6907962", "0.6907962", "0.6907962", "0.6907962", "0.6907962", "0.689961", "0.6872123", "0.5706439", "0.5547983", "0.54580265", "0.5449471", "0.5438329", "0.54157865", "0.54078686", "0.54078686", "0.5406535", "0.5402884", "0.54001445", "0.54001445", "0.54001445", "0.54001445", "0.54001445", "0.54001445", "0.54001445", "0.5368088", "0.5368088", "0.5368088", "0.5368088", "0.5368088", "0.5368088", "0.5368088", "0.5368088", "0.5368088", "0.5368088", "0.5368088", "0.5368088", "0.5368088", "0.5368088", "0.5368088", "0.5363194", "0.53457445", "0.53457445", "0.5341256", "0.5341256", "0.5316203", "0.5316203", "0.5316203", "0.5316203", "0.5316203", "0.5316203", "0.5316203", "0.5316203", "0.5316203", "0.5316203", "0.5316203", "0.5311679", "0.5306281", "0.5281178", "0.5255712", "0.5224457", "0.52231926", "0.5213004", "0.5213004", "0.52026504" ]
0.6886383
37
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.71146864", "0.71049196", "0.71049196", "0.71049196", "0.71049196", "0.71049196", "0.71049196", "0.71049196", "0.7104582", "0.7101796", "0.7101796", "0.7101796", "0.7078037", "0.69913226", "0.69913226", "0.69913226", "0.69913226", "0.69913226", "0.69913226", "0.69913226", "0.69913226", "0.69913226", "0.69913226", "0.69913226", "0.6986185", "0.6986185", "0.6983988", "0.6480441", "0.64539677", "0.64539677", "0.64539677", "0.64539677", "0.64539677", "0.64539677", "0.64539677", "0.64539677", "0.64539677", "0.64539677", "0.64539677", "0.64539677", "0.64539677", "0.64539677", "0.64539677", "0.64539677", "0.64539677", "0.64450645", "0.64236504", "0.64236504", "0.64236504", "0.64139247", "0.64116484", "0.64116484", "0.64116484", "0.64116484", "0.64116484", "0.64116484", "0.64116484", "0.63923377", "0.6378868", "0.6378868", "0.6378868", "0.6378868", "0.6378868", "0.6378868", "0.6378868", "0.6378868", "0.6378868", "0.6378868", "0.6378868", "0.637253", "0.63705957", "0.63705957", "0.6327323", "0.6293017", "0.6277012", "0.6253675", "0.6239293", "0.62366235", "0.62366235", "0.62366235", "0.6229874", "0.6229874", "0.62158316", "0.62158316" ]
0.7082584
26
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 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 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 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.6684377", "0.63812923", "0.63594687", "0.6341587", "0.6341587", "0.6341587", "0.6277825", "0.6277825", "0.6277825", "0.6277825", "0.6277825", "0.6277825", "0.6277825", "0.6248254", "0.6231327", "0.6231327", "0.6214123", "0.6214123", "0.6214123", "0.6214123", "0.6214123", "0.6214123", "0.6214123", "0.6214123", "0.6214123", "0.6214123", "0.6214123", "0.6196934", "0.602252", "0.60180897", "0.5990516", "0.5990516", "0.5990516", "0.59262985", "0.59262985", "0.59262985", "0.59262985", "0.59262985", "0.59262985", "0.59262985", "0.59124774", "0.5909062", "0.5909062", "0.5909062", "0.5909062", "0.5909062", "0.5909062", "0.5909062", "0.5909062", "0.5909062", "0.5909062", "0.5909062", "0.5909062", "0.5909062", "0.5909062", "0.5909062", "0.5909062", "0.5909062", "0.58732074", "0.58732074", "0.58732074", "0.58732074", "0.58732074", "0.58732074", "0.58732074", "0.58732074", "0.58732074", "0.58732074", "0.58732074", "0.58711123", "0.58711123", "0.5842808", "0.58421177", "0.5819501", "0.58008397", "0.5793868", "0.578003", "0.56916153", "0.56856155", "0.56856155", "0.56856155", "0.56856155", "0.56856155", "0.56856155" ]
0.6287047
20
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
14
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 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 }", "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 }", "_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}", "get newSelection() {\n return this.selection || this.startState.selection.map(this.changes);\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}", "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 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 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 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.66129965", "0.66129965", "0.66129965", "0.6407596", "0.63369757", "0.62601", "0.62601", "0.62601", "0.61667717", "0.61398435", "0.6102082", "0.6090417", "0.6090417", "0.6082805", "0.60528", "0.6051035", "0.6049311", "0.6049311", "0.6045188", "0.6044834", "0.60216063", "0.60216063", "0.60216063", "0.60216063", "0.60216063", "0.60216063", "0.6014675", "0.598745", "0.5981662", "0.5968016", "0.5946662", "0.5935083", "0.5935083", "0.59273857", "0.59269613", "0.59101975", "0.59101975", "0.59101975", "0.59101975", "0.59101975", "0.59101975", "0.59101975", "0.59101975", "0.59101975", "0.59101975", "0.59101975", "0.5883314", "0.5824725", "0.58222574", "0.5790037", "0.5790037", "0.5747299", "0.5742137", "0.573053", "0.5726168", "0.57179046", "0.57179046", "0.57179046", "0.57042766", "0.5703758", "0.56932694", "0.56899726", "0.5673614", "0.565447", "0.5653831", "0.5638584", "0.5636108", "0.5636108", "0.5622938", "0.5603788", "0.56006014", "0.55999297", "0.55999297", "0.55999297", "0.55999297", "0.5581274", "0.5577288", "0.55718446", "0.55607086", "0.5553242", "0.5551866", "0.5550512", "0.55451983", "0.5538996" ]
0.60189223
41
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
81
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 }", "removeStoredMark(mark) {\n return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()));\n }", "clearHighlight() {\n\n //TODO - your code goes here -\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}", "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 }", "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 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 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 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\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.6540399", "0.65239275", "0.64625597", "0.6355469", "0.6310737", "0.6300743", "0.6291497", "0.62827456", "0.6254119", "0.6254119", "0.6254119", "0.623765", "0.62102455", "0.62023807", "0.6201539", "0.62006426", "0.61960566", "0.61960566", "0.61960566", "0.61960566", "0.61960566", "0.61960566", "0.61960566", "0.61960566", "0.61960566", "0.61960566", "0.61960566", "0.61960566", "0.61960566", "0.61960566", "0.61960566", "0.61960566", "0.61960566", "0.6188284", "0.6188284", "0.6188284", "0.6188284", "0.6188284", "0.6188284", "0.6188284", "0.61774397", "0.61663634", "0.61591494", "0.61585206", "0.61585206", "0.61555547", "0.61555547", "0.61555547", "0.61555547", "0.61555547", "0.61555547", "0.61555547", "0.61555547", "0.61555547", "0.61555547", "0.61555547", "0.61471856", "0.6125323", "0.6101895", "0.6068002", "0.60662794", "0.6056546", "0.60496795", "0.6048736", "0.6039519", "0.60316724", "0.5994901", "0.5982466", "0.59745574", "0.59569204", "0.5952031", "0.5951286", "0.5949311", "0.5944328", "0.5943629", "0.5941422", "0.5940082", "0.5936862", "0.59352756", "0.5933965", "0.5933965", "0.5933965", "0.593172", "0.5915066", "0.589663", "0.5893183", "0.5892321", "0.58859754", "0.5880055", "0.5880055", "0.5864002", "0.5864002", "0.5864002", "0.5864002", "0.5864002", "0.5864002", "0.5864002", "0.58637863", "0.58582675", "0.58528566", "0.58494574" ]
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
19
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.6204699", "0.61835754", "0.61484516", "0.61484516", "0.61484516", "0.60746247", "0.60746247", "0.60746247", "0.60746247", "0.60746247", "0.60746247", "0.60746247", "0.6069308", "0.6057101", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.5990942", "0.5990942", "0.5977082", "0.59708554", "0.5967252", "0.5950465", "0.5950465", "0.5950465", "0.5950465", "0.5950465", "0.5950465", "0.5950465", "0.5950465", "0.5950465", "0.5950465", "0.5950465", "0.58596945", "0.58551115", "0.5788193", "0.57670593", "0.5743305", "0.57424355", "0.5741107", "0.5741107", "0.5741107", "0.5738248", "0.5734128", "0.57305604", "0.57206404", "0.57206404", "0.57206404", "0.57206404", "0.57206404", "0.57206404", "0.57206404", "0.57204413", "0.5697106", "0.56903505", "0.56903505", "0.56903505", "0.56903505", "0.56903505", "0.56903505", "0.56903505", "0.56903505", "0.56903505", "0.56903505", "0.56903505", "0.56903505", "0.56903505", "0.56903505", "0.56903505", "0.56903505", "0.56903505", "0.56717616", "0.56717616", "0.5652996", "0.5640991", "0.5629749", "0.5625571", "0.5625571", "0.5625571", "0.5625571", "0.5625571", "0.5625571", "0.5625571", "0.5625571", "0.5625571", "0.5625571", "0.5625571" ]
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 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) {\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) {\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 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}", "getHistory() {\n return this.history;\n }", "getHistory() {\n return this.history;\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}", "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.6126061", "0.5970489", "0.5749906", "0.56571066", "0.56460977", "0.5573177", "0.5573177", "0.5573177", "0.55647707", "0.55647707", "0.55647707", "0.55647707", "0.55647707", "0.55647707", "0.55647707", "0.5560216", "0.5555117", "0.5555117", "0.5555117", "0.5555117", "0.5555117", "0.5555117", "0.5555117", "0.5555117", "0.5555117", "0.5555117", "0.5555117", "0.5555117", "0.5555117", "0.5555117", "0.5555117", "0.5555117", "0.5555117", "0.55432004", "0.55415094", "0.55261105", "0.551798", "0.55077755", "0.5505464", "0.5496825", "0.5496825", "0.5496825", "0.5496825", "0.5496825", "0.5496825", "0.5496825", "0.5496825", "0.5496825", "0.5496825", "0.5496825", "0.5489555", "0.5489555", "0.5455173", "0.541321", "0.53718483", "0.5347769", "0.52904814", "0.5287572", "0.52834797", "0.5273124", "0.5254931", "0.52304363", "0.51954097", "0.5173266", "0.51619905", "0.515212", "0.51430154", "0.5138972", "0.51307195", "0.5126109", "0.5121919", "0.51207894", "0.5099033", "0.5082179", "0.50787", "0.5070424", "0.5070424", "0.5070424", "0.5070424", "0.5070424", "0.5070424", "0.5070424", "0.50667995", "0.5060435", "0.5059223", "0.50558287", "0.50545603", "0.50545603", "0.5054333", "0.50542563", "0.50542563", "0.50542563", "0.50521094" ]
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 }", "extendRange(rangeToExtend, transform) {\n rangeToExtend.extendArray(this._points, transform);\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}", "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.64116293", "0.6395189", "0.6395189", "0.6395189", "0.6305622", "0.62692595", "0.62692595", "0.62692595", "0.62692595", "0.62692595", "0.62692595", "0.62692595", "0.62692595", "0.62262756", "0.62262756", "0.6141464", "0.59685487", "0.5950896", "0.5858771", "0.5840827", "0.5840827", "0.5840827", "0.5840827", "0.5840827", "0.5840827", "0.5840827", "0.5840827", "0.5840827", "0.5840827", "0.5840827", "0.5807897", "0.5697329", "0.56685936", "0.56685936", "0.56685936", "0.56685936", "0.56254864", "0.56254864", "0.56254864", "0.56254864", "0.56254864", "0.56254864", "0.56254864", "0.56254864", "0.56254864", "0.56254864", "0.56254864", "0.56254864", "0.56254864", "0.56254864", "0.56254864", "0.56254864", "0.56254864", "0.55884457", "0.5574958", "0.5574958", "0.5574958", "0.5574958", "0.5574958", "0.5574958", "0.5574958", "0.5574958", "0.5574958", "0.5574958", "0.5574958", "0.5513839", "0.5513839", "0.5513839", "0.54748994", "0.542108", "0.5417094", "0.54170007", "0.5415556", "0.5381949", "0.5381949", "0.5381949", "0.5381949", "0.5381949", "0.5381949", "0.5381949", "0.5381949", "0.5381949", "0.5381949", "0.5381949" ]
0.5831049
43
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
30
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); }", "_resetSelection() {\n this.__selectedRangeArr = [];\n this.__anchorSelectionIndex = -1;\n this.__leadSelectionIndex = -1;\n }", "unSelectItem (i) { this.toggSel(false, i); }", "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.67245656", "0.6698209", "0.6698209", "0.6698209", "0.66711736", "0.66366756", "0.6630632", "0.6630632", "0.6630632", "0.6630632", "0.6630632", "0.6630632", "0.6630632", "0.6630632", "0.6622489", "0.65663224", "0.65663224", "0.65525466", "0.65525466", "0.65525466", "0.6533113", "0.6533113", "0.6533113", "0.6533113", "0.64842516", "0.6337231", "0.63288134", "0.6325613", "0.6325613", "0.6325613", "0.6325613", "0.6325613", "0.6325613", "0.6325613", "0.6325613", "0.6325613", "0.6325613", "0.6325613", "0.61554486", "0.589514", "0.5827525", "0.57342476", "0.57342476", "0.57342476", "0.5724626", "0.5724626", "0.570554", "0.5693443", "0.5693443", "0.5693443", "0.5693443", "0.5693443", "0.5693443", "0.5693443", "0.5693443", "0.5672152", "0.5643525", "0.5613192", "0.5591866", "0.5507741", "0.5500059", "0.54992485", "0.54992485", "0.54992485", "0.54992485", "0.54992485", "0.54992485", "0.54992485", "0.54992485", "0.54992485", "0.54992485", "0.54992485", "0.54992485", "0.54992485", "0.54992485", "0.54992485", "0.54992485", "0.54992485", "0.54875815", "0.5481446", "0.5480619", "0.5464765", "0.5464765", "0.5464765" ]
0.63706243
41
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
35
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 clearSelection() {\n activeSheet.clearSelectedMarksAsync();\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(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}", "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}", "setRange() {\n /* if command is formatBlock expand selection to entire block */\n let block = this.rangeQuery();\n if (block) this.selectNode(block);\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 }", "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 }", "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 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 }", "clear()\n {\n this.set('selected', null);\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 }", "unSelectAll () { this.toggSelAll(false); }" ]
[ "0.79797", "0.7659073", "0.7618294", "0.74684507", "0.74392134", "0.7276428", "0.7236947", "0.7173246", "0.6906848", "0.6906848", "0.6906848", "0.688273", "0.687953", "0.687953", "0.687953", "0.687953", "0.687953", "0.687953", "0.687953", "0.687953", "0.6857984", "0.6857239", "0.6842228", "0.6828824", "0.6828824", "0.6828824", "0.6828824", "0.6828824", "0.6828824", "0.6828824", "0.6828824", "0.6828824", "0.6828824", "0.6828824", "0.6828824", "0.6828824", "0.6828824", "0.6828824", "0.6828824", "0.6828824", "0.68097323", "0.68097323", "0.6716636", "0.6710046", "0.6710046", "0.6710046", "0.6710046", "0.6710046", "0.6710046", "0.6710046", "0.6710046", "0.6710046", "0.6710046", "0.6710046", "0.67027247", "0.6655123", "0.66365", "0.66263866", "0.65987223", "0.6590831", "0.6527701", "0.6498175", "0.64907676", "0.64579356", "0.642789", "0.6419484", "0.63924295", "0.6381396", "0.6364428", "0.6347711", "0.6321474", "0.62992525", "0.6252491", "0.62194324", "0.6218754", "0.6217718", "0.6196503", "0.6162766", "0.6102263", "0.6089853", "0.6066124", "0.6037827", "0.6037827", "0.60373896", "0.60292596", "0.600147", "0.59972787", "0.59706855", "0.5953263", "0.5938105", "0.59343135", "0.5853575", "0.5853005", "0.5852949", "0.58511376", "0.5845802", "0.583594", "0.58355516", "0.5830845", "0.5828748", "0.5824182" ]
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) { var this$1 = this; this.ranges = []; for (var i = 0; i < ranges.length; i++) { this$1.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 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(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 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(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 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(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 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(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 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(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 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(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 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(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 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(doc.cm, obj.ranges, obj.ranges.length - 1) }\n else { return sel }\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 }", "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.5942009", "0.5942009", "0.5942009", "0.5942009", "0.5942009", "0.5942009", "0.5942009", "0.5942009", "0.5938451", "0.5935094", "0.59255683", "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.5919608
60
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
29
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
68
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.6847842", "0.6637457", "0.6637457", "0.6637457", "0.6637457", "0.6637457", "0.6637457", "0.6637457", "0.6596417", "0.6477013", "0.6475794", "0.6475794", "0.6437837", "0.6437837", "0.6437837", "0.6437837", "0.6437837", "0.6437837", "0.6437837", "0.6437837", "0.6437837", "0.6437837", "0.6437837", "0.6421239", "0.64046973", "0.63884413", "0.63884413", "0.63884413", "0.63631034", "0.63631034", "0.6279682", "0.62580734", "0.6101235", "0.6065642", "0.6065642", "0.6065642", "0.6065642", "0.6065642", "0.6065642", "0.6065642", "0.6065642", "0.605562", "0.6053294", "0.6053294", "0.6038506", "0.6038506", "0.6038506", "0.6038506", "0.6038506", "0.6038506", "0.6038506", "0.6038506", "0.6038506", "0.6038506", "0.6038506", "0.5994118", "0.5960186", "0.5960186", "0.5960186", "0.57761604", "0.5748023", "0.5748023", "0.5748023", "0.5748023", "0.5748023", "0.5748023", "0.5748023", "0.5748023", "0.5748023", "0.5748023", "0.5748023", "0.5748023", "0.5748023", "0.5748023", "0.5748023", "0.5748023", "0.5748023", "0.57274127", "0.5696658", "0.5685776", "0.56571037", "0.56020695", "0.5598152", "0.55841184", "0.55614555", "0.55425864" ]
0.6439841
23
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
UPDATING Allow "beforeChange" event handlers to influence a change
function filterChange(doc, change, update) { var obj = { canceled: false, from: change.from, to: change.to, text: change.text, origin: change.origin, cancel: function () { return obj.canceled = true; } }; if (update) { obj.update = function (from, to, text, origin) { if (from) { obj.from = clipPos(doc, from); } if (to) { obj.to = clipPos(doc, to); } if (text) { obj.text = text; } if (origin !== undefined) { obj.origin = origin; } }; } signal(doc, "beforeChange", doc, obj); if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); } if (obj.canceled) { return null } return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_beforeChange () {\n // nop\n }", "_beforeChange () {\n // nop\n }", "afterValidChange() { }", "internalOnChange(event) {\n const me = this,\n value = me.value,\n oldValue = me._lastValue;\n\n // Don't trigger change if we enter invalid value or if value has not changed (for IE when pressing ENTER)\n if (me.isValid && value !== oldValue) {\n me._lastValue = value;\n\n // trigger change event, signaling that origin is from user\n me.trigger('change', { value, oldValue, event, userAction: true });\n\n // per default Field triggers action event on change, but might be reconfigured in subclasses (such as Combo)\n if (me.defaultAction === 'change') {\n me.trigger('action', { value, oldValue, event });\n }\n }\n\n // since Widget has Events mixed in configured with 'callOnFunctions' this will also call onClick and onAction\n }", "change() { }", "function changeEvent() {\n var value_sub = properties.value;\n trigger_param_list.push(value_sub);\n // 'seek' event is like a forced-change event\n $pebble_slider_object.triggerHandler('seek', trigger_param_list);\n if (prev_change_value !== value_sub) {\n $pebble_slider_object.triggerHandler('change', trigger_param_list);\n prev_change_value = value_sub;\n }\n trigger_param_list.length = 0;\n }", "onCurrentChanged(value) {\n /* no-op */\n }", "_setOnChanges(){\n\t\tthis.inputs.forEach(i => i.addEventListener('change', this._onChange.bind(this)));\t\n\t}", "_triggerChangeEvent() {\n\t\tif ( this.$control.rendered && ! this.changeEventDisabled ) {\n\t\t\tthis._updateSettings();\n\t\t\tthis.events.emit( 'change', this.settings );\n\t\t}\n\t}", "changedInput() {\n\n\t\tlet {isValid, error} = this.state.wasInvalid ? this.validate() : this.state;\n\t\tlet onChange = this.props.onChange;\n\t\tif (onChange) {\n\t\t\tonChange(this.getValue(), isValid, error);\n\t\t}\n\t\tif (this.context.validationSchema) {\n\t\t\tlet value = this.getValue();\n\t\t\tif (this.state.isMultiSelect && value === '') {\n\t\t\t\tvalue = [];\n\t\t\t}\n\t\t\tif (this.shouldTypeBeNumberBySchemeDefinition(this.props.pointer)) {\n\t\t\t\tvalue = Number(value);\n\t\t\t}\n\t\t\tthis.context.validationParent.onValueChanged(this.props.pointer, value, isValid, error);\n\t\t}\n\t}", "handleEventChange() {\n }", "function onChange() {\n if (input.get.call(element, valueField) !== observer.oldValue && !element.readOnly) {\n observer.set(input.get.call(element, valueField));\n }\n }", "internalOnChange(event) {\n const me = this; // Don't trigger change if we enter invalid value or if value has not changed (for IE when pressing ENTER)\n\n if (me.isValid && me.hasChanged(me._lastValue, me.value)) {\n me.triggerChange(event, true);\n me._lastValue = me.value;\n }\n }", "registerOnChange(fn) {\n this.propagateChanges = fn;\n }", "changedCallback () {\n\t\tif (this.oldValue === this.value) return;\n\t\tthis._setTranslation();\n\t}", "internalOnChange(event) {\n /**\n * Fired before checkbox is toggled. Returning false from a listener prevents the checkbox from being toggled.\n * @event beforeChange\n * @preventable\n * @param {Core.widget.Checkbox} source Checkbox\n * @param {Boolean} checked Checked or not\n */\n\n /**\n * Fired when checkbox is toggled\n * @event change\n * @param {Core.widget.Checkbox} source Checkbox\n * @param {Boolean} checked Checked or not\n */\n this.triggerChange(true);\n }", "handleChange() {\n this.forceUpdate();\n }", "internalOnChange(event) {\n /**\n * Fired before checkbox is toggled. Returning false from a listener prevents the checkbox from being toggled.\n * @event beforeChange\n * @preventable\n * @param {Common.widget.Checkbox} source Checkbox\n * @param {Boolean} checked Checked or not\n */\n\n /**\n * Fired when checkbox is toggled\n * @event change\n * @param {Common.widget.Checkbox} source Checkbox\n * @param {Boolean} checked Checked or not\n */\n\n this.triggerChange(true);\n }", "onchange() {}", "static _valueHasChanged(value,old,hasChanged=notEqual){return hasChanged(value,old);}", "function onChange() {\n console.log(\"something changed...\");\n \n }", "function changed(change) {\n if (change.changeType === \"property\" && change.property === property) {\n fn(change);\n }\n }", "onChanged(e){}", "_onChange () {\n this.forceUpdate()\n }", "onChangeChange(value) {\r\n if (isObject(this.events) && value == this.events.change) {\r\n console.error(value);\r\n throw new Error(\"Attempt to override Forms.onChange callback with Forms.events.change will lead to infinite loop!\");\r\n }\r\n }", "dispatchChange() {\n this.toggleAttribute(\"empty\", !this.value);\n this.dispatchEvent(new CustomEvent(\"change\", { bubbles: true }));\n }", "_iStateOnValueChange() {\n this.dirty = true;\n }", "_autoChanged(newValue){this.enabled=newValue}", "change(/*event*/) {\n this._super(...arguments);\n this._parse();\n }", "function onChange() {\n\t\t__debug_429( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}", "static _valueHasChanged(value,old,hasChanged=notEqual){return hasChanged(value,old)}", "onChange () {}", "onChange () {}", "onCustomWidgetBeforeUpdate(changedProperties) {\r\n\r\n\t\t}", "function onChange() {\n\t\t__debug_412( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}", "function onChange() {\n\t\t__debug_587( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}", "_triggerChange (e) {\n var args = [this.getValue(), this.getFormElement(), this.getUIElement()];\n if (e) {\n args.push(e);\n }\n if (this.options.onChange) {\n this.options.onChange.apply(this, args);\n }\n }", "function changed() {\n\t\t\t\t\t_dispatchEvent(_this, rootEl, 'change', target, el, rootEl, oldIndex, _index(dragEl, options.draggable), evt);\n\t\t\t\t}", "function onChange() {\n\t\t/* eslint-disable no-underscore-dangle */\n\t\t__debug_730( 'Received a change event.' );\n\t\tif ( self._autoRender ) {\n\t\t\tself.render();\n\t\t}\n\t}", "function onChange() {\n\t\t__debug_520( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}", "function onChange() {\n\t\t__debug_475( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}", "function onChange() {\n\t\t__debug_488( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}", "function onChange() {\n\t\t__debug_395( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}", "onCustomWidgetBeforeUpdate(oChangedProperties) {\n\n\t\t}", "function resetChangeFlags() {\n waitForChangeEvents();\n firedBeforeChange = firedDelayedChange = false;\n}", "function onChange() {\n\t\t__debug_577( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}", "handleChange(event) {\n this.dispatchEvent(new CustomEvent('change', {detail: event.target.value}));\n }", "function onChange() {\n\t\t__debug_332( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}", "function onChange() {\n\t\t__debug_457( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}", "onCustomWidgetBeforeUpdate(oChangedProperties) {\n \n \n\n\t\t}", "onChange() {\n triggerEvent(this.input, 'input');\n triggerEvent(this.input, 'change');\n }", "function onChange() {\n\t\t/* eslint-disable no-underscore-dangle */\n\t\t__debug_259( 'Received a change event.' );\n\t\tif ( self._autoRender ) {\n\t\t\tself.render();\n\t\t}\n\t}", "reportValueChange() {\n if (this.options) {\n const value = this.getSelectedOptionValues();\n this.onChange(value);\n this._value = value;\n }\n }", "handleChange(e) {\n e.stopPropagation();\n const value = this.getInputEl().value;\n this.model.set({ value }, { fromInput: 1 });\n this.elementUpdated();\n }", "function changed() {\n\t\t\t\t_dispatchEvent(_this, rootEl, 'change', target, el, rootEl, oldIndex, _index(dragEl, options.draggable), evt);\n\t\t\t}", "function changed() {\n\t\t\t\t_dispatchEvent(_this, rootEl, 'change', target, el, rootEl, oldIndex, _index(dragEl, options.draggable), evt);\n\t\t\t}", "function onChange() {\n\t\t/* eslint-disable no-underscore-dangle */\n\t\t__debug_596( 'Received a change event.' );\n\t\tif ( self._autoRender ) {\n\t\t\tself.render();\n\t\t}\n\t}", "onGenericChange() {\n this.contentChanged.emit(void 0);\n }", "function handleChange(event, newValue) {\n setValue(newValue);\n }", "handleChangeEvent() {\n this.cacheHasChanged = true;\n }", "handleChange(event) {\n\n }", "setOnValueChangeEvent(func){\r\n this._onValueChange = func;\r\n }", "function onChange() {\n\t\t__debug_452( 'Received a change event.' );\n\t\tself.render();\n\t}", "_handleChildValueChange() {\n this.stateChanges.next(undefined);\n this._changeDetectorRef.markForCheck();\n }", "_handleChildValueChange() {\n this.stateChanges.next(undefined);\n this._changeDetectorRef.markForCheck();\n }", "function onChanged() {\n let g = getGlobal();\n\n //When the add-in creates the table, it will generate 4 events that we must ignore.\n //We only want to respond to the change events from the user.\n if (g.tableEventCount > 0) {\n g.tableEventCount--;\n return; //count down to throw away events caused by the table creation code\n }\n\n //check if dirty flag was set (flag avoids extra unnecessary ribbon operations)\n if (!g.isTableDirty) {\n g.isTableDirty = true;\n\n //Enable the Refresh and Submit buttons\n setSyncButtonEnabled(true);\n }\n}", "function onChange() {\n\t\t__debug_330( 'Received a change event.' );\n\t\tself.render();\n\t}", "handleChange () {\n this.props.onStatusChange(\n this.props.item.id,\n this.refs.checkbox.checked ? 'RESERVED' : 'NEW'\n );\n }", "function onOverrideFieldChanged(event) {\n\t\tap.consoleInfo(\"Override field \" + this.name + \" changed.\");\n\t\toverride.showHideOverrideMessage($(event.currentTarget).attr('id'));\n\t}", "function setChanged (){\n\tformModified = true;\n}", "_onChange() {\n void this._debouncer.invoke();\n }", "function changeFunction() {\n\tconsole.log(\"onchange\");\n}", "_propagateChange() {\n if (!this._isSelect) {\n // If original element is an input element\n this.element.value = this.value;\n } else {\n // If original element is a select element\n Array.from(this.element.options).forEach(option => {\n option.setAttribute('selected', undefined);\n option.selected = false;\n \n // If option has been added by TagsInput then we remove it\n // Otherwise it is an original option\n if (typeof option.dataset.source !== 'undefined') {\n option.remove();\n }\n });\n \n // Update original element options selected attributes\n this.items.forEach(item => {\n this._updateSelectOptions({\n value: this._objectItems ? item[this.options.itemValue] : item,\n text: this._objectItems ? item[this.options.itemText] : item\n });\n });\n }\n \n // Trigger Change event manually (because original input is now hidden)\n // Trick: Passes current class constructor name to prevent loop with _onOriginalInputChange handler)\n const changeEvent = new CustomEvent('change', {\n 'detail': this.constructor.name\n });\n this.element.dispatchEvent(changeEvent);\n }", "function valueChanged() {\n debug && console.log( \"ManageWorkOrderRepairDetails: value changed\" );\n JSONData.setUnsavedChanges( true, \"manageWorkOrderSave\" );\n }", "function onChangeHandler(e) {\n\n }", "function onChangeHandler(e) {\n\n }", "attributeChangedCallback(name,old,value){if(old!==value){this._attributeToProperty(name,value);}}", "static _valueHasChanged(e,t,n=notEqual){return n(e,t)}", "function v(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger(\"change\")}}", "_codemirrorValueChanged() {\n // Don't trigger change event if we're ignoring changes\n if (this._ignoreNextChange || !this.props.onChange) {\n this._ignoreNextChange = false;\n return;\n }\n\n const value = this.codeMirror.getDoc().getValue();\n\n // Disable linting if the document reaches a maximum size or is empty\n const shouldLint =\n value.length > MAX_SIZE_FOR_LINTING || value.length === 0 ? false : !this.props.noLint;\n const existingLint = this.codeMirror.options.lint || false;\n if (shouldLint !== existingLint) {\n const { lintOptions } = this.props;\n const lint = shouldLint ? lintOptions || true : false;\n this.codeMirror.setOption('lint', lint);\n }\n\n this.props.onChange(value);\n }", "addChangeListener(callback) {\n this.on('change', callback);\n }", "propertyChangedHandler(key, oldValue, value) {\n super.propertyChangedHandler(key, oldValue, value);\n\n const that = this,\n input = that.$.input;\n\n function handleLeadingZeros() {\n if (that._initialDropDownOptionsSet === true) {\n that._setDropDownOptions();\n }\n\n if (that._radixNumber === 2 || that._radixNumber === 16) {\n that._cachedInputValue = that._number.toString(that._radixNumber, that._wordLengthNumber, that.leadingZeros);\n that._editableValue = that._cachedInputValue;\n that.$.input.value = that._cachedInputValue;\n }\n }\n\n // eslint-disable-next-line\n if (value != oldValue) {\n switch (key) {\n case 'disabled':\n that._setFocusable();\n\n if (value === true) {\n that.$.upButton.disabled = true;\n that.$.downButton.disabled = true;\n }\n else {\n that._disableComponents();\n }\n\n break;\n case 'dropDownAppendTo':\n that._positionDetection.dropDownAppendToChangedHandler();\n break;\n case 'unfocusable':\n that._setFocusable();\n break;\n case 'enableMouseWheelAction':\n case 'placeholder':\n case 'readonly':\n case 'spinButtonsDelay':\n case 'spinButtonsInitialDelay':\n break;\n case 'value': {\n if (value === '' && oldValue === null) {\n return;\n }\n\n if (value === null || value === '' || oldValue === null) {\n that.value = oldValue;\n that._triggerChangeEvent = that.validation === 'strict';\n that._validate(false, value);\n that._triggerChangeEvent = false;\n that._programmaticValueIsSet = true;\n return;\n }\n\n const stringValue = value.toString(),\n stringOldValue = oldValue.toString();\n\n if (stringOldValue !== stringValue) {\n if (stringOldValue.toUpperCase() === stringValue.toUpperCase()) {\n that.value = oldValue;\n }\n\n that.value = oldValue;\n that._triggerChangeEvent = that.validation === 'strict';\n that._validate(false, stringValue);\n that._triggerChangeEvent = false;\n that._programmaticValueIsSet = true;\n }\n break;\n }\n case 'radix':\n if (that.inputFormat === 'integer') {\n that._changeRadix(value);\n }\n else {\n that.error(that.localize('integerOnly', { property: 'radix' }));\n }\n break;\n case 'leadingZeros':\n if (that.inputFormat === 'integer' && that._number !== null) {\n handleLeadingZeros();\n }\n\n break;\n case 'min':\n case 'max': {\n if (value !== null) {\n that[`_${key}IsNull`] = false;\n }\n that._numericProcessor.validateMinMax(key === 'min', key === 'max');\n\n if (that.validation === 'strict') {\n that._triggerChangeEvent = true;\n that._validate(false, that.value);\n that._triggerChangeEvent = false;\n }\n else if (that._regexSpecial.nonNumericValue.test(that.value) === false) {\n const numberToValidate = that._numericProcessor.createDescriptor(that._number),\n validValue = that._validateRange(numberToValidate);\n\n if (that._numericProcessor.compare(that.value, validValue) === true) {\n that._programmaticValueIsSet = true;\n }\n }\n break;\n }\n case 'opened':\n if (value) {\n if (that.dropDownEnabled && !that.disabled && that.value !== null) {\n that._openRadix();\n }\n else {\n that.opened = false;\n }\n }\n else {\n that._closeRadix();\n }\n break;\n case 'outputFormatString':\n if (value) {\n that._cachedInputValue = that._numberRenderer.formatNumber(that._number, value);\n that.$.input.value = that._cachedInputValue;\n }\n else {\n that._cachedInputValue = that._editableValue;\n that.$.input.value = that._editableValue;\n }\n\n break;\n case 'dropDownEnabled':\n if (value) {\n if (that.inputFormat !== 'integer') {\n that.error(that.localize('integerOnly', { property: 'dropDownEnabled' }));\n }\n\n if (that._initialDropDownOptionsSet === true) {\n that._setDropDownOptions();\n }\n }\n else if (that.opened) {\n that._closeRadix(true);\n }\n break;\n case 'spinButtons':\n if (value) {\n that.$spinButtonsContainer.removeClass('jqx-hidden');\n }\n else {\n that.$spinButtonsContainer.addClass('jqx-hidden');\n }\n that._refreshShape();\n break;\n case 'spinButtonsStep':\n that._updateSpinButtonsStepObject();\n break;\n case 'significantDigits':\n case 'precisionDigits': {\n if (key === 'precisionDigits' && that.inputFormat === 'integer') {\n that.error(that.localize('noInteger', { property: key }));\n }\n\n if (key === 'significantDigits' && that.precisionDigits !== null) {\n that.precisionDigits = null;\n }\n else if (key === 'precisionDigits' && that.significantDigits !== null) {\n that.significantDigits = null;\n }\n\n if (that._regexSpecial.nonNumericValue.test(that.value) === false) {\n const renderedValue = that._renderValue(that._number);\n\n input.value = renderedValue;\n }\n\n break;\n }\n case 'decimalSeparator': {\n that._numberRenderer.localizationObject.decimalseparator = that.decimalSeparator;\n\n const numericValue = that._discardDecimalSeparator(input.value, oldValue),\n valueWithNewSeparator = that._applyDecimalSeparator(numericValue),\n editableValueWithNewSeparator = that._applyDecimalSeparator(that._discardDecimalSeparator(that._editableValue, oldValue));\n\n input.value = valueWithNewSeparator;\n that._editableValue = editableValueWithNewSeparator;\n break;\n }\n case 'spinButtonsPosition':\n if (value === 'left') {\n that.$.container.insertBefore(that.$.spinButtonsContainer, that.$.label.nextElementSibling);\n }\n else {\n that.$.container.insertBefore(that.$.spinButtonsContainer, that.$.dropDown);\n }\n\n that._refreshShape();\n break;\n case 'wordLength':\n that._wordLengthNumber = that._numericProcessor.getWordLength(value);\n\n if (that.inputFormat === 'integer') {\n that._numericProcessor.validateMinMax(true, true);\n\n if (that._number !== null) {\n let validValue = that._validateRange(new JQX.Utilities.BigNumber(that._number));\n\n that._updateValue(validValue);\n\n if (that.leadingZeros) {\n handleLeadingZeros();\n }\n }\n }\n break;\n case 'radixDisplay':\n if (value) {\n if (that.inputFormat !== 'integer') {\n that.error(that.localize('integerOnly', { property: 'radixDisplay' }));\n }\n\n that.$radixDisplayButton.removeClass('jqx-hidden');\n }\n else {\n that.$radixDisplayButton.addClass('jqx-hidden');\n }\n that._refreshShape();\n break;\n case 'radixDisplayPosition':\n if (value === 'left') {\n that.$.container.insertBefore(that.$.radixDisplayButton, that.$.input);\n }\n else {\n that.$.container.insertBefore(that.$.radixDisplayButton, that.$.unitDisplay.nextElementSibling);\n }\n\n that._refreshShape();\n break;\n case 'inputFormat':\n that._changeInputFormat(oldValue, value);\n break;\n case 'showUnit':\n if (value) {\n that.$unitDisplay.removeClass('jqx-hidden');\n }\n else {\n that.$unitDisplay.addClass('jqx-hidden');\n }\n that._refreshShape();\n break;\n case 'unit':\n that.$.unitDisplay.innerHTML = value;\n break;\n case 'scientificNotation': {\n if (that._regexSpecial.nonNumericValue.test(that.value) === false) {\n const renderedValue = that._renderValue(that._number);\n input.value = renderedValue;\n }\n\n break;\n }\n case 'locale':\n case 'messages':\n that._initialDropDownOptionsSet = false;\n break;\n case 'nullable':\n if (oldValue === true && that.value === null) {\n that._validate(false, '0');\n }\n\n break;\n case 'validation':\n if (value === 'strict') {\n that._triggerChangeEvent = true;\n that._validate(false, that.value);\n that._triggerChangeEvent = false;\n }\n\n break;\n }\n }\n else if (typeof value !== 'string' && typeof oldValue === 'string') {\n that[key] = oldValue;\n }\n that._cachedInputValue = input.value;\n }", "function l(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger(\"change\")}}", "function l(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger(\"change\")}}", "function l(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger(\"change\")}}", "function l(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger(\"change\")}}", "function l(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger(\"change\")}}", "function l(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger(\"change\")}}", "function l(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger(\"change\")}}", "function l(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger(\"change\")}}", "attributeChangedCallback(name,old,value){if(old!==value){this._attributeToProperty(name,value)}}", "onChange(callback) {\n this.events.change.push({ callback });\n }", "function checkChangedValue() {\n var elt = $(this);\n if (!isNoteChanged() || elt.val() != elt.data('initial-value')) {\n\thandleNoteChanged(true);\n }\n}", "selectedIndexChanged(prev, next) {\n super.selectedIndexChanged(prev, next);\n this.updateValue();\n }", "handleExternalChange(propertyName, value, formattedValue) {\n this.lockService.updateCharacteristic(plugin_1.Characteristic.LockTargetState, this.getDeviceCurrentStateAsHK());\n this.lockService.updateCharacteristic(plugin_1.Characteristic.LockCurrentState, this.getDeviceCurrentStateAsHK());\n }", "initialValueChanged(previous, next) {\n // If the value is clean and the component is connected to the DOM\n // then set value equal to the attribute value.\n if (!this.dirtyValue) {\n this.value = this.initialValue;\n this.dirtyValue = false;\n }\n }", "function waitForChangeEvents() {\n clock.tick(Field.DELAYED_CHANGE_FREQUENCY + Field.CHANGE_FREQUENCY);\n}", "handleChange (event) {\n }", "function fieldChanged(type, name, linenum)\r\n{\r\n\t/* On field changed:\r\n\t - PURPOSE\r\n\t FIELDS USED:\r\n\t --Field Name--\t\t\t\t--ID--\r\n\t */\r\n\t// LOCAL VARIABLES\r\n\t\r\n\t\r\n\t// FIELD CHANGED CODE BODY\r\n\r\n}", "onChange() {\n this.validate();\n this.triggerContextUpdate();\n }", "_onChangeEvent(event) {\n // We always have to stop propagation on the change event.\n // Otherwise the change event, from the input element, will bubble up and\n // emit its event object to the component's `change` output.\n event.stopPropagation();\n this.toggleChange.emit();\n // When the slide toggle's config disables toggle change event by setting\n // `disableToggleValue: true`, the slide toggle's value does not change, and the\n // checked state of the underlying input needs to be changed back.\n if (this.defaults.disableToggleValue) {\n this._inputElement.nativeElement.checked = this.checked;\n return;\n }\n // Sync the value from the underlying input element with the component instance.\n this.checked = this._inputElement.nativeElement.checked;\n // Emit our custom change event only if the underlying input emitted one. This ensures that\n // there is no change event, when the checked state changes programmatically.\n this._emitChangeEvent();\n }" ]
[ "0.79965526", "0.79965526", "0.73935664", "0.71237224", "0.71210444", "0.69660723", "0.69213545", "0.6910988", "0.6855578", "0.6853958", "0.6851805", "0.68481123", "0.68263054", "0.68100536", "0.6746932", "0.6740989", "0.67285186", "0.67158806", "0.6686307", "0.66838264", "0.66739076", "0.66691715", "0.6653512", "0.66097933", "0.6602303", "0.657985", "0.6574694", "0.6561117", "0.6553525", "0.65406173", "0.6538804", "0.6520224", "0.6520224", "0.6501759", "0.6498564", "0.64787257", "0.64742434", "0.6473225", "0.64722955", "0.64680517", "0.64676803", "0.6465918", "0.6458427", "0.645027", "0.6445938", "0.64374655", "0.643472", "0.6434185", "0.64324325", "0.6430956", "0.6418226", "0.6414355", "0.6413483", "0.6404558", "0.6401885", "0.6401885", "0.6400496", "0.6392409", "0.63767946", "0.6375732", "0.63683933", "0.6355218", "0.63449585", "0.6342395", "0.6342395", "0.6339431", "0.63297635", "0.6329217", "0.6318248", "0.6308857", "0.6301286", "0.6290742", "0.6278206", "0.62740767", "0.62702197", "0.62702197", "0.6262151", "0.62428427", "0.62425995", "0.62355673", "0.62349063", "0.6233808", "0.62076855", "0.62076855", "0.62076855", "0.62076855", "0.62076855", "0.62076855", "0.62076855", "0.62076855", "0.6201382", "0.61995465", "0.6197174", "0.61963195", "0.61951417", "0.61942375", "0.61783206", "0.6164759", "0.6164131", "0.61626166", "0.61488444" ]
0.0
-1
Apply a change to a document, and add it to the document's history, and propagating it to all linked documents.
function makeChange(doc, change, ignoreReadOnly) { if (doc.cm) { if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) } if (doc.cm.state.suppressEdits) { return } } if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { change = filterChange(doc, change, true); if (!change) { return } } // Possibly split or suppress the update based on the presence // of read-only spans in its range. var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to); if (split) { for (var i = split.length - 1; i >= 0; --i) { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text, origin: change.origin}); } } else { makeChangeInner(doc, change); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 }", "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) {\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 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) {\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) {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 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 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 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\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\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\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) {\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 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) {\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}", "_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 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\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 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 }", "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 }", "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 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) == \"+\" && 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) == \"+\" && 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) {\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 }", "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 }", "adoptedCallback(oldDocument, newDocument) {\r\n console.log(`adoptedCallback ${oldDocument} ${newDocument}`)\r\n }", "function Ir(e,t,a){var n=e.cm&&e.cm.state.suppressEdits;if(!n||a){for(var r,f=e.history,o=e.sel,i=\"undo\"==t?f.done:f.undone,s=\"undo\"==t?f.undone:f.done,c=0;c<i.length&&(r=i[c],a?!r.ranges||r.equals(e.sel):r.ranges);c++);if(c!=i.length){for(f.lastOrigin=f.lastSelOrigin=null;;){if(r=i.pop(),!r.ranges){if(n)return void i.push(r);break}if(sr(r,s),a&&!r.equals(e.sel))return void wr(e,r,{clearRedo:!1});o=r}\n // Build up a reverse change object to add to the opposite history\n // stack (redo when undoing, and vice versa).\n var u=[];sr(o,s),s.push({changes:u,generation:f.generation}),f.generation=r.generation||++f.maxGeneration;for(var l=Oe(e,\"beforeChange\")||e.cm&&Oe(e.cm,\"beforeChange\"),_=r.changes.length-1;_>=0;--_){var m=function(a){var n=r.changes[a];if(n.origin=t,l&&!Or(e,n,!1))return i.length=0,{};u.push(ar(e,n));var f=a?Hn(e,n):p(i);Rr(e,n,f,dr(e,n)),!a&&e.cm&&e.cm.scrollIntoView({from:n.from,to:qn(n)});var o=[];\n // Propagate to the linked documents\n Xn(e,function(e,t){t||-1!=d(o,e.history)||(Gr(e.history,n),o.push(e.history)),Rr(e,n,null,dr(e,n))})}(_);if(m)return m.v}}}}", "adoptedCallback(oldDocument, newDocument) {\n console.log(`adoptedCallback ${oldDocument} ${newDocument}`)\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 }", "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}", "adoptedCallback(oldDocument, newDocument) {\n\t\tsuper.adoptedCallback(oldDocument, newDocument)\n\t}", "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 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 }" ]
[ "0.63618726", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.62850475", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6231549", "0.6224003", "0.6224003", "0.6224003", "0.6224003", "0.6224003", "0.6224003", "0.6224003", "0.62204045", "0.62204045", "0.615526", "0.6142772", "0.61001724", "0.61001724", "0.61001724", "0.57747734", "0.57082313", "0.56678504", "0.5637184", "0.5637184", "0.56235194", "0.56208354", "0.56208354", "0.56208354", "0.56208354", "0.56208354", "0.56189924", "0.56189924", "0.5618206", "0.56145036", "0.56145036", "0.56145036", "0.56145036", "0.56145036", "0.56145036", "0.56100035", "0.5605194", "0.5605194", "0.5605194", "0.5605194", "0.5605194", "0.5605194", "0.5591256", "0.55895", "0.5586709", "0.5586709", "0.5586709", "0.5586709", "0.5586709", "0.5586709", "0.5586709", "0.5586709", "0.5586709", "0.5586709", "0.5586709", "0.5586709", "0.5586709", "0.5586709", "0.5586709", "0.5586709", "0.5586709", "0.5563703", "0.5550963", "0.5325782", "0.5315826", "0.53059584", "0.52522314", "0.524396", "0.5226291", "0.52059466", "0.5204878" ]
0.0
-1
Revert a change stored in a document's history.
function makeChangeFromHistory(doc, type, allowSelectionOnly) { var suppress = doc.cm && doc.cm.state.suppressEdits; if (suppress && !allowSelectionOnly) { return } var hist = doc.history, event, selAfter = doc.sel; var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done; // Verify that there is a useable event (so that ctrl-z won't // needlessly clear selection events) var i = 0; for (; i < source.length; i++) { event = source[i]; if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges) { break } } if (i == source.length) { return } hist.lastOrigin = hist.lastSelOrigin = null; for (;;) { event = source.pop(); if (event.ranges) { pushSelectionToHistory(event, dest); if (allowSelectionOnly && !event.equals(doc.sel)) { setSelection(doc, event, {clearRedo: false}); return } selAfter = event; } else if (suppress) { source.push(event); return } else { break } } // Build up a reverse change object to add to the opposite history // stack (redo when undoing, and vice versa). var antiChanges = []; pushSelectionToHistory(selAfter, dest); dest.push({changes: antiChanges, generation: hist.generation}); hist.generation = event.generation || ++hist.maxGeneration; var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange"); var loop = function ( i ) { var change = event.changes[i]; change.origin = type; if (filter && !filterChange(doc, change, false)) { source.length = 0; return {} } antiChanges.push(historyChangeFromChange(doc, change)); var after = i ? computeSelAfterChange(doc, change) : lst(source); makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change)); if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); } var rebased = []; // Propagate to the linked documents linkedDocs(doc, function (doc, sharedHist) { if (!sharedHist && indexOf(rebased, doc.history) == -1) { rebaseHist(doc.history, change); rebased.push(doc.history); } makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change)); }); }; for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) { var returned = loop( i$1 ); if ( returned ) return returned.v; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function undo() {\n var doc = app.activeDocument;\n var states = doc.historyStates;\n \n var curr = 0;\n for (var i=0; i<states.length; i++) {\n if (states[i] == doc.activeHistoryState) {\n curr = i;\n }\n }\n \n var prev = curr - 1;\n if (prev >= 0) {\n doc.activeHistoryState = states[prev];\n return true;\n } else {\n return false;\n }\n }", "function undoChange() {\n\n this.quill.history.undo();\n}", "revert() { }", "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}", "RevertToPreviousState()\n {\n this.ChangeState(this.m_pPreviousState);\n }", "revertLastState() {\n // Make sure there is a history of state changes\n if (this._history.length > 0) {\n // Pop off the last state preserved in the history and set the current state equal to that\n this._state = this._history.pop();\n }\n // Since the state has changed, we have to emit those changes\n this._emitChange();\n }", "undo() {\n const cmd = this.history.pop();\n cmd.undo();\n }", "undo() {\n const cmd = this.history.pop();\n cmd.undo();\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 restorePrevious() {\n\t\t\tif (hasSnapshot()) {\n\t\t\t\tsnap.history.pop();\n\t\t\t\tdoRollback();\n\t\t\t}\n\t\t}", "undo () {\n if (this.editHistory.length === 0) return;\n\n let edit = reverseInput(this.editHistory.pop());\n this.edit(edit);\n this.redoStack.push(edit);\n }", "function revertChanges() {\n return manager.rejectChanges();\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}", "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 }", "undo() {\n const command = this.history.pop();\n if (command) {\n command.undo();\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}", "@action undo() {\n if (this.args.onChange) {\n let that = this;\n let undoHistory = that.undoHistory.toArray();\n\n if (undoHistory.length === 0) {\n alert('No more steps to undo.');\n return false;\n }\n\n var restoreValue = undoHistory.pop();\n\n that.undoHistory = A(undoHistory);\n // that.updateValue();\n this.args.onChange(restoreValue);\n }\n }", "function voltarHistory()\n\t{\n\t\twindow.history.back();\n\t}", "function back() {\n if (history.length > 1) {\n setHistory(prev => prev.slice(0, prev.length - 1));\n }\n }", "function History_MoveBack()\n{\n\t//forward to move to index\n\tthis.MoveToIndex(this.CurrentStateIndex - 1);\n}", "undo() {\n if (this._history.length && this._historyIndex >= 0){\n this.commit(this._historyIndex - 1);\n } else {\n return false\n }\n }", "historyBack() {\n const fenCode = this.state.chessBoardHistory.back();\n console.log('back');\n console.log(this.state.chessBoardHistory);\n this.updateBoard(fenCode);\n }", "undo () {\n if (this.canUndo()) {\n const obj = this.history[this.index]\n if (obj) {\n const action = this.actions[obj.action]\n if (action && action.undo) {\n action.undo(obj.params)\n if (obj.params.oldSelection) {\n try {\n this.editor.setDomSelection(obj.params.oldSelection)\n } catch (err) {\n console.error(err)\n }\n }\n } else {\n console.error(new Error('unknown action \"' + obj.action + '\"'))\n }\n }\n this.index--\n\n // fire onchange event\n this.onChange()\n }\n }", "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 back() {\n if (history.length > 1) {\n let update = [...history];\n update.pop();\n const newMode = update[update.length - 1]\n setMode(prev => prev = newMode)\n setHistory(prev =>prev =[...update])\n }\n }", "function back() {\n if (history.length > 1) {\n\n setMode(history[history.length - 2]);\n setHistory(prev => [...prev.slice(0, -1)]);\n }\n }", "function back() {\n if (history.length > 1) {\n const historyCopy = [...history];\n historyCopy.pop();\n setHistory(historyCopy);\n setMode(historyCopy[historyCopy.length - 1]); \n // remove end of array\n }\n }", "function redo (history) {\n debug('redo', {history})\n\n const { past, present, future } = history\n\n if (future.length <= 0) return history\n\n return {\n future: future.slice(1, future.length), // remove element from future\n present: future[0], // set element as new present\n past: [\n ...past,\n present // old present state is in the past now\n ]\n }\n}", "function undo(){\n _.last(lines).remove();\n lines.pop();\n}", "function undo() {\n\n // Only works if history is nonempty.\n if (history[0] != -1) {\n\n // Clears the topmost nonempty square of the column in which the most recent piece was played.\n for (var i = 0; (history[i] != -1 && i < 42); i++);\n document.getElementsByClassName(\"row\").item(bottoms[history[i - 1]] + 1)\n .getElementsByClassName(\"bigSquare\").item(history[i - 1])\n .style.backgroundColor = \"white\";\n\n // Updates things.\n didSomebodyWin = false;\n document.getElementById(\"instructions\").innerHTML =\n \"Click on a column to drop in a piece. Upcoming pieces are shown below.\";\n bottoms[history[i - 1]]++;\n currentTurn--;\n changeCounter();\n\n // Erases the most recent move from history.\n history[i - 1] = -1;\n\n // Un-comment to see the game history.\n // printHistory();\n }\n }", "revert() {\n lib.restore();\n }", "function _revertToPreviousContext() {\n if(!this.previousContext) {\n return this;\n }\n return this.previousContext.clone();\n }", "function Ir(e,t,a){var n=e.cm&&e.cm.state.suppressEdits;if(!n||a){for(var r,f=e.history,o=e.sel,i=\"undo\"==t?f.done:f.undone,s=\"undo\"==t?f.undone:f.done,c=0;c<i.length&&(r=i[c],a?!r.ranges||r.equals(e.sel):r.ranges);c++);if(c!=i.length){for(f.lastOrigin=f.lastSelOrigin=null;;){if(r=i.pop(),!r.ranges){if(n)return void i.push(r);break}if(sr(r,s),a&&!r.equals(e.sel))return void wr(e,r,{clearRedo:!1});o=r}\n // Build up a reverse change object to add to the opposite history\n // stack (redo when undoing, and vice versa).\n var u=[];sr(o,s),s.push({changes:u,generation:f.generation}),f.generation=r.generation||++f.maxGeneration;for(var l=Oe(e,\"beforeChange\")||e.cm&&Oe(e.cm,\"beforeChange\"),_=r.changes.length-1;_>=0;--_){var m=function(a){var n=r.changes[a];if(n.origin=t,l&&!Or(e,n,!1))return i.length=0,{};u.push(ar(e,n));var f=a?Hn(e,n):p(i);Rr(e,n,f,dr(e,n)),!a&&e.cm&&e.cm.scrollIntoView({from:n.from,to:qn(n)});var o=[];\n // Propagate to the linked documents\n Xn(e,function(e,t){t||-1!=d(o,e.history)||(Gr(e.history,n),o.push(e.history)),Rr(e,n,null,dr(e,n))})}(_);if(m)return m.v}}}}", "function _revertToPreviousContext() {\n if (!this.previousContext) {\n return this;\n }\n return this.previousContext.clone();\n }", "function restoreHistory( delta ) {\n var p = historyPosition + delta;\n if ( delta === 0 || p < 0 || p >= changeHistory.length )\n return true;\n var state = changeHistory[p];\n\n self.mode.off();\n\n $(svgContainer).empty();\n $(state.svg).clone().appendTo(svgContainer);\n self.util.svgRoot = svgRoot = svgContainer.firstChild;\n self.util.mouseCoords = svgRoot.createSVGPoint();\n initDragpoint();\n $(svgRoot).click( removeEditings );\n\n if ( delta < 0 && p < changeHistory.length-1 )\n state = changeHistory[p+1];\n\n if ( state.panzoom ) {\n self.svgPanZoom( state.panzoom[0], state.panzoom[1], state.panzoom[2], state.panzoom[3] );\n boxX0 = state.panzoom[4];\n boxY0 = state.panzoom[5];\n boxW = state.panzoom[6];\n boxH = state.panzoom[7];\n svgRoot.setAttribute( 'viewBox', boxX0+' '+boxY0+' '+boxW+' '+boxH );\n }\n adjustSize();\n\n state.mode();\n if ( state.selected )\n $(state.selected).click();\n\n historyPosition += delta;\n\n for ( var n=0; n<self.cfg.onRestoreHistory.length; n++ )\n self.cfg.onRestoreHistory[n]();\n\n return false;\n }", "function undo() {\n\t\treturn this.past.list.pop()\n\t}", "function redo(history) {\n\t debug('redo', { 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 (future.length <= 0) return history;\n\n\t return {\n\t future: future.slice(1, future.length), // remove element from future\n\t present: future[0], // set element as new present\n\t past: [].concat(_toConsumableArray(past), [present // old present state is in the past now\n\t ])\n\t };\n\t}", "function revertChanges() {\n if (typeof db.getItem(savedData) !== 'undefined' && db.getItem(savedData) !== 'undefined' && db.getItem(savedData) !== 'null' && db.getItem(savedData) != null && db.getItem(savedData) !== \"\") {\n mainP.innerHTML = db.getItem(savedData);\n //makeEditable();\n sanitizeItems();\n };\n }", "function voltar(){\n history.back();\n}", "back() {\n var val = '';\n if (this._history.length > 0) {\n val = this._history[this._index];\n if (this._index > 0) {\n this._index--;\n }\n }\n return val;\n }", "function back() {\n setMode(history.pop());\n setHistory(history);\n }", "function undo() {\r\n if (!gGame.isOn) return\r\n if (gMovesHistory.length === 0) return //possible to disable/enable during game\r\n var prevMove = gMovesHistory.pop();\r\n while (gMovesHistory.length > 0 && !prevMove.userClicked) {\r\n undoPrevMove(prevMove);\r\n prevMove = gMovesHistory.pop();\r\n }\r\n undoPrevMove(prevMove);\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 }", "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 }", "rollback(deltas = this._deltas) {\n var self = this._self;\n deltas.forEach(function(name, values) {\n var value = values[1];\n self[name] = value;\n });\n this._deltas = {};\n return (deltas);\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 undo() {\n updateFormula(function(text) {\n return text.slice(0, -1);\n });\n }", "function back() {\n if (history.length > 1) {\n setHistory(prev => {\n const newHistory = [...prev];\n newHistory.pop();\n setMode(newHistory[newHistory.length - 1]);\n return newHistory\n });\n }\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 makeChangeFromHistory(doc, type, allowSelectionOnly) {\n var suppress = doc.cm && doc.cm.state.suppressEdits;\n if (suppress && !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 } else if (suppress) {\n source.push(event);\n return\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 var suppress = doc.cm && doc.cm.state.suppressEdits;\n if (suppress && !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 } else if (suppress) {\n source.push(event);\n return\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 var suppress = doc.cm && doc.cm.state.suppressEdits;\n if (suppress && !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 } else if (suppress) {\n source.push(event);\n return\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 var suppress = doc.cm && doc.cm.state.suppressEdits;\n if (suppress && !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 } else if (suppress) {\n source.push(event);\n return\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 var suppress = doc.cm && doc.cm.state.suppressEdits;\n if (suppress && !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 } else if (suppress) {\n source.push(event);\n return\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 var suppress = doc.cm && doc.cm.state.suppressEdits;\n if (suppress && !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 } else if (suppress) {\n source.push(event);\n return\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 back() {\n history.pop();\n if (history.length >= 1) { setMode(history[history.length - 1]) }\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 undo_Canvas_Change(){\n\t\t // Checks to see whether the we can go back one step\n\t\t if(canvasHistoryPointer >= 1){\n\t\t\t canvasHistoryPointer--;\n\t\t\t postCardCanvasContext.putImageData(canvasHistory[canvasHistoryPointer].image, 0, 0);\n\t\t }\n\t\t \n\t\t // If we can't go back any further then change the color of the undo button\n\t\t if(canvasHistoryPointer <= 0){\n\t\t\t // Button 0 - the Undo Button\n\t\t\t buttons[0].material.color.setHex(0x575757);\n\t\t\t buttons[1].material.color.setHex(0xffffff);\n\t\t }\n\t\t // Otherwise this means that we can can assume that now we have a space to go\n\t\t // forward. For this reason, new we'll set the button 1 (The redo button)\n\t\t // color back to normal\n\t\t else{\n\t\t\t buttons[0].material.color.setHex(0xffffff);\n\t\t\t buttons[1].material.color.setHex(0xffffff);\n\t\t }\n\t }", "revert() {\n this._cache = this._checkpoints.pop();\n }", "revert() {\n this.$autocompleteOutput.val('');\n this.$autocompleteOutput.attr('size', 1);\n\n this._updateState(AUTOCOMPLETE_STATE.COMMANDS.HIGHLIGHT);\n this.$autocompleteInput.val(this.inputRevert);\n this.$autocompleteInput.attr('placeholder', AUTOCOMPLETE_INPUT_PLACEHOLDER.COMMAND);\n this.onAutocompleteInputChangeHandler();\n this.$autocompleteInput.focus();\n\n this.params = {};\n this.inputRevert = null;\n }", "function makeChangeFromHistory(doc, type, allowSelectionOnly) {\r\n var suppress = doc.cm && doc.cm.state.suppressEdits;\r\n if (suppress && !allowSelectionOnly) { return }\r\n\r\n var hist = doc.history, event, selAfter = doc.sel;\r\n var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done;\r\n\r\n // Verify that there is a useable event (so that ctrl-z won't\r\n // needlessly clear selection events)\r\n var i = 0;\r\n for (; i < source.length; i++) {\r\n event = source[i];\r\n if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\r\n { break }\r\n }\r\n if (i == source.length) { return }\r\n hist.lastOrigin = hist.lastSelOrigin = null;\r\n\r\n for (;;) {\r\n event = source.pop();\r\n if (event.ranges) {\r\n pushSelectionToHistory(event, dest);\r\n if (allowSelectionOnly && !event.equals(doc.sel)) {\r\n setSelection(doc, event, {clearRedo: false});\r\n return\r\n }\r\n selAfter = event;\r\n } else if (suppress) {\r\n source.push(event);\r\n return\r\n } else { break }\r\n }\r\n\r\n // Build up a reverse change object to add to the opposite history\r\n // stack (redo when undoing, and vice versa).\r\n var antiChanges = [];\r\n pushSelectionToHistory(selAfter, dest);\r\n dest.push({changes: antiChanges, generation: hist.generation});\r\n hist.generation = event.generation || ++hist.maxGeneration;\r\n\r\n var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\r\n\r\n var loop = function ( i ) {\r\n var change = event.changes[i];\r\n change.origin = type;\r\n if (filter && !filterChange(doc, change, false)) {\r\n source.length = 0;\r\n return {}\r\n }\r\n\r\n antiChanges.push(historyChangeFromChange(doc, change));\r\n\r\n var after = i ? computeSelAfterChange(doc, change) : lst(source);\r\n makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\r\n if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }\r\n var rebased = [];\r\n\r\n // Propagate to the linked documents\r\n linkedDocs(doc, function (doc, sharedHist) {\r\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\r\n rebaseHist(doc.history, change);\r\n rebased.push(doc.history);\r\n }\r\n makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\r\n });\r\n };\r\n\r\n for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {\r\n var returned = loop( i$1 );\r\n\r\n if ( returned ) return returned.v;\r\n }\r\n}", "function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n\t if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) return;\n\n\t var hist = doc.history, event, selAfter = doc.sel;\n\t var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done;\n\n\t // Verify that there is a useable event (so that ctrl-z won't\n\t // needlessly clear selection events)\n\t for (var i = 0; i < source.length; i++) {\n\t event = source[i];\n\t if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\n\t break;\n\t }\n\t if (i == source.length) return;\n\t hist.lastOrigin = hist.lastSelOrigin = null;\n\n\t for (;;) {\n\t event = source.pop();\n\t if (event.ranges) {\n\t pushSelectionToHistory(event, dest);\n\t if (allowSelectionOnly && !event.equals(doc.sel)) {\n\t setSelection(doc, event, {clearRedo: false});\n\t return;\n\t }\n\t selAfter = event;\n\t }\n\t else break;\n\t }\n\n\t // Build up a reverse change object to add to the opposite history\n\t // stack (redo when undoing, and vice versa).\n\t var antiChanges = [];\n\t pushSelectionToHistory(selAfter, dest);\n\t dest.push({changes: antiChanges, generation: hist.generation});\n\t hist.generation = event.generation || ++hist.maxGeneration;\n\n\t var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\n\n\t for (var i = event.changes.length - 1; i >= 0; --i) {\n\t var change = event.changes[i];\n\t change.origin = type;\n\t if (filter && !filterChange(doc, change, false)) {\n\t source.length = 0;\n\t return;\n\t }\n\n\t antiChanges.push(historyChangeFromChange(doc, change));\n\n\t var after = i ? computeSelAfterChange(doc, change) : lst(source);\n\t makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\n\t if (!i && doc.cm) doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)});\n\t var rebased = [];\n\n\t // Propagate to the linked documents\n\t linkedDocs(doc, function(doc, sharedHist) {\n\t if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n\t rebaseHist(doc.history, change);\n\t rebased.push(doc.history);\n\t }\n\t makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\n\t });\n\t }\n\t }", "function atras() {\n history.back();\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 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 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}", "function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n\t if (doc.cm && doc.cm.state.suppressEdits) return;\n\n\t var hist = doc.history, event, selAfter = doc.sel;\n\t var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done;\n\n\t // Verify that there is a useable event (so that ctrl-z won't\n\t // needlessly clear selection events)\n\t for (var i = 0; i < source.length; i++) {\n\t event = source[i];\n\t if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\n\t break;\n\t }\n\t if (i == source.length) return;\n\t hist.lastOrigin = hist.lastSelOrigin = null;\n\n\t for (;;) {\n\t event = source.pop();\n\t if (event.ranges) {\n\t pushSelectionToHistory(event, dest);\n\t if (allowSelectionOnly && !event.equals(doc.sel)) {\n\t setSelection(doc, event, {clearRedo: false});\n\t return;\n\t }\n\t selAfter = event;\n\t }\n\t else break;\n\t }\n\n\t // Build up a reverse change object to add to the opposite history\n\t // stack (redo when undoing, and vice versa).\n\t var antiChanges = [];\n\t pushSelectionToHistory(selAfter, dest);\n\t dest.push({changes: antiChanges, generation: hist.generation});\n\t hist.generation = event.generation || ++hist.maxGeneration;\n\n\t var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\n\n\t for (var i = event.changes.length - 1; i >= 0; --i) {\n\t var change = event.changes[i];\n\t change.origin = type;\n\t if (filter && !filterChange(doc, change, false)) {\n\t source.length = 0;\n\t return;\n\t }\n\n\t antiChanges.push(historyChangeFromChange(doc, change));\n\n\t var after = i ? computeSelAfterChange(doc, change) : lst(source);\n\t makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\n\t if (!i && doc.cm) doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)});\n\t var rebased = [];\n\n\t // Propagate to the linked documents\n\t linkedDocs(doc, function(doc, sharedHist) {\n\t if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n\t rebaseHist(doc.history, change);\n\t rebased.push(doc.history);\n\t }\n\t makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\n\t });\n\t }\n\t }" ]
[ "0.666816", "0.66606236", "0.66574264", "0.6404945", "0.6340584", "0.6331039", "0.627892", "0.627892", "0.62788844", "0.62650436", "0.62059116", "0.6139741", "0.6129738", "0.6100485", "0.60984457", "0.609307", "0.6078671", "0.59942985", "0.59702957", "0.59355396", "0.5929626", "0.59236187", "0.591775", "0.58866847", "0.5845614", "0.58351976", "0.5811921", "0.5809763", "0.5785431", "0.57532114", "0.5728215", "0.5727735", "0.57215667", "0.5708199", "0.57046306", "0.5691061", "0.567257", "0.5656397", "0.5646321", "0.5597159", "0.5596808", "0.5589539", "0.5583683", "0.5562011", "0.5543114", "0.5534757", "0.5534757", "0.55292964", "0.55292964", "0.55292964", "0.55292964", "0.55292964", "0.55292964", "0.55292964", "0.55292964", "0.55292964", "0.55292964", "0.55292964", "0.55228925", "0.55164474", "0.5506827", "0.5501161", "0.5501161", "0.5501161", "0.5501161", "0.5501161", "0.5501161", "0.55009484", "0.5498743", "0.5498743", "0.5498743", "0.5498743", "0.5498743", "0.5498743", "0.5498743", "0.5498743", "0.5498743", "0.5498743", "0.5498743", "0.5498743", "0.5498743", "0.5498743", "0.5498743", "0.5498743", "0.5498743", "0.5481107", "0.5477007", "0.5476777", "0.5473467", "0.5461719", "0.5457394", "0.5456445", "0.5448485", "0.5448485", "0.5448485", "0.5448485", "0.5448485", "0.5448485", "0.5448485", "0.54452646", "0.54446524" ]
0.0
-1
Subviews need their line numbers shifted when text is added above or below them in the parent document.
function shiftDoc(doc, distance) { if (distance == 0) { return } doc.first += distance; doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range( Pos(range.anchor.line + distance, range.anchor.ch), Pos(range.head.line + distance, range.head.ch) ); }), doc.sel.primIndex); if (doc.cm) { regChange(doc.cm, doc.first, doc.first - distance, distance); for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++) { regLineChange(doc.cm, l, "gutter"); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bn(e,t,a,n){null==t&&(t=e.doc.first),null==a&&(a=e.doc.first+e.doc.size),n||(n=0);var r=e.display;if(n&&a<r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>t)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)// Change after\n Jo&&pe(e.doc,t)<r.viewTo&&vn(e);else if(a<=r.viewFrom)// Change before\n Jo&&ge(e.doc,a+n)>r.viewFrom?vn(e):(r.viewFrom+=n,r.viewTo+=n);else if(t<=r.viewFrom&&a>=r.viewTo)// Full overlap\n vn(e);else if(t<=r.viewFrom){// Top overlap\n var f=wn(e,a,a+n,1);f?(r.view=r.view.slice(f.index),r.viewFrom=f.lineN,r.viewTo+=n):vn(e)}else if(a>=r.viewTo){// Bottom overlap\n var o=wn(e,t,t,-1);o?(r.view=r.view.slice(0,o.index),r.viewTo=o.lineN):vn(e)}else{// Gap in the middle\n var i=wn(e,t,t,-1),s=wn(e,a,a+n,1);i&&s?(r.view=r.view.slice(0,i.index).concat(ht(e,i.lineN,s.lineN)).concat(r.view.slice(s.index)),r.viewTo+=n):vn(e)}var c=r.externalMeasured;c&&(a<c.lineN?c.lineN+=n:t<c.lineN+c.size&&(r.externalMeasured=null))}", "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 }", "moveToNextLine(line) {\n let paragraph = line.paragraph;\n let paraFormat = paragraph.paragraphFormat;\n let isParagraphStart = line.isFirstLine();\n let isParagraphEnd = line.isLastLine();\n let height = 0;\n let maxDescent = 0;\n let afterSpacing = 0;\n let beforeSpacing = 0;\n let lineSpacing = 0;\n let firstLineIndent = 0;\n this.updateLineWidget(line);\n height = this.maxTextHeight;\n maxDescent = height - this.maxTextBaseline;\n //Updates before spacing at the top of Paragraph first line.\n if (isParagraphStart) {\n beforeSpacing = this.getBeforeSpacing(paragraph);\n firstLineIndent = HelperMethods.convertPointToPixel(paraFormat.firstLineIndent);\n }\n //Updates after spacing at the bottom of Paragraph last line.\n if (isParagraphEnd) {\n afterSpacing = HelperMethods.convertPointToPixel(this.getAfterSpacing(paragraph));\n }\n if (!this.isBidiReLayout && (paraFormat.bidi || this.isContainsRtl(line))) {\n this.reArrangeElementsForRtl(line, paraFormat.bidi);\n this.isRTLLayout = true;\n }\n if (isNaN(this.maxTextHeight)) {\n //Calculate line height and descent based on formatting defined in paragraph.\n let measurement = this.viewer.textHelper.measureText('a', paragraph.characterFormat);\n height = measurement.Height;\n maxDescent = height - measurement.BaselineOffset;\n }\n else {\n height = this.maxTextHeight;\n maxDescent = height - this.maxTextBaseline;\n }\n // Gets line spacing.\n lineSpacing = this.getLineSpacing(paragraph, height);\n if (paraFormat.lineSpacingType === 'Exactly'\n && lineSpacing < maxDescent + this.maxBaseline) {\n lineSpacing = maxDescent + this.maxBaseline;\n }\n let subWidth = 0;\n let whiteSpaceCount = 0;\n let textAlignment = paraFormat.textAlignment;\n // calculates the sub width, for text alignments - Center, Right, Justify.\n // if the element is paragraph end and para bidi is true and text alignment is justify\n // we need to calculate subwidth and add it to the left margin of the element.\n if (textAlignment !== 'Left' && this.viewer.textWrap && (!(textAlignment === 'Justify' && isParagraphEnd)\n || (textAlignment === 'Justify' && paraFormat.bidi))) {\n // tslint:disable-next-line:max-line-length\n let getWidthAndSpace = this.getSubWidth(line, textAlignment === 'Justify', whiteSpaceCount, firstLineIndent, isParagraphEnd);\n subWidth = getWidthAndSpace.subWidth;\n whiteSpaceCount = getWidthAndSpace.spaceCount;\n }\n let addSubWidth = false;\n let lineSpacingType = paraFormat.lineSpacingType;\n for (let i = 0; i < line.children.length; i++) {\n let topMargin = 0;\n let bottomMargin = 0;\n let leftMargin = 0;\n let elementBox = line.children[i];\n // tslint:disable-next-line:max-line-length\n let alignElements = this.alignLineElements(elementBox, topMargin, bottomMargin, maxDescent, addSubWidth, subWidth, textAlignment, whiteSpaceCount, i === line.children.length - 1);\n topMargin = alignElements.topMargin;\n bottomMargin = alignElements.bottomMargin;\n addSubWidth = alignElements.addSubWidth;\n whiteSpaceCount = alignElements.whiteSpaceCount;\n //Updates line spacing, paragraph after/ before spacing and aligns the text to base line offset.\n if (lineSpacingType === 'Multiple') {\n if (lineSpacing > height) {\n bottomMargin += lineSpacing - height;\n }\n else {\n topMargin += lineSpacing - height;\n }\n }\n else if (lineSpacingType === 'Exactly') {\n topMargin += lineSpacing - (topMargin + elementBox.height + bottomMargin);\n }\n else if (lineSpacing > topMargin + elementBox.height + bottomMargin) {\n topMargin += lineSpacing - (topMargin + elementBox.height + bottomMargin);\n }\n topMargin += beforeSpacing;\n bottomMargin += afterSpacing;\n if (i === 0) {\n line.height = topMargin + elementBox.height + bottomMargin;\n if (textAlignment === 'Right' || (textAlignment === 'Justify' && paraFormat.bidi && isParagraphEnd)) {\n //Aligns the text as right justified and consider subwidth for bidirectional paragrph with justify.\n leftMargin = subWidth;\n }\n else if (textAlignment === 'Center') {\n //Aligns the text as center justified.\n leftMargin = subWidth / 2;\n }\n }\n elementBox.margin = new Margin(leftMargin, topMargin, 0, bottomMargin);\n elementBox.line = line;\n }\n this.viewer.cutFromTop(this.viewer.clientActiveArea.y + line.height);\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 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 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 ensureLineWrapped(lineView) {\n\t\t if (lineView.node == lineView.text) {\n\t\t lineView.node = elt(\"div\", null, null, \"position: relative\");\n\t\t if (lineView.text.parentNode)\n\t\t { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }\n\t\t lineView.node.appendChild(lineView.text);\n\t\t if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }\n\t\t }\n\t\t return lineView.node\n\t\t }", "function ensureLineWrapped(lineView) {\n\t\t if (lineView.node == lineView.text) {\n\t\t lineView.node = elt(\"div\", null, null, \"position: relative\");\n\t\t if (lineView.text.parentNode)\n\t\t lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n\t\t lineView.node.appendChild(lineView.text);\n\t\t if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\n\t\t }\n\t\t return lineView.node;\n\t\t }", "function OnBaselineOffsetChanged(/*DependencyObject*/ d, /*DependencyPropertyChangedEventArgs*/ e)\r\n\t{ \r\n\t //Set up our baseline changed event \r\n\r\n\t //fire event! \r\n\t var te = TextElement.ContainerTextElementField.GetValue(d);\r\n\r\n\t if (te != null)\r\n\t { \r\n\t var parent = te.TextContainer.Parent;\r\n\t var tb = parent instanceof TextBlock ? parent : null; \r\n\t if (tb != null) \r\n\t {\r\n\t tb.OnChildBaselineOffsetChanged(d); \r\n\t }\r\n\t else\r\n\t {\r\n\t var fd = parent instanceof FlowDocument ? parent : null; \r\n\t if (fd != null && d instanceof UIElement)\r\n\t { \r\n\t fd.OnChildDesiredSizeChanged(d); \r\n\t }\r\n\t } \r\n\t }\r\n\t}", "drawSubviews() {}", "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 }", "movePreviousPosition() {\n let index = 0;\n let inlineInfo = this.currentWidget.getInline(this.offset, index);\n let inline = inlineInfo.element;\n index = inlineInfo.index;\n let lineIndex = this.paragraph.childWidgets.indexOf(this.currentWidget);\n if (inline instanceof FieldElementBox && inline.fieldType === 1 && !isNullOrUndefined(inline.fieldBegin)) {\n this.movePreviousPositionInternal(inline);\n }\n this.updateOffsetToPrevPosition(index, false);\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 }", "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 }", "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 }", "resizeRect(numLinesOfText) {\n this.rect.width(200);\n const rectHeight = numLinesOfText * 21 + 20\n this.rect.height(rectHeight);\n this.text.center(0.5 * this.rect.width(), 0.5 * this.rect.height());\n this.dropShadow.height(rectHeight)\n this.editRect.height(rectHeight - 10)\n\n this.arrow_hitbox.size(this.rect.width() + ARROW_HITBOX_MARGIN * 2, this.rect.height() + ARROW_HITBOX_MARGIN * 2);\n\n this.group.node.dispatchEvent(new CustomEvent(\"dragmove\")); // update any connectables looking for drag events\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\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 withLineNumbers(renderer) {\n renderer.renderer.rules.paragraph_open\n = renderer.renderer.rules.heading_open\n = renderer.renderer.rules.ordered_list_open\n = renderer.renderer.rules.bullet_list_open\n = renderer.renderer.rules.blockquote_open\n = renderer.renderer.rules.dl_open\n = injectLineNumbers;\n renderer.renderer.rules.html_block = html_block_injectLineNumbers;\n renderer.renderer.rules.code_block\n // = renderer.renderer.rules.fence\n = code_block_injectLineNumbers;\n return renderer;\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 }", "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 updateLines(){\n showLines.innerHTML = ++lineCounter;\n nextLevel(); \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 }", "layoutEmptyLineWidget(paragraph, isEmptyLine, line, isShiftEnter) {\n let paraFormat = paragraph.paragraphFormat;\n let subWidth = 0;\n let whiteSpaceCount = 0;\n isShiftEnter = isNullOrUndefined(isShiftEnter) ? false : isShiftEnter;\n //Calculate line height and descent based on formatting defined in paragraph.\n let paragraphMarkSize = this.viewer.textHelper.getParagraphMarkSize(paragraph.characterFormat);\n let maxHeight = paragraphMarkSize.Height;\n let beforeSpacing = this.getBeforeSpacing(paragraph);\n let lineWidget;\n if (paragraph.childWidgets.length > 0 && !isShiftEnter) {\n lineWidget = paragraph.childWidgets[0];\n if (lineWidget.children.length > 0) {\n if (!this.isBidiReLayout && (paraFormat.bidi || this.isContainsRtl(lineWidget))) {\n this.reArrangeElementsForRtl(lineWidget, paraFormat.bidi);\n }\n let isParagraphStart = lineWidget.isFirstLine();\n let isParagraphEnd = lineWidget.isLastLine();\n let firstLineIndent = 0;\n if (isParagraphStart) {\n beforeSpacing = this.getBeforeSpacing(paragraph);\n firstLineIndent = HelperMethods.convertPointToPixel(paraFormat.firstLineIndent);\n }\n let textAlignment = paraFormat.textAlignment;\n if (textAlignment !== 'Left' && this.viewer.textWrap\n && (!(textAlignment === 'Justify' && isParagraphEnd)\n || (textAlignment === 'Justify' && paraFormat.bidi))) {\n // tslint:disable-next-line:max-line-length\n let getWidthAndSpace = this.getSubWidth(lineWidget, textAlignment === 'Justify', whiteSpaceCount, firstLineIndent, isParagraphEnd);\n subWidth = getWidthAndSpace.subWidth;\n whiteSpaceCount = getWidthAndSpace.spaceCount;\n }\n }\n }\n else {\n lineWidget = isEmptyLine ? this.addLineWidget(paragraph) : line;\n }\n //isNullOrUndefined(this.viewer.currentHeaderFooter) && \n if (this.viewer instanceof PageLayoutViewer\n && this.viewer.clientActiveArea.height < beforeSpacing + maxHeight\n && this.viewer.clientActiveArea.y !== this.viewer.clientArea.y) {\n this.moveToNextPage(this.viewer, lineWidget);\n }\n //Gets line spacing.\n let lineSpacing = this.getLineSpacing(paragraph, maxHeight);\n let maxDescent = maxHeight - paragraphMarkSize.BaselineOffset;\n //Calculate the bottom position of current line - max height + line spacing.\n if (!isNaN(this.maxTextHeight)\n && maxHeight < this.maxTextHeight) {\n maxHeight = this.maxTextHeight;\n maxDescent = maxHeight - this.maxTextBaseline;\n }\n let topMargin = 0;\n let bottomMargin = 0;\n let leftMargin = 0;\n let height = maxHeight;\n let lineSpacingType = paragraph.paragraphFormat.lineSpacingType;\n if (lineSpacingType === 'Multiple') {\n if (lineSpacing > maxHeight) {\n bottomMargin += lineSpacing - maxHeight;\n }\n else {\n topMargin += lineSpacing - maxHeight;\n }\n }\n else if (lineSpacingType === 'Exactly') {\n topMargin += lineSpacing - (topMargin + height + bottomMargin);\n }\n else if (lineSpacing > topMargin + height + bottomMargin) {\n topMargin += lineSpacing - (topMargin + height + bottomMargin);\n }\n topMargin += beforeSpacing;\n bottomMargin += HelperMethods.convertPointToPixel(this.getAfterSpacing(paragraph));\n for (let i = 0; i < lineWidget.children.length; i++) {\n let element = lineWidget.children[i];\n if (i === 0 && element instanceof ListTextElementBox) {\n let textAlignment = paragraph.paragraphFormat.textAlignment;\n if (textAlignment === 'Right') { //Aligns the text as right justified.\n leftMargin = subWidth;\n }\n else if (textAlignment === 'Center') { //Aligns the text as center justified.\n leftMargin = subWidth / 2;\n }\n element.margin = new Margin(leftMargin, topMargin, 0, bottomMargin);\n element.line = lineWidget;\n lineWidget.height = topMargin + height + bottomMargin;\n }\n }\n lineWidget.height = topMargin + height + bottomMargin;\n this.viewer.cutFromTop(this.viewer.clientActiveArea.y + lineWidget.height);\n //Clears the previous line elements from collection. \n }", "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 }", "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}", "get lineWrapping() { return this.viewState.heightOracle.lineWrapping; }", "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 ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n\n if (lineView.text.parentNode) {\n lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n }\n\n lineView.node.appendChild(lineView.text);\n\n if (ie && ie_version < 8) {\n lineView.node.style.zIndex = 2;\n }\n }\n\n return lineView.node;\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 ensureLineWrapped(lineView) {\n\t if (lineView.node == lineView.text) {\n\t lineView.node = elt(\"div\", null, null, \"position: relative\");\n\t if (lineView.text.parentNode)\n\t lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n\t lineView.node.appendChild(lineView.text);\n\t if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\n\t }\n\t return lineView.node;\n\t }", "function ensureLineWrapped(lineView) {\n\t if (lineView.node == lineView.text) {\n\t lineView.node = elt(\"div\", null, null, \"position: relative\");\n\t if (lineView.text.parentNode)\n\t lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n\t lineView.node.appendChild(lineView.text);\n\t if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\n\t }\n\t return lineView.node;\n\t }", "function ensureLineWrapped(lineView) {\n\t if (lineView.node == lineView.text) {\n\t lineView.node = elt(\"div\", null, null, \"position: relative\");\n\t if (lineView.text.parentNode)\n\t lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n\t lineView.node.appendChild(lineView.text);\n\t if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\n\t }\n\t return lineView.node;\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) {\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 yn(e,t,a){e.curOp.viewChanged=!0;var n=e.display,r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var f=n.view[ka(e,t)];if(null!=f.node){var o=f.changes||(f.changes=[]);-1==d(o,a)&&o.push(a)}}}", "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(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) {\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 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 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}", "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 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 }" ]
[ "0.59886837", "0.5932061", "0.5651753", "0.56376565", "0.55780476", "0.55274785", "0.55163205", "0.55099046", "0.5506641", "0.54507947", "0.5449167", "0.5448703", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.544307", "0.5434363", "0.54288757", "0.5424538", "0.5421439", "0.5421439", "0.5421439", "0.5421439", "0.5421439", "0.5421439", "0.5421439", "0.5421439", "0.5413772", "0.54127884", "0.540568", "0.5404741", "0.53979677", "0.53971004", "0.53971004", "0.5397006", "0.53961754", "0.5388361", "0.53848475", "0.5381526", "0.5381526", "0.5381526", "0.5374838", "0.5374838", "0.5374838", "0.5374838", "0.5374838", "0.5374838", "0.5374838", "0.5374838", "0.5374838", "0.5374838", "0.5374838", "0.5374838", "0.5374838", "0.5374838", "0.5374838", "0.5374838", "0.5374838", "0.5373495", "0.5366334", "0.5366334", "0.5366334", "0.5357417", "0.5357417", "0.5357417", "0.5357417", "0.5357417", "0.5357417", "0.5357417", "0.5357417", "0.53492165", "0.5348716", "0.53456914", "0.53456914", "0.53456914", "0.53456914", "0.53456914", "0.53456914", "0.53456914", "0.53456914", "0.53456914", "0.53456914", "0.53456914", "0.53446335", "0.53446335", "0.53446335", "0.53446335" ]
0.0
-1
More lowerlevel change function, handling only a single document (not linked ones).
function makeChangeSingleDoc(doc, change, selAfter, spans) { if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) } if (change.to.line < doc.first) { shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line)); return } if (change.from.line > doc.lastLine()) { return } // Clip the change to the size of this doc if (change.from.line < doc.first) { var shift = change.text.length - 1 - (doc.first - change.from.line); shiftDoc(doc, shift); change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch), text: [lst(change.text)], origin: change.origin}; } var last = doc.lastLine(); if (change.to.line > last) { change = {from: change.from, to: Pos(last, getLine(doc, last).text.length), text: [change.text[0]], origin: change.origin}; } change.removed = getBetween(doc, change.from, change.to); if (!selAfter) { selAfter = computeSelAfterChange(doc, change); } if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); } else { updateDoc(doc, change, spans); } setSelectionNoUndo(doc, selAfter, sel_dontScroll); }
{ "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 }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n\t\t if (doc.cm && !doc.cm.curOp)\n\t\t return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n\t\t\n\t\t if (change.to.line < doc.first) {\n\t\t shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n\t\t return;\n\t\t }\n\t\t if (change.from.line > doc.lastLine()) return;\n\t\t\n\t\t // Clip the change to the size of this doc\n\t\t if (change.from.line < doc.first) {\n\t\t var shift = change.text.length - 1 - (doc.first - change.from.line);\n\t\t shiftDoc(doc, shift);\n\t\t change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n\t\t text: [lst(change.text)], origin: change.origin};\n\t\t }\n\t\t var last = doc.lastLine();\n\t\t if (change.to.line > last) {\n\t\t change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n\t\t text: [change.text[0]], origin: change.origin};\n\t\t }\n\t\t\n\t\t change.removed = getBetween(doc, change.from, change.to);\n\t\t\n\t\t if (!selAfter) selAfter = computeSelAfterChange(doc, change);\n\t\t if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\n\t\t else updateDoc(doc, change, spans);\n\t\t setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\t\t }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n\t\t if (doc.cm && !doc.cm.curOp)\n\t\t { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n\t\t if (change.to.line < doc.first) {\n\t\t shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n\t\t return\n\t\t }\n\t\t if (change.from.line > doc.lastLine()) { return }\n\n\t\t // Clip the change to the size of this doc\n\t\t if (change.from.line < doc.first) {\n\t\t var shift = change.text.length - 1 - (doc.first - change.from.line);\n\t\t shiftDoc(doc, shift);\n\t\t change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n\t\t text: [lst(change.text)], origin: change.origin};\n\t\t }\n\t\t var last = doc.lastLine();\n\t\t if (change.to.line > last) {\n\t\t change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n\t\t text: [change.text[0]], origin: change.origin};\n\t\t }\n\n\t\t change.removed = getBetween(doc, change.from, change.to);\n\n\t\t if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n\t\t if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n\t\t else { updateDoc(doc, change, spans); }\n\t\t setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n\t\t if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n\t\t { doc.cantEdit = false; }\n\t\t }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n\t if (doc.cm && !doc.cm.curOp)\n\t return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n\t\n\t if (change.to.line < doc.first) {\n\t shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n\t return;\n\t }\n\t if (change.from.line > doc.lastLine()) return;\n\t\n\t // Clip the change to the size of this doc\n\t if (change.from.line < doc.first) {\n\t var shift = change.text.length - 1 - (doc.first - change.from.line);\n\t shiftDoc(doc, shift);\n\t change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n\t text: [lst(change.text)], origin: change.origin};\n\t }\n\t var last = doc.lastLine();\n\t if (change.to.line > last) {\n\t change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n\t text: [change.text[0]], origin: change.origin};\n\t }\n\t\n\t change.removed = getBetween(doc, change.from, change.to);\n\t\n\t if (!selAfter) selAfter = computeSelAfterChange(doc, change);\n\t if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\n\t else updateDoc(doc, change, spans);\n\t setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\t }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n\t if (doc.cm && !doc.cm.curOp)\n\t return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n\n\t if (change.to.line < doc.first) {\n\t shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n\t return;\n\t }\n\t if (change.from.line > doc.lastLine()) return;\n\n\t // Clip the change to the size of this doc\n\t if (change.from.line < doc.first) {\n\t var shift = change.text.length - 1 - (doc.first - change.from.line);\n\t shiftDoc(doc, shift);\n\t change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n\t text: [lst(change.text)], origin: change.origin};\n\t }\n\t var last = doc.lastLine();\n\t if (change.to.line > last) {\n\t change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n\t text: [change.text[0]], origin: change.origin};\n\t }\n\n\t change.removed = getBetween(doc, change.from, change.to);\n\n\t if (!selAfter) selAfter = computeSelAfterChange(doc, change);\n\t if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\n\t else updateDoc(doc, change, spans);\n\t setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\t }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n\t if (doc.cm && !doc.cm.curOp)\n\t return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n\n\t if (change.to.line < doc.first) {\n\t shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n\t return;\n\t }\n\t if (change.from.line > doc.lastLine()) return;\n\n\t // Clip the change to the size of this doc\n\t if (change.from.line < doc.first) {\n\t var shift = change.text.length - 1 - (doc.first - change.from.line);\n\t shiftDoc(doc, shift);\n\t change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n\t text: [lst(change.text)], origin: change.origin};\n\t }\n\t var last = doc.lastLine();\n\t if (change.to.line > last) {\n\t change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n\t text: [change.text[0]], origin: change.origin};\n\t }\n\n\t change.removed = getBetween(doc, change.from, change.to);\n\n\t if (!selAfter) selAfter = computeSelAfterChange(doc, change);\n\t if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\n\t else updateDoc(doc, change, spans);\n\t setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\t }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return;\n }\n if (change.from.line > doc.lastLine()) return;\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) selAfter = computeSelAfterChange(doc, change);\n if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\n else updateDoc(doc, change, spans);\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return;\n }\n if (change.from.line > doc.lastLine()) return;\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) selAfter = computeSelAfterChange(doc, change);\n if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\n else updateDoc(doc, change, spans);\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return;\n }\n if (change.from.line > doc.lastLine()) return;\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) selAfter = computeSelAfterChange(doc, change);\n if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\n else updateDoc(doc, change, spans);\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return;\n }\n if (change.from.line > doc.lastLine()) return;\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) selAfter = computeSelAfterChange(doc, change);\n if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\n else updateDoc(doc, change, spans);\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return;\n }\n if (change.from.line > doc.lastLine()) return;\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) selAfter = computeSelAfterChange(doc, change);\n if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\n else updateDoc(doc, change, spans);\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return;\n }\n if (change.from.line > doc.lastLine()) return;\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) selAfter = computeSelAfterChange(doc, change);\n if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\n else updateDoc(doc, change, spans);\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\r\n if (doc.cm && !doc.cm.curOp)\r\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\r\n\r\n if (change.to.line < doc.first) {\r\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\r\n return\r\n }\r\n if (change.from.line > doc.lastLine()) { return }\r\n\r\n // Clip the change to the size of this doc\r\n if (change.from.line < doc.first) {\r\n var shift = change.text.length - 1 - (doc.first - change.from.line);\r\n shiftDoc(doc, shift);\r\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\r\n text: [lst(change.text)], origin: change.origin};\r\n }\r\n var last = doc.lastLine();\r\n if (change.to.line > last) {\r\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\r\n text: [change.text[0]], origin: change.origin};\r\n }\r\n\r\n change.removed = getBetween(doc, change.from, change.to);\r\n\r\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\r\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\r\n else { updateDoc(doc, change, spans); }\r\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\r\n}", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\r\n if (doc.cm && !doc.cm.curOp)\r\n return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\r\n\r\n if (change.to.line < doc.first) {\r\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\r\n return;\r\n }\r\n if (change.from.line > doc.lastLine()) return;\r\n\r\n // Clip the change to the size of this doc\r\n if (change.from.line < doc.first) {\r\n var shift = change.text.length - 1 - (doc.first - change.from.line);\r\n shiftDoc(doc, shift);\r\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\r\n text: [lst(change.text)], origin: change.origin};\r\n }\r\n var last = doc.lastLine();\r\n if (change.to.line > last) {\r\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\r\n text: [change.text[0]], origin: change.origin};\r\n }\r\n\r\n change.removed = getBetween(doc, change.from, change.to);\r\n\r\n if (!selAfter) selAfter = computeSelAfterChange(doc, change);\r\n if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\r\n else updateDoc(doc, change, spans);\r\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\r\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return;\n }\n if (change.from.line > doc.lastLine()) return;\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) selAfter = computeSelAfterChange(doc, change, null);\n if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\n else updateDoc(doc, change, spans);\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line))\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line)\n shiftDoc(doc, shift)\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin}\n }\n var last = doc.lastLine()\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin}\n }\n\n change.removed = getBetween(doc, change.from, change.to)\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change) }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans) }\n else { updateDoc(doc, change, spans) }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll)\n}", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line))\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line)\n shiftDoc(doc, shift)\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin}\n }\n var last = doc.lastLine()\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin}\n }\n\n change.removed = getBetween(doc, change.from, change.to)\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change) }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans) }\n else { updateDoc(doc, change, spans) }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll)\n}", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n}", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n}", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n}", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n}", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n}", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n}", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n}", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n}", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n}", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n}", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\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 }", "adoptedCallback(oldDocument, newDocument) {\r\n console.log(`adoptedCallback ${oldDocument} ${newDocument}`)\r\n }", "adoptedCallback(oldDocument, newDocument) {\n console.log(`adoptedCallback ${oldDocument} ${newDocument}`)\n }", "function makeChangeSingleDocInEditor(cm, change, spans) {\n\t\t var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n\t\t var recomputeMaxLength = false, checkWidthStart = from.line;\n\t\t if (!cm.options.lineWrapping) {\n\t\t checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n\t\t doc.iter(checkWidthStart, to.line + 1, function (line) {\n\t\t if (line == display.maxLine) {\n\t\t recomputeMaxLength = true;\n\t\t return true\n\t\t }\n\t\t });\n\t\t }\n\n\t\t if (doc.sel.contains(change.from, change.to) > -1)\n\t\t { signalCursorActivity(cm); }\n\n\t\t updateDoc(doc, change, spans, estimateHeight(cm));\n\n\t\t if (!cm.options.lineWrapping) {\n\t\t doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n\t\t var len = lineLength(line);\n\t\t if (len > display.maxLineLength) {\n\t\t display.maxLine = line;\n\t\t display.maxLineLength = len;\n\t\t display.maxLineChanged = true;\n\t\t recomputeMaxLength = false;\n\t\t }\n\t\t });\n\t\t if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n\t\t }\n\n\t\t retreatFrontier(doc, from.line);\n\t\t startWorker(cm, 400);\n\n\t\t var lendiff = change.text.length - (to.line - from.line) - 1;\n\t\t // Remember that these lines changed, for updating the display\n\t\t if (change.full)\n\t\t { regChange(cm); }\n\t\t else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n\t\t { regLineChange(cm, from.line, \"text\"); }\n\t\t else\n\t\t { regChange(cm, from.line, to.line + 1, lendiff); }\n\n\t\t var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n\t\t if (changeHandler || changesHandler) {\n\t\t var obj = {\n\t\t from: from, to: to,\n\t\t text: change.text,\n\t\t removed: change.removed,\n\t\t origin: change.origin\n\t\t };\n\t\t if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n\t\t if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n\t\t }\n\t\t cm.display.selForContextMenu = null;\n\t\t }", "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 makeChangeSingleDocInEditor(cm, change, spans) {\n\t\t var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\t\t\n\t\t var recomputeMaxLength = false, checkWidthStart = from.line;\n\t\t if (!cm.options.lineWrapping) {\n\t\t checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n\t\t doc.iter(checkWidthStart, to.line + 1, function(line) {\n\t\t if (line == display.maxLine) {\n\t\t recomputeMaxLength = true;\n\t\t return true;\n\t\t }\n\t\t });\n\t\t }\n\t\t\n\t\t if (doc.sel.contains(change.from, change.to) > -1)\n\t\t signalCursorActivity(cm);\n\t\t\n\t\t updateDoc(doc, change, spans, estimateHeight(cm));\n\t\t\n\t\t if (!cm.options.lineWrapping) {\n\t\t doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n\t\t var len = lineLength(line);\n\t\t if (len > display.maxLineLength) {\n\t\t display.maxLine = line;\n\t\t display.maxLineLength = len;\n\t\t display.maxLineChanged = true;\n\t\t recomputeMaxLength = false;\n\t\t }\n\t\t });\n\t\t if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n\t\t }\n\t\t\n\t\t // Adjust frontier, schedule worker\n\t\t doc.frontier = Math.min(doc.frontier, from.line);\n\t\t startWorker(cm, 400);\n\t\t\n\t\t var lendiff = change.text.length - (to.line - from.line) - 1;\n\t\t // Remember that these lines changed, for updating the display\n\t\t if (change.full)\n\t\t regChange(cm);\n\t\t else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n\t\t regLineChange(cm, from.line, \"text\");\n\t\t else\n\t\t regChange(cm, from.line, to.line + 1, lendiff);\n\t\t\n\t\t var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n\t\t if (changeHandler || changesHandler) {\n\t\t var obj = {\n\t\t from: from, to: to,\n\t\t text: change.text,\n\t\t removed: change.removed,\n\t\t origin: change.origin\n\t\t };\n\t\t if (changeHandler) signalLater(cm, \"change\", cm, obj);\n\t\t if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n\t\t }\n\t\t cm.display.selForContextMenu = null;\n\t\t }", "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 makeChangeSingleDocInEditor(cm, change, spans) {\n\t var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\t\n\t var recomputeMaxLength = false, checkWidthStart = from.line;\n\t if (!cm.options.lineWrapping) {\n\t checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n\t doc.iter(checkWidthStart, to.line + 1, function(line) {\n\t if (line == display.maxLine) {\n\t recomputeMaxLength = true;\n\t return true;\n\t }\n\t });\n\t }\n\t\n\t if (doc.sel.contains(change.from, change.to) > -1)\n\t signalCursorActivity(cm);\n\t\n\t updateDoc(doc, change, spans, estimateHeight(cm));\n\t\n\t if (!cm.options.lineWrapping) {\n\t doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n\t var len = lineLength(line);\n\t if (len > display.maxLineLength) {\n\t display.maxLine = line;\n\t display.maxLineLength = len;\n\t display.maxLineChanged = true;\n\t recomputeMaxLength = false;\n\t }\n\t });\n\t if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n\t }\n\t\n\t // Adjust frontier, schedule worker\n\t doc.frontier = Math.min(doc.frontier, from.line);\n\t startWorker(cm, 400);\n\t\n\t var lendiff = change.text.length - (to.line - from.line) - 1;\n\t // Remember that these lines changed, for updating the display\n\t if (change.full)\n\t regChange(cm);\n\t else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n\t regLineChange(cm, from.line, \"text\");\n\t else\n\t regChange(cm, from.line, to.line + 1, lendiff);\n\t\n\t var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n\t if (changeHandler || changesHandler) {\n\t var obj = {\n\t from: from, to: to,\n\t text: change.text,\n\t removed: change.removed,\n\t origin: change.origin\n\t };\n\t if (changeHandler) signalLater(cm, \"change\", cm, obj);\n\t if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n\t }\n\t cm.display.selForContextMenu = null;\n\t }", "_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 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 makeChangeSingleDocInEditor(cm, change, spans) {\n\t var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n\t var recomputeMaxLength = false, checkWidthStart = from.line;\n\t if (!cm.options.lineWrapping) {\n\t checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n\t doc.iter(checkWidthStart, to.line + 1, function(line) {\n\t if (line == display.maxLine) {\n\t recomputeMaxLength = true;\n\t return true;\n\t }\n\t });\n\t }\n\n\t if (doc.sel.contains(change.from, change.to) > -1)\n\t signalCursorActivity(cm);\n\n\t updateDoc(doc, change, spans, estimateHeight(cm));\n\n\t if (!cm.options.lineWrapping) {\n\t doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n\t var len = lineLength(line);\n\t if (len > display.maxLineLength) {\n\t display.maxLine = line;\n\t display.maxLineLength = len;\n\t display.maxLineChanged = true;\n\t recomputeMaxLength = false;\n\t }\n\t });\n\t if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n\t }\n\n\t // Adjust frontier, schedule worker\n\t doc.frontier = Math.min(doc.frontier, from.line);\n\t startWorker(cm, 400);\n\n\t var lendiff = change.text.length - (to.line - from.line) - 1;\n\t // Remember that these lines changed, for updating the display\n\t if (change.full)\n\t regChange(cm);\n\t else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n\t regLineChange(cm, from.line, \"text\");\n\t else\n\t regChange(cm, from.line, to.line + 1, lendiff);\n\n\t var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n\t if (changeHandler || changesHandler) {\n\t var obj = {\n\t from: from, to: to,\n\t text: change.text,\n\t removed: change.removed,\n\t origin: change.origin\n\t };\n\t if (changeHandler) signalLater(cm, \"change\", cm, obj);\n\t if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n\t }\n\t cm.display.selForContextMenu = null;\n\t }", "function makeChangeSingleDocInEditor(cm, change, spans) {\n\t var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n\t var recomputeMaxLength = false, checkWidthStart = from.line;\n\t if (!cm.options.lineWrapping) {\n\t checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n\t doc.iter(checkWidthStart, to.line + 1, function(line) {\n\t if (line == display.maxLine) {\n\t recomputeMaxLength = true;\n\t return true;\n\t }\n\t });\n\t }\n\n\t if (doc.sel.contains(change.from, change.to) > -1)\n\t signalCursorActivity(cm);\n\n\t updateDoc(doc, change, spans, estimateHeight(cm));\n\n\t if (!cm.options.lineWrapping) {\n\t doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n\t var len = lineLength(line);\n\t if (len > display.maxLineLength) {\n\t display.maxLine = line;\n\t display.maxLineLength = len;\n\t display.maxLineChanged = true;\n\t recomputeMaxLength = false;\n\t }\n\t });\n\t if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n\t }\n\n\t // Adjust frontier, schedule worker\n\t doc.frontier = Math.min(doc.frontier, from.line);\n\t startWorker(cm, 400);\n\n\t var lendiff = change.text.length - (to.line - from.line) - 1;\n\t // Remember that these lines changed, for updating the display\n\t if (change.full)\n\t regChange(cm);\n\t else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n\t regLineChange(cm, from.line, \"text\");\n\t else\n\t regChange(cm, from.line, to.line + 1, lendiff);\n\n\t var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n\t if (changeHandler || changesHandler) {\n\t var obj = {\n\t from: from, to: to,\n\t text: change.text,\n\t removed: change.removed,\n\t origin: change.origin\n\t };\n\t if (changeHandler) signalLater(cm, \"change\", cm, obj);\n\t if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n\t }\n\t cm.display.selForContextMenu = null;\n\t }", "adoptedCallback(oldDocument, newDocument) {\n\t\tsuper.adoptedCallback(oldDocument, newDocument)\n\t}", "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 }", "function makeChangeSingleDocInEditor(cm, change, spans) {\r\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\r\n\r\n var recomputeMaxLength = false, checkWidthStart = from.line;\r\n if (!cm.options.lineWrapping) {\r\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\r\n doc.iter(checkWidthStart, to.line + 1, function (line) {\r\n if (line == display.maxLine) {\r\n recomputeMaxLength = true;\r\n return true\r\n }\r\n });\r\n }\r\n\r\n if (doc.sel.contains(change.from, change.to) > -1)\r\n { signalCursorActivity(cm); }\r\n\r\n updateDoc(doc, change, spans, estimateHeight(cm));\r\n\r\n if (!cm.options.lineWrapping) {\r\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\r\n var len = lineLength(line);\r\n if (len > display.maxLineLength) {\r\n display.maxLine = line;\r\n display.maxLineLength = len;\r\n display.maxLineChanged = true;\r\n recomputeMaxLength = false;\r\n }\r\n });\r\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\r\n }\r\n\r\n retreatFrontier(doc, from.line);\r\n startWorker(cm, 400);\r\n\r\n var lendiff = change.text.length - (to.line - from.line) - 1;\r\n // Remember that these lines changed, for updating the display\r\n if (change.full)\r\n { regChange(cm); }\r\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\r\n { regLineChange(cm, from.line, \"text\"); }\r\n else\r\n { regChange(cm, from.line, to.line + 1, lendiff); }\r\n\r\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\r\n if (changeHandler || changesHandler) {\r\n var obj = {\r\n from: from, to: to,\r\n text: change.text,\r\n removed: change.removed,\r\n origin: change.origin\r\n };\r\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\r\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\r\n }\r\n cm.display.selForContextMenu = null;\r\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, origin: change.origin}); }\r\n } else {\r\n makeChangeInner(doc, change);\r\n }\r\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\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 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, origin: change.origin}); }\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, origin: change.origin}); }\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, origin: change.origin}); }\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, origin: change.origin}); }\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, origin: change.origin}); }\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, origin: change.origin}); }\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, origin: change.origin}); }\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, origin: change.origin}); }\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, origin: change.origin}); }\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, origin: change.origin}); }\n } else {\n makeChangeInner(doc, change);\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 makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function changeDoc(req, res) {\n var id = req.swagger.params.id.value;\n var data = JSON.parse(req.swagger.params.docname.value);\n var userId = req.decoded.user_id;\n var clientId = req.decoded.client_id;\n var name = data.docname;\n var autor = data.autor;\n var filename = data.filename\n var query = '';\n //console.log(name); \n if (data.docname) {\n query = `Update sadrzaj set \n name = '` + name + `', \n modified_by = ` + userId + `,\n modified_ts = NOW()\n\n where id =` + id + ` `;\n }\n if (data.autor) {\n query = `Update ri.dokumentacija set \n autor = '` + autor + `'\n where id =` + id + ` `;\n }\n if(data.filename)\n {\n query = `Update ri.dokumentacija set \n link = '` + filename + `' \n where id =` + id + ` `;\n }\n console.log(query);\n \n var client = new pg.Client(conString);\n client.connect(function(err) {\n if (err) {\n return console.error('could not connect to postgres', err);\n } else { \n client.query(query, function(err, result) {\n if (err) {\n return console.error('error running query', err);\n } else {\n\n res.json(\"Changed\");\n }\n })\n }\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 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 }", "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, origin: change.origin}); }\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, origin: change.origin}); }\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, origin: change.origin}); }\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, origin: change.origin}); }\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, origin: change.origin}); }\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, origin: change.origin}); }\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, origin: change.origin}); }\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, origin: change.origin}); }\n } else {\n makeChangeInner(doc, change);\n }\n }" ]
[ "0.70032144", "0.66065466", "0.6573964", "0.65447193", "0.6487679", "0.6487679", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.640634", "0.640634", "0.640634", "0.640634", "0.640634", "0.640634", "0.6404163", "0.6399981", "0.6399358", "0.636251", "0.636251", "0.63543946", "0.63543946", "0.63543946", "0.63543946", "0.63543946", "0.63543946", "0.63543946", "0.63543946", "0.63543946", "0.63543946", "0.63543946", "0.6284323", "0.6276317", "0.61896425", "0.61402", "0.6091877", "0.6069248", "0.6048787", "0.60376287", "0.6018698", "0.60116005", "0.60087746", "0.60087746", "0.6008017", "0.59369916", "0.59348994", "0.5933198", "0.5922531", "0.5922531", "0.59219265", "0.5917901", "0.59059244", "0.59059244", "0.59059244", "0.59059244", "0.59059244", "0.59059244", "0.59059244", "0.59059244", "0.59059244", "0.59059244", "0.5888808", "0.5881492", "0.5881492", "0.5881492", "0.5881492", "0.5881492", "0.5881492", "0.5881492", "0.5881492", "0.5881492", "0.5881492", "0.5881492", "0.5863166", "0.58617944", "0.58617944", "0.5861582", "0.5861582", "0.5861582", "0.58606297", "0.58606297", "0.58606297", "0.58606297", "0.58606297", "0.58606297", "0.58606297", "0.58606297" ]
0.6435666
21
Handle the interaction of a change to a document with the editor that this document is part of.
function makeChangeSingleDocInEditor(cm, change, spans) { var doc = cm.doc, display = cm.display, from = change.from, to = change.to; var recomputeMaxLength = false, checkWidthStart = from.line; if (!cm.options.lineWrapping) { checkWidthStart = lineNo(visualLine(getLine(doc, from.line))); doc.iter(checkWidthStart, to.line + 1, function (line) { if (line == display.maxLine) { recomputeMaxLength = true; return true } }); } if (doc.sel.contains(change.from, change.to) > -1) { signalCursorActivity(cm); } updateDoc(doc, change, spans, estimateHeight(cm)); if (!cm.options.lineWrapping) { doc.iter(checkWidthStart, from.line + change.text.length, function (line) { var len = lineLength(line); if (len > display.maxLineLength) { display.maxLine = line; display.maxLineLength = len; display.maxLineChanged = true; recomputeMaxLength = false; } }); if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; } } retreatFrontier(doc, from.line); startWorker(cm, 400); var lendiff = change.text.length - (to.line - from.line) - 1; // Remember that these lines changed, for updating the display if (change.full) { regChange(cm); } else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) { regLineChange(cm, from.line, "text"); } else { regChange(cm, from.line, to.line + 1, lendiff); } var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change"); if (changeHandler || changesHandler) { var obj = { from: from, to: to, text: change.text, removed: change.removed, origin: change.origin }; if (changeHandler) { signalLater(cm, "change", cm, obj); } if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); } } cm.display.selForContextMenu = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _onCurrentDocumentChange() {\n var doc = DocumentManager.getCurrentDocument(),\n container = _editorHolder.get(0);\n \n var perfTimerName = PerfUtils.markStart(\"EditorManager._onCurrentDocumentChange():\\t\" + (!doc || doc.file.fullPath));\n\n // Remove scroller-shadow from the current editor\n if (_currentEditor) {\n ViewUtils.removeScrollerShadow(container, _currentEditor);\n }\n \n // Update the UI to show the right editor (or nothing), and also dispose old editor if no\n // longer needed.\n if (doc) {\n _showEditor(doc);\n ViewUtils.addScrollerShadow(container, _currentEditor);\n } else {\n _showNoEditor();\n }\n\n\n PerfUtils.addMeasurement(perfTimerName);\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 onChangeHandler() {\n\t\tconst value = editor.codemirror.getValue();\n\t\tunsavedChanges.setHasChanges(value !== settings.getDefaultValue(\"documentContent\"));\n\t\t// Render the Markdown to the viewer.\n\t\tviewer.render(value, function() {\n\t\t\t// Sync to the linked scrollbars to match the new content.\n\t\t\tscrollSync.sync($(\".CodeMirror-scroll\"), $(\".CodeMirror-scroll\"), $(\".CodeMirror-scroll, #viewer-container\"), true);\n\t\t});\n\t\tsettings.setSetting(\"documentContent\", value);\n\t}", "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 _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}", "onDocumentOpenOrContentChanged(document) {\n if (!this.startDataLoaded) {\n return;\n }\n // No need to handle file opening because we have preloaded all the files.\n // Open and changed event will be distinguished by document version later.\n if (this.shouldTrackFile(vscode_uri_1.URI.parse(document.uri).fsPath)) {\n this.trackOpenedDocument(document);\n }\n }", "function _handler(event, document, changes) {\n if (!(changes instanceof Array)) {\n changes = [changes];\n }\n\n changes.forEach(function (change) {\n var token = change.text[0],\n to = {\n ch: change.from.ch + 1,\n line: change.from.line\n };\n \n // Cancel a change if a closing character is typed after an insertion otherwise\n //Insert the matching closing character and push the token entered on the stack.\n if (_matchStack[_matchStack.length - 1] === token) {\n document.replaceRange('', change.from, to);\n document._masterEditor.setCursorPos(to);\n _matchStack.pop();\n } else if (_pairs.hasOwnProperty(token)) {\n document.replaceRange(_pairs[token], to);\n document._masterEditor.setCursorPos(to);\n _matchStack.push(_pairs[token]);\n }\n //delete matching closing character if an opening character is deleted\n if (change.origin === \"+delete\" && _matchStack.length &&\n _pairs[_deletedToken] === _matchStack[_matchStack.length - 1]) {\n document.replaceRange('', change.from, to);\n document._masterEditor.setCursorPos(change.from);\n _matchStack.pop();\n }\n // Business time.\n $(document).one(\"change\", _handler);\n });\n }", "connectedCallback(){super.connectedCallback();let root=this;document.addEventListener(\"selectionchange\",e=>{root.range=root.getRange()});document.addEventListener(\"select-rich-text-editor-editor\",e=>{root._editorChange(e)});document.addEventListener(\"deselect-rich-text-editor-editor\",e=>{root._editorChange(e)})}", "function handleTextEditorChange(event) {\n if(isStorytellerCurrentlyActive) {\n //path to the file that is being edited\n const filePath = event.document.fileName;\n\n //if the file being edited is in the tracked st project\n if(filePath.startsWith(vscode.workspace.workspaceFolders[0].uri.fsPath) === true) {\n //go through each of the changes in this change event (there can \n //be more than one if there are multiple cursors)\n for(let i = 0;i < event.contentChanges.length;i++) {\n //get the change object\n const change = event.contentChanges[i];\n \n //if no text has been added, then this is a delete\n if(change.text.length === 0) {\n //get some data about the delete\n const numCharactersDeleted = change.rangeLength;\n const deleteTextStartLine = change.range.start.line;\n const deleteTextStartColumn = change.range.start.character;\n \n //record the deletion of text\n projectManager.handleDeletedText(filePath, deleteTextStartLine, deleteTextStartColumn, numCharactersDeleted);\n } else { //new text has been added in this change, this is an insert\n //if there was some text that was selected and replaced \n //(deleted and then added)\n if(change.rangeLength > 0) {\n //get some data about the delete\n const numCharactersDeleted = change.rangeLength;\n const deleteTextStartLine = change.range.start.line;\n const deleteTextStartColumn = change.range.start.character;\n\n //first delete the selected code (insert of new text to follow)\n projectManager.handleDeletedText(filePath, deleteTextStartLine, deleteTextStartColumn, numCharactersDeleted);\n } \n \n //get some data about the insert\n const newText = change.text;\n const newTextStartLine = change.range.start.line;\n const newTextStartColumn = change.range.start.character;\n \n //a set of all the event ids from a copy/cut\n let pastedInsertEventIds = [];\n\n //if this was a paste\n if(clipboardData.activePaste) { \n //if the new text is exactly the same as what was on our clipboard\n if(newText === clipboardData.text) {\n //store the pasted event ids\n pastedInsertEventIds = clipboardData.eventIds;\n } else { //this is a paste but it doesn't match the last storyteller copy/cut (pasted from another source)\n //create an array of strings with 'other' for the paste event ids to signify a paste from outside the editor\n pastedInsertEventIds = newText.split('').map(() => 'other');\n\n //clear out any old data\n clipboardData.text = '';\n clipboardData.eventIds = [];\n }\n\n //we handled the most current paste, set this back to false\n clipboardData.activePaste = false;\n }\n //record the insertion of new text\n projectManager.handleInsertedText(filePath, newText, newTextStartLine, newTextStartColumn, pastedInsertEventIds);\n }\n }\n }\n }\n}", "editorTextChange(e) {\n this.props.editorTextChange( document.getElementById('editor').value );\n }", "function makeChangeSingleDocInEditor(cm, change, spans) {\n\t\t var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n\t\t var recomputeMaxLength = false, checkWidthStart = from.line;\n\t\t if (!cm.options.lineWrapping) {\n\t\t checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n\t\t doc.iter(checkWidthStart, to.line + 1, function (line) {\n\t\t if (line == display.maxLine) {\n\t\t recomputeMaxLength = true;\n\t\t return true\n\t\t }\n\t\t });\n\t\t }\n\n\t\t if (doc.sel.contains(change.from, change.to) > -1)\n\t\t { signalCursorActivity(cm); }\n\n\t\t updateDoc(doc, change, spans, estimateHeight(cm));\n\n\t\t if (!cm.options.lineWrapping) {\n\t\t doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n\t\t var len = lineLength(line);\n\t\t if (len > display.maxLineLength) {\n\t\t display.maxLine = line;\n\t\t display.maxLineLength = len;\n\t\t display.maxLineChanged = true;\n\t\t recomputeMaxLength = false;\n\t\t }\n\t\t });\n\t\t if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n\t\t }\n\n\t\t retreatFrontier(doc, from.line);\n\t\t startWorker(cm, 400);\n\n\t\t var lendiff = change.text.length - (to.line - from.line) - 1;\n\t\t // Remember that these lines changed, for updating the display\n\t\t if (change.full)\n\t\t { regChange(cm); }\n\t\t else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n\t\t { regLineChange(cm, from.line, \"text\"); }\n\t\t else\n\t\t { regChange(cm, from.line, to.line + 1, lendiff); }\n\n\t\t var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n\t\t if (changeHandler || changesHandler) {\n\t\t var obj = {\n\t\t from: from, to: to,\n\t\t text: change.text,\n\t\t removed: change.removed,\n\t\t origin: change.origin\n\t\t };\n\t\t if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n\t\t if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n\t\t }\n\t\t cm.display.selForContextMenu = null;\n\t\t }", "function makeChangeSingleDocInEditor(cm, change, spans) {\n\t\t var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\t\t\n\t\t var recomputeMaxLength = false, checkWidthStart = from.line;\n\t\t if (!cm.options.lineWrapping) {\n\t\t checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n\t\t doc.iter(checkWidthStart, to.line + 1, function(line) {\n\t\t if (line == display.maxLine) {\n\t\t recomputeMaxLength = true;\n\t\t return true;\n\t\t }\n\t\t });\n\t\t }\n\t\t\n\t\t if (doc.sel.contains(change.from, change.to) > -1)\n\t\t signalCursorActivity(cm);\n\t\t\n\t\t updateDoc(doc, change, spans, estimateHeight(cm));\n\t\t\n\t\t if (!cm.options.lineWrapping) {\n\t\t doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n\t\t var len = lineLength(line);\n\t\t if (len > display.maxLineLength) {\n\t\t display.maxLine = line;\n\t\t display.maxLineLength = len;\n\t\t display.maxLineChanged = true;\n\t\t recomputeMaxLength = false;\n\t\t }\n\t\t });\n\t\t if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n\t\t }\n\t\t\n\t\t // Adjust frontier, schedule worker\n\t\t doc.frontier = Math.min(doc.frontier, from.line);\n\t\t startWorker(cm, 400);\n\t\t\n\t\t var lendiff = change.text.length - (to.line - from.line) - 1;\n\t\t // Remember that these lines changed, for updating the display\n\t\t if (change.full)\n\t\t regChange(cm);\n\t\t else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n\t\t regLineChange(cm, from.line, \"text\");\n\t\t else\n\t\t regChange(cm, from.line, to.line + 1, lendiff);\n\t\t\n\t\t var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n\t\t if (changeHandler || changesHandler) {\n\t\t var obj = {\n\t\t from: from, to: to,\n\t\t text: change.text,\n\t\t removed: change.removed,\n\t\t origin: change.origin\n\t\t };\n\t\t if (changeHandler) signalLater(cm, \"change\", cm, obj);\n\t\t if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n\t\t }\n\t\t cm.display.selForContextMenu = null;\n\t\t }", "function handleChange(editor, data, value) {\n onChange(value);\n }", "function handleChange(editor, data, value) {\n onChange(value);\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 }", "function makeChangeSingleDocInEditor(cm, change, spans) {\n\t var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\t\n\t var recomputeMaxLength = false, checkWidthStart = from.line;\n\t if (!cm.options.lineWrapping) {\n\t checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n\t doc.iter(checkWidthStart, to.line + 1, function(line) {\n\t if (line == display.maxLine) {\n\t recomputeMaxLength = true;\n\t return true;\n\t }\n\t });\n\t }\n\t\n\t if (doc.sel.contains(change.from, change.to) > -1)\n\t signalCursorActivity(cm);\n\t\n\t updateDoc(doc, change, spans, estimateHeight(cm));\n\t\n\t if (!cm.options.lineWrapping) {\n\t doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n\t var len = lineLength(line);\n\t if (len > display.maxLineLength) {\n\t display.maxLine = line;\n\t display.maxLineLength = len;\n\t display.maxLineChanged = true;\n\t recomputeMaxLength = false;\n\t }\n\t });\n\t if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n\t }\n\t\n\t // Adjust frontier, schedule worker\n\t doc.frontier = Math.min(doc.frontier, from.line);\n\t startWorker(cm, 400);\n\t\n\t var lendiff = change.text.length - (to.line - from.line) - 1;\n\t // Remember that these lines changed, for updating the display\n\t if (change.full)\n\t regChange(cm);\n\t else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n\t regLineChange(cm, from.line, \"text\");\n\t else\n\t regChange(cm, from.line, to.line + 1, lendiff);\n\t\n\t var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n\t if (changeHandler || changesHandler) {\n\t var obj = {\n\t from: from, to: to,\n\t text: change.text,\n\t removed: change.removed,\n\t origin: change.origin\n\t };\n\t if (changeHandler) signalLater(cm, \"change\", cm, obj);\n\t if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n\t }\n\t cm.display.selForContextMenu = null;\n\t }", "function makeChangeSingleDocInEditor(cm, change, spans) {\n\t var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n\t var recomputeMaxLength = false, checkWidthStart = from.line;\n\t if (!cm.options.lineWrapping) {\n\t checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n\t doc.iter(checkWidthStart, to.line + 1, function(line) {\n\t if (line == display.maxLine) {\n\t recomputeMaxLength = true;\n\t return true;\n\t }\n\t });\n\t }\n\n\t if (doc.sel.contains(change.from, change.to) > -1)\n\t signalCursorActivity(cm);\n\n\t updateDoc(doc, change, spans, estimateHeight(cm));\n\n\t if (!cm.options.lineWrapping) {\n\t doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n\t var len = lineLength(line);\n\t if (len > display.maxLineLength) {\n\t display.maxLine = line;\n\t display.maxLineLength = len;\n\t display.maxLineChanged = true;\n\t recomputeMaxLength = false;\n\t }\n\t });\n\t if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n\t }\n\n\t // Adjust frontier, schedule worker\n\t doc.frontier = Math.min(doc.frontier, from.line);\n\t startWorker(cm, 400);\n\n\t var lendiff = change.text.length - (to.line - from.line) - 1;\n\t // Remember that these lines changed, for updating the display\n\t if (change.full)\n\t regChange(cm);\n\t else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n\t regLineChange(cm, from.line, \"text\");\n\t else\n\t regChange(cm, from.line, to.line + 1, lendiff);\n\n\t var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n\t if (changeHandler || changesHandler) {\n\t var obj = {\n\t from: from, to: to,\n\t text: change.text,\n\t removed: change.removed,\n\t origin: change.origin\n\t };\n\t if (changeHandler) signalLater(cm, \"change\", cm, obj);\n\t if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n\t }\n\t cm.display.selForContextMenu = null;\n\t }", "function makeChangeSingleDocInEditor(cm, change, spans) {\n\t var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n\t var recomputeMaxLength = false, checkWidthStart = from.line;\n\t if (!cm.options.lineWrapping) {\n\t checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n\t doc.iter(checkWidthStart, to.line + 1, function(line) {\n\t if (line == display.maxLine) {\n\t recomputeMaxLength = true;\n\t return true;\n\t }\n\t });\n\t }\n\n\t if (doc.sel.contains(change.from, change.to) > -1)\n\t signalCursorActivity(cm);\n\n\t updateDoc(doc, change, spans, estimateHeight(cm));\n\n\t if (!cm.options.lineWrapping) {\n\t doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n\t var len = lineLength(line);\n\t if (len > display.maxLineLength) {\n\t display.maxLine = line;\n\t display.maxLineLength = len;\n\t display.maxLineChanged = true;\n\t recomputeMaxLength = false;\n\t }\n\t });\n\t if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n\t }\n\n\t // Adjust frontier, schedule worker\n\t doc.frontier = Math.min(doc.frontier, from.line);\n\t startWorker(cm, 400);\n\n\t var lendiff = change.text.length - (to.line - from.line) - 1;\n\t // Remember that these lines changed, for updating the display\n\t if (change.full)\n\t regChange(cm);\n\t else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n\t regLineChange(cm, from.line, \"text\");\n\t else\n\t regChange(cm, from.line, to.line + 1, lendiff);\n\n\t var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n\t if (changeHandler || changesHandler) {\n\t var obj = {\n\t from: from, to: to,\n\t text: change.text,\n\t removed: change.removed,\n\t origin: change.origin\n\t };\n\t if (changeHandler) signalLater(cm, \"change\", cm, obj);\n\t if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n\t }\n\t cm.display.selForContextMenu = null;\n\t }", "function makeChangeSingleDocInEditor(cm, change, spans) {\r\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\r\n\r\n var recomputeMaxLength = false, checkWidthStart = from.line;\r\n if (!cm.options.lineWrapping) {\r\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\r\n doc.iter(checkWidthStart, to.line + 1, function(line) {\r\n if (line == display.maxLine) {\r\n recomputeMaxLength = true;\r\n return true;\r\n }\r\n });\r\n }\r\n\r\n if (doc.sel.contains(change.from, change.to) > -1)\r\n signalCursorActivity(cm);\r\n\r\n updateDoc(doc, change, spans, estimateHeight(cm));\r\n\r\n if (!cm.options.lineWrapping) {\r\n doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\r\n var len = lineLength(line);\r\n if (len > display.maxLineLength) {\r\n display.maxLine = line;\r\n display.maxLineLength = len;\r\n display.maxLineChanged = true;\r\n recomputeMaxLength = false;\r\n }\r\n });\r\n if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\r\n }\r\n\r\n // Adjust frontier, schedule worker\r\n doc.frontier = Math.min(doc.frontier, from.line);\r\n startWorker(cm, 400);\r\n\r\n var lendiff = change.text.length - (to.line - from.line) - 1;\r\n // Remember that these lines changed, for updating the display\r\n if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\r\n regLineChange(cm, from.line, \"text\");\r\n else\r\n regChange(cm, from.line, to.line + 1, lendiff);\r\n\r\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\r\n if (changeHandler || changesHandler) {\r\n var obj = {\r\n from: from, to: to,\r\n text: change.text,\r\n removed: change.removed,\r\n origin: change.origin\r\n };\r\n if (changeHandler) signalLater(cm, \"change\", cm, obj);\r\n if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\r\n }\r\n cm.display.selForContextMenu = null;\r\n }", "function makeChangeSingleDocInEditor(cm, change, spans) {\r\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\r\n\r\n var recomputeMaxLength = false, checkWidthStart = from.line;\r\n if (!cm.options.lineWrapping) {\r\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\r\n doc.iter(checkWidthStart, to.line + 1, function (line) {\r\n if (line == display.maxLine) {\r\n recomputeMaxLength = true;\r\n return true\r\n }\r\n });\r\n }\r\n\r\n if (doc.sel.contains(change.from, change.to) > -1)\r\n { signalCursorActivity(cm); }\r\n\r\n updateDoc(doc, change, spans, estimateHeight(cm));\r\n\r\n if (!cm.options.lineWrapping) {\r\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\r\n var len = lineLength(line);\r\n if (len > display.maxLineLength) {\r\n display.maxLine = line;\r\n display.maxLineLength = len;\r\n display.maxLineChanged = true;\r\n recomputeMaxLength = false;\r\n }\r\n });\r\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\r\n }\r\n\r\n retreatFrontier(doc, from.line);\r\n startWorker(cm, 400);\r\n\r\n var lendiff = change.text.length - (to.line - from.line) - 1;\r\n // Remember that these lines changed, for updating the display\r\n if (change.full)\r\n { regChange(cm); }\r\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\r\n { regLineChange(cm, from.line, \"text\"); }\r\n else\r\n { regChange(cm, from.line, to.line + 1, lendiff); }\r\n\r\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\r\n if (changeHandler || changesHandler) {\r\n var obj = {\r\n from: from, to: to,\r\n text: change.text,\r\n removed: change.removed,\r\n origin: change.origin\r\n };\r\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\r\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\r\n }\r\n cm.display.selForContextMenu = null;\r\n}", "function updateEditor() {\n\t\ttextToEditor();\n\t\tpositionEditorCaret();\n\t}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function(line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true;\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n signalCursorActivity(cm);\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n }\n\n // Adjust frontier, schedule worker\n doc.frontier = Math.min(doc.frontier, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n regLineChange(cm, from.line, \"text\");\n else\n regChange(cm, from.line, to.line + 1, lendiff);\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) signalLater(cm, \"change\", cm, obj);\n if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n }\n cm.display.selForContextMenu = null;\n }", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function(line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true;\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n signalCursorActivity(cm);\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n }\n\n // Adjust frontier, schedule worker\n doc.frontier = Math.min(doc.frontier, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n regLineChange(cm, from.line, \"text\");\n else\n regChange(cm, from.line, to.line + 1, lendiff);\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) signalLater(cm, \"change\", cm, obj);\n if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n }\n cm.display.selForContextMenu = null;\n }", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function(line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true;\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n signalCursorActivity(cm);\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n }\n\n // Adjust frontier, schedule worker\n doc.frontier = Math.min(doc.frontier, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n regLineChange(cm, from.line, \"text\");\n else\n regChange(cm, from.line, to.line + 1, lendiff);\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) signalLater(cm, \"change\", cm, obj);\n if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n }\n cm.display.selForContextMenu = null;\n }", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function(line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true;\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n signalCursorActivity(cm);\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n }\n\n // Adjust frontier, schedule worker\n doc.frontier = Math.min(doc.frontier, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n regChange(cm);\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n regLineChange(cm, from.line, \"text\");\n else\n regChange(cm, from.line, to.line + 1, lendiff);\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) signalLater(cm, \"change\", cm, obj);\n if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n }\n cm.display.selForContextMenu = null;\n }", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function(line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true;\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n signalCursorActivity(cm);\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n }\n\n // Adjust frontier, schedule worker\n doc.frontier = Math.min(doc.frontier, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n regChange(cm);\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n regLineChange(cm, from.line, \"text\");\n else\n regChange(cm, from.line, to.line + 1, lendiff);\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) signalLater(cm, \"change\", cm, obj);\n if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n }\n cm.display.selForContextMenu = null;\n }", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function(line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true;\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n signalCursorActivity(cm);\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n }\n\n // Adjust frontier, schedule worker\n doc.frontier = Math.min(doc.frontier, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n regChange(cm);\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n regLineChange(cm, from.line, \"text\");\n else\n regChange(cm, from.line, to.line + 1, lendiff);\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) signalLater(cm, \"change\", cm, obj);\n if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n }\n cm.display.selForContextMenu = null;\n }", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function(line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true;\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n signalCursorActivity(cm);\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n }\n\n // Adjust frontier, schedule worker\n doc.frontier = Math.min(doc.frontier, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n regChange(cm);\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n regLineChange(cm, from.line, \"text\");\n else\n regChange(cm, from.line, to.line + 1, lendiff);\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) signalLater(cm, \"change\", cm, obj);\n if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n }\n cm.display.selForContextMenu = null;\n }", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to\n\n var recomputeMaxLength = false, checkWidthStart = from.line\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)))\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true\n return true\n }\n })\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm) }\n\n updateDoc(doc, change, spans, estimateHeight(cm))\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line)\n if (len > display.maxLineLength) {\n display.maxLine = line\n display.maxLineLength = len\n display.maxLineChanged = true\n recomputeMaxLength = false\n }\n })\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true }\n }\n\n // Adjust frontier, schedule worker\n doc.frontier = Math.min(doc.frontier, from.line)\n startWorker(cm, 400)\n\n var lendiff = change.text.length - (to.line - from.line) - 1\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm) }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\") }\n else\n { regChange(cm, from.line, to.line + 1, lendiff) }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\")\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n }\n if (changeHandler) { signalLater(cm, \"change\", cm, obj) }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj) }\n }\n cm.display.selForContextMenu = null\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to\n\n var recomputeMaxLength = false, checkWidthStart = from.line\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)))\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true\n return true\n }\n })\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm) }\n\n updateDoc(doc, change, spans, estimateHeight(cm))\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line)\n if (len > display.maxLineLength) {\n display.maxLine = line\n display.maxLineLength = len\n display.maxLineChanged = true\n recomputeMaxLength = false\n }\n })\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true }\n }\n\n // Adjust frontier, schedule worker\n doc.frontier = Math.min(doc.frontier, from.line)\n startWorker(cm, 400)\n\n var lendiff = change.text.length - (to.line - from.line) - 1\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm) }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\") }\n else\n { regChange(cm, from.line, to.line + 1, lendiff) }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\")\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n }\n if (changeHandler) { signalLater(cm, \"change\", cm, obj) }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj) }\n }\n cm.display.selForContextMenu = null\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}", "fireContentChange() {\n if (this.selection.isHighlightEditRegion) {\n this.selection.onHighlight();\n }\n if (!this.isPaste) {\n this.copiedContent = undefined;\n this.copiedTextContent = '';\n this.selection.isViewPasteOptions = false;\n if (this.isPasteListUpdated) {\n this.isPasteListUpdated = false;\n }\n this.selection.showHidePasteOptions(undefined, undefined);\n }\n if (this.viewer.owner.isLayoutEnabled && !this.viewer.owner.isShiftingEnabled) {\n this.viewer.owner.fireContentChange();\n }\n }", "function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc,\n display = cm.display,\n from = change.from,\n to = change.to;\n var recomputeMaxLength = false,\n checkWidthStart = from.line;\n\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true;\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1) {\n signalCursorActivity(cm);\n }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n\n if (recomputeMaxLength) {\n cm.curOp.updateMaxLine = true;\n }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n var lendiff = change.text.length - (to.line - from.line) - 1; // Remember that these lines changed, for updating the display\n\n if (change.full) {\n regChange(cm);\n } else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) {\n regLineChange(cm, from.line, \"text\");\n } else {\n regChange(cm, from.line, to.line + 1, lendiff);\n }\n\n var changesHandler = hasHandler(cm, \"changes\"),\n changeHandler = hasHandler(cm, \"change\");\n\n if (changeHandler || changesHandler) {\n var obj = {\n from: from,\n to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n\n if (changeHandler) {\n signalLater(cm, \"change\", cm, obj);\n }\n\n if (changesHandler) {\n (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n }\n }\n\n cm.display.selForContextMenu = null;\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})}}}", "detectingChangesInTheSelected() {\n Office.context.document.addHandlerAsync(\"documentSelectionChanged\", myHandler, function(result) {});\n function myHandler(eventArgs) {\n write(\"Document Selection Changed\");\n }\n function write(message) {\n document.getElementById(\"message\").innerText += message;\n }\n }", "function handleDocumentPatches(_ref) {\n var patches = _ref.patches;\n var patchSelection = patches && patches.length > 0 && patches.filter(patch => patch.origin !== 'local');\n\n if (patchSelection) {\n patchSelection.map(patch => patche$.next(patch));\n }\n } // Handle editor changes", "addContentChangeHandler() {\n\t\tfunction snapshotDiff(self) {\n\t\t\tvar newText = self.editor.getValue();\n\t\t\tvar timestamp = new Date().getTime();\n\n\t\t\tif (self.curText != newText) {\n\t\t\t\t/*\n\t\t\t\tThe two key function calls here are diff_main followed by diff_toDelta\n\t\t\t\tEach 'd' field is in the following format:\n\t\t\t\thttp://downloads.jahia.com/downloads/jahia/jahia6.6.1/jahia-root-6.6.1.0-aggregate-javadoc/name/fraser/neil/plaintext/DiffMatchPatch.html#diff_toDelta(java.util.LinkedList)\n\t\t\t\tCrush the diff into an encoded string which describes the operations\n\t\t\t\trequired to transform text1 into text2. E.g. =3\\t-2\\t+ing -> Keep 3\n\t\t\t\tchars, delete 2 chars, insert 'ing'. Operations are tab-separated.\n\t\t\t\tInserted text is escaped using %xx notation.\n\t\t\t\t*/\n\t\t\t\tvar delta = {\n\t\t\t\t\tt: timestamp,\n\t\t\t\t\td: self.dmp.diff_toDelta(self.dmp.diff_main(self.curText, newText))\n\t\t\t\t};\n\t\t\t\tself.sendCodeEditSaveRequest(delta);\n\n\t\t\t\t// self.menuClickID is set when any testcase link is clicked\n\t\t\t\tif (self.menuClickID.checkpoint > -1 && self.menuClickID.testcase > -1) {\n\t\t\t\t\tself.handleRunRequest(RUN_TEST_COMMAND, self.menuClickID.checkpoint, self.menuClickID.testcase);\n\t\t\t\t}\n\t\t\t\tself.curText = newText;\n\t\t \t}\n\t\t}\n\n\t\tthis.editor.on('change', (e) => {\n\t\t\t// Remove the syntax error squiggly lines\n\t\t\tthis.removeMarkersInEditorSelection();\n\n\t\t\t// Remove syntax error gutter highlights\n\t\t\tthis.removeErrorGutterHighlights();\n\n\t\t\t// Remove comment gutter highlights\n\t\t\tthis.removeCommentGutterHighlights();\n\n\t\t\t// Debouncing and auto saving\n\t\t\tif (this.DEBOUNCE_MS > 0) {\n\t\t\t\t$.doTimeout('editorChange', this.DEBOUNCE_MS, () => { snapshotDiff(this); });\n\t\t\t} else {\n\t\t\t\tsnapshotDiff(this);\n\t\t\t}\n\t\t});\n\t}", "function onDocumentKeyDown(e) {\n var ctrlDown = e.ctrlKey || e.metaKey; // PC || Mac\n \n switch (e.keyCode) {\n case KEYS.F1:\n help.show();\n e.preventDefault();\n \n break;\n \n case KEYS.ESC:\n help.hide();\n if (state.isDraw) {\n state.isDraw = false;\n state.newArea.remove();\n state.areas.pop();\n app.removeAllEvents();\n } else if (state.appMode === 'editing') {\n state.selectedArea.redraw();\n app.removeAllEvents();\n }\n \n break;\n \n case KEYS.TOP:\n if (state.appMode === 'editing' && state.selectedArea) {\n state.selectedArea.setParams(\n state.selectedArea.dynamicEdit(state.selectedArea.move(0, -1))\n );\n e.preventDefault();\n }\n \n break;\n \n case KEYS.BOTTOM:\n if (state.appMode === 'editing' && state.selectedArea) {\n state.selectedArea.setParams(\n state.selectedArea.dynamicEdit(state.selectedArea.move(0, 1))\n );\n e.preventDefault();\n }\n break;\n \n case KEYS.LEFT: \n if (state.appMode === 'editing' && state.selectedArea) {\n state.selectedArea.setParams(\n state.selectedArea.dynamicEdit(state.selectedArea.move(-1, 0))\n );\n e.preventDefault();\n }\n \n break;\n \n case KEYS.RIGHT:\n if (state.appMode === 'editing' && state.selectedArea) {\n state.selectedArea.setParams(\n state.selectedArea.dynamicEdit(state.selectedArea.move(1, 0))\n );\n e.preventDefault();\n }\n \n break;\n \n case KEYS.DELETE:\n if (state.appMode === 'editing' && state.selectedArea) {\n app.removeObject(state.selectedArea);\n state.selectedArea = null;\n info.unload();\n }\n \n break;\n \n case KEYS.I:\n if (state.appMode === 'editing' && state.selectedArea) {\n var params = state.selectedArea.params,\n x = params.x || params.cx || params[0],\n y = params.y || params.cy || params[1];\n \n info.load(state.selectedArea, x + app.getOffset('x'), y + app.getOffset('y'));\n }\n \n break;\n \n case KEYS.S:\n app.saveInLocalStorage();\n \n break;\n \n case KEYS.C:\n if (state.appMode === 'editing' && state.selectedArea && ctrlDown) {\n var Constructor = AREAS_CONSTRUCTORS[area_params.type],\n area_params = state.selectedArea.toJSON();\n \n if (Constructor) {\n Constructor.createFromSaved(area_params);\n state.selectedArea.setParams(state.selectedArea.move(10, 10));\n state.selectedArea.redraw();\n }\n }\n \n break;\n }\n }", "function myEdit(e){\n Logger.log(\"change triggered\");\n\n refetch();\n //Logger.log(e);\n}", "_onActiveEditorUpdated(type, editor) {\n this._designView = editor;\n }", "updateEditor() {\n if (typeof this.engine !== 'undefined') {\n this.engine.process(this.editor.toJSON());\n }\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 }", "handleTextEvents(editor) {\n editor.getBuffer().onWillSave(() => {\n if (this.shouldFormatOnSave() && this.hasElixirGrammar(editor)) {\n formatter.formatTextEditor(editor);\n }\n });\n }", "function editOnInput(){var domSelection=global.getSelection();var anchorNode=domSelection.anchorNode;var isCollapsed=domSelection.isCollapsed;if(anchorNode.nodeType!==Node.TEXT_NODE){return;}var domText=anchorNode.textContent;var editorState=this.props.editorState;var offsetKey=nullthrows(findAncestorOffsetKey(anchorNode));var _DraftOffsetKey$decod=DraftOffsetKey.decode(offsetKey);var blockKey=_DraftOffsetKey$decod.blockKey;var decoratorKey=_DraftOffsetKey$decod.decoratorKey;var leafKey=_DraftOffsetKey$decod.leafKey;var _editorState$getBlock=editorState.getBlockTree(blockKey).getIn([decoratorKey,'leaves',leafKey]);var start=_editorState$getBlock.start;var end=_editorState$getBlock.end;var content=editorState.getCurrentContent();var block=content.getBlockForKey(blockKey);var modelText=block.getText().slice(start,end);// Special-case soft newlines here. If the DOM text ends in a soft newline,\r\n\t// we will have manually inserted an extra soft newline in DraftEditorLeaf.\r\n\t// We want to remove this extra newline for the purpose of our comparison\r\n\t// of DOM and model text.\r\n\tif(domText.endsWith(DOUBLE_NEWLINE)){domText=domText.slice(0,-1);}// No change -- the DOM is up to date. Nothing to do here.\r\n\tif(domText===modelText){return;}var selection=editorState.getSelection();// We'll replace the entire leaf with the text content of the target.\r\n\tvar targetRange=selection.merge({anchorOffset:start,focusOffset:end,isBackward:false});var entityKey=block.getEntityAt(start);var entity=entityKey&&Entity.get(entityKey);var entityType=entity&&entity.getMutability();var preserveEntity=entityType==='MUTABLE';// Immutable or segmented entities cannot properly be handled by the\r\n\t// default browser undo, so we have to use a different change type to\r\n\t// force using our internal undo method instead of falling through to the\r\n\t// native browser undo.\r\n\tvar changeType=preserveEntity?'spellcheck-change':'apply-entity';var newContent=DraftModifier.replaceText(content,targetRange,domText,block.getInlineStyleAt(start),preserveEntity?block.getEntityAt(start):null);var anchorOffset,focusOffset,startOffset,endOffset;if(isGecko){// Firefox selection does not change while the context menu is open, so\r\n\t// we preserve the anchor and focus values of the DOM selection.\r\n\tanchorOffset=domSelection.anchorOffset;focusOffset=domSelection.focusOffset;startOffset=start+Math.min(anchorOffset,focusOffset);endOffset=startOffset+Math.abs(anchorOffset-focusOffset);anchorOffset=startOffset;focusOffset=endOffset;}else{// Browsers other than Firefox may adjust DOM selection while the context\r\n\t// menu is open, and Safari autocorrect is prone to providing an inaccurate\r\n\t// DOM selection. Don't trust it. Instead, use our existing SelectionState\r\n\t// and adjust it based on the number of characters changed during the\r\n\t// mutation.\r\n\tvar charDelta=domText.length-modelText.length;startOffset=selection.getStartOffset();endOffset=selection.getEndOffset();anchorOffset=isCollapsed?endOffset+charDelta:startOffset;focusOffset=endOffset+charDelta;}// Segmented entities are completely or partially removed when their\r\n\t// text content changes. For this case we do not want any text to be selected\r\n\t// after the change, so we are not merging the selection.\r\n\tvar contentWithAdjustedDOMSelection=newContent.merge({selectionBefore:content.getSelectionAfter(),selectionAfter:selection.merge({anchorOffset:anchorOffset,focusOffset:focusOffset})});this.update(EditorState.push(editorState,contentWithAdjustedDOMSelection,changeType));}", "textDocumentDidChange(params) {\n return __awaiter(this, void 0, void 0, function* () {\n const uri = util_1.normalizeUri(params.textDocument.uri);\n let text;\n for (const change of params.contentChanges) {\n if (change.range || change.rangeLength) {\n throw new Error('incremental updates in textDocument/didChange not supported for file ' + uri);\n }\n text = change.text;\n }\n if (!text) {\n return;\n }\n this.projectManager.didChange(uri, text);\n yield new Promise(resolve => setTimeout(resolve, 200));\n this._publishDiagnostics(uri);\n });\n }", "_onActiveEditorUpdated(type, editor) {\n\t\tthis._onElementDeselected();\n\t\tthis._designView = editor;\n\t}", "handleEditorChange(code) {\n let state = this.state.pageState;\n state.code = code;\n this.props.updateState(state);\n }", "function process () {\n if (!processed) {\n var editor = EditorManager.getCurrentFullEditor();\n var currentDocument = editor.document;\n var originalText = currentDocument.getText();\n var processedText = Processor.process(originalText);\n var cursorPos = editor.getCursorPos();\n var scrollPos = editor.getScrollPos();\n\n // Bail if processing was unsuccessful.\n if (processedText === false) {\n return;\n }\n\n // Replace text.\n currentDocument.setText(processedText);\n\n // Restore cursor and scroll positons.\n editor.setCursorPos(cursorPos);\n editor.setScrollPos(scrollPos.x, scrollPos.y);\n\n // Save file.\n CommandManager.execute(Commands.FILE_SAVE);\n\n // Prevent file from being processed multiple times.\n processed = true;\n } else {\n processed = false;\n }\n }", "function onEditorChange(editor, objSettings){\r\n\t\t\r\n\t\tvar objInput = editor.getElement();\r\n\t\tobjInput = jQuery(objInput);\r\n\t\tobjSettings.triggerKeyupEvent(objInput);\r\n\t}", "inputChange(newCode) { // updates the code in the editor\n\t\tthis.props.inputChange(newCode);\n\t}", "function commitChanges() {\n if (editingSlide) {\n editingSlide.querySelector('.kreator-slide-content').innerHTML = editor.getHTML();\n }\n}", "function handler_designDocumentOnChange() {\n let designDoc = $(\"#couchdb_designDocument\").val();\n getCouchdbViews(designDoc, DOM_fillCouchdbViews);\n }", "function onChangeWorkingLine(action) {\n changeWorkingLine(action);\n initEditor();\n}", "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 }", "function on_doc_down(event){\n \t//Toggle Cursor Menu Dropdown\n \tif (!event.target.matches('#dropBtn') && !event.target.classList.contains('menuBtn')) {\n \t closeMenu();\n \t}\n\n \t//Confirm name change of sidebar element if clicking outside of textbox\n \tif (editingList && event.target.type != 'text'){\n \t\tvar li = editingList.parentElement.parentElement;\n \t\tli.attached.name = editingList.value;\n \t\tli.innerHTML = editingList.value;\n \t\teditingList = false;\n \t\treturn false;\n \t}\n\n \t//Reset all object opacities\n \tfor (var i=0; i<scene.objects.length; i++){\n \t\tif (scene.objects[i] != SELECTED){\n \t\t\tscene.objects[i].material.opacity = 1;\n \t\t}\n \t}\n\n \t//Select a cube if name in sidebar is clicked, otherwise unselect all\n \tif (event.target != renderer.domElement){\n \t\tif (event.target.localName == \"li\"){\n \t\t\tif(SELECTED){\n \t\t\t\tunselect();\n \t\t\t}\n \t\t\t// console.log(\"select!\");\n \t\t\tselectObj(event.srcElement.attached);\n \t\t}\n \t}\n }", "function handleFileSelect(evt){\n var f = evt.target.files[0]; // FileList object\n window.reader = new FileReader();\n // Closure to capture the file information.\n reader.onload = (function(theFile){\n return function(e){\n editor.setData(e.target.result);\n evt.target.value = null; // allow reload\n };\n })(f);\n // Read file as text\n reader.readAsText(f);\n thisDoc = f.name;\n }", "constructor(props) {\n super(props);\n this.state = {\n modal1Open: false,\n modal2Open: false,\n drawerOpen: false,\n id: props.match.params.docId,\n editorState: EditorState.createEmpty(),\n title: \"\",\n owner: \"\",\n contributors: [],\n currentUser: currentUser,\n };\n\n fetch(`http://localhost:3000/document/${this.state.id}`)\n .then(res => res.json())\n .then((res) => {\n res.versions[res.versions.length-1].entityMap = res.versions.entityMap || {}\n this.setState({\n version: res.versions.length,\n oldVersions: res.versions,\n editorState: EditorState.createWithContent(convertFromRaw(res.versions[res.versions.length-1])),\n title: res.title,\n owner: res.owner,\n })\n })\n .catch((error) => {\n console.log(error);\n alert(error);\n });\n\n this.onChange = (editorState) => {\n const contentState = editorState.getCurrentContent();\n socket.emit('document-save', { secretToken: this.secretToken, state: convertToRaw(contentState), docId: this.props.match.params.docId, userToken: currentUser.user._id});\n this.setState({ editorState });\n };\n this.handleKeyCommand = this.handleKeyCommand.bind(this);\n\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}", "listen(connection) {\r\n connection.__textDocumentSync = vscode_languageserver_protocol_1.TextDocumentSyncKind.Full;\r\n connection.onDidOpenTextDocument((event) => {\r\n let td = event.textDocument;\r\n let document = this._configuration.create(td.uri, td.languageId, td.version, td.text);\r\n this._documents[td.uri] = document;\r\n let toFire = Object.freeze({ document });\r\n this._onDidOpen.fire(toFire);\r\n this._onDidChangeContent.fire(toFire);\r\n });\r\n connection.onDidChangeTextDocument((event) => {\r\n let td = event.textDocument;\r\n let changes = event.contentChanges;\r\n if (changes.length === 0) {\r\n return;\r\n }\r\n let document = this._documents[td.uri];\r\n const { version } = td;\r\n if (version === null || version === void 0) {\r\n throw new Error(`Received document change event for ${td.uri} without valid version identifier`);\r\n }\r\n document = this._configuration.update(document, changes, version);\r\n this._documents[td.uri] = document;\r\n this._onDidChangeContent.fire(Object.freeze({ document }));\r\n });\r\n connection.onDidCloseTextDocument((event) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document) {\r\n delete this._documents[event.textDocument.uri];\r\n this._onDidClose.fire(Object.freeze({ document }));\r\n }\r\n });\r\n connection.onWillSaveTextDocument((event) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document) {\r\n this._onWillSave.fire(Object.freeze({ document, reason: event.reason }));\r\n }\r\n });\r\n connection.onWillSaveTextDocumentWaitUntil((event, token) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document && this._willSaveWaitUntil) {\r\n return this._willSaveWaitUntil(Object.freeze({ document, reason: event.reason }), token);\r\n }\r\n else {\r\n return [];\r\n }\r\n });\r\n connection.onDidSaveTextDocument((event) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document) {\r\n this._onDidSave.fire(Object.freeze({ document }));\r\n }\r\n });\r\n }", "listen(connection) {\r\n connection.__textDocumentSync = vscode_languageserver_protocol_1.TextDocumentSyncKind.Full;\r\n connection.onDidOpenTextDocument((event) => {\r\n let td = event.textDocument;\r\n let document = this._configuration.create(td.uri, td.languageId, td.version, td.text);\r\n this._documents[td.uri] = document;\r\n let toFire = Object.freeze({ document });\r\n this._onDidOpen.fire(toFire);\r\n this._onDidChangeContent.fire(toFire);\r\n });\r\n connection.onDidChangeTextDocument((event) => {\r\n let td = event.textDocument;\r\n let changes = event.contentChanges;\r\n if (changes.length === 0) {\r\n return;\r\n }\r\n let document = this._documents[td.uri];\r\n const { version } = td;\r\n if (version === null || version === void 0) {\r\n throw new Error(`Received document change event for ${td.uri} without valid version identifier`);\r\n }\r\n document = this._configuration.update(document, changes, version);\r\n this._documents[td.uri] = document;\r\n this._onDidChangeContent.fire(Object.freeze({ document }));\r\n });\r\n connection.onDidCloseTextDocument((event) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document) {\r\n delete this._documents[event.textDocument.uri];\r\n this._onDidClose.fire(Object.freeze({ document }));\r\n }\r\n });\r\n connection.onWillSaveTextDocument((event) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document) {\r\n this._onWillSave.fire(Object.freeze({ document, reason: event.reason }));\r\n }\r\n });\r\n connection.onWillSaveTextDocumentWaitUntil((event, token) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document && this._willSaveWaitUntil) {\r\n return this._willSaveWaitUntil(Object.freeze({ document, reason: event.reason }), token);\r\n }\r\n else {\r\n return [];\r\n }\r\n });\r\n connection.onDidSaveTextDocument((event) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document) {\r\n this._onDidSave.fire(Object.freeze({ document }));\r\n }\r\n });\r\n }", "function onEditDialogSave(){\r\n\t\t\r\n\t\tif(!g_codeMirror)\r\n\t\t\tthrow new Error(\"Codemirror editor not found\");\r\n\t\t\r\n\t\tvar content = g_codeMirror.getValue();\r\n\t\tvar objDialog = jQuery(\"#uc_dialog_edit_file\");\r\n\t\t\r\n\t\tvar item = objDialog.data(\"item\");\r\n\t\t\r\n\t\tvar data = {filename: item.file, path: g_activePath, pathkey: g_pathKey, content: content};\r\n\t\t\r\n\t\tg_ucAdmin.setAjaxLoaderID(\"uc_dialog_edit_file_loadersaving\");\r\n\t\tg_ucAdmin.setErrorMessageID(\"uc_dialog_edit_file_error\");\r\n\t\tg_ucAdmin.setSuccessMessageID(\"uc_dialog_edit_file_success\");\r\n\t\t\r\n\t\tassetsAjaxRequest(\"assets_save_file\", data);\r\n\t\t\r\n\t}", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n\t\t if (doc.cm && !doc.cm.curOp)\n\t\t { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n\t\t if (change.to.line < doc.first) {\n\t\t shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n\t\t return\n\t\t }\n\t\t if (change.from.line > doc.lastLine()) { return }\n\n\t\t // Clip the change to the size of this doc\n\t\t if (change.from.line < doc.first) {\n\t\t var shift = change.text.length - 1 - (doc.first - change.from.line);\n\t\t shiftDoc(doc, shift);\n\t\t change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n\t\t text: [lst(change.text)], origin: change.origin};\n\t\t }\n\t\t var last = doc.lastLine();\n\t\t if (change.to.line > last) {\n\t\t change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n\t\t text: [change.text[0]], origin: change.origin};\n\t\t }\n\n\t\t change.removed = getBetween(doc, change.from, change.to);\n\n\t\t if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n\t\t if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n\t\t else { updateDoc(doc, change, spans); }\n\t\t setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n\t\t if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n\t\t { doc.cantEdit = false; }\n\t\t }", "handleFilechange(event, path) {\n console.log('PdfjsViewerView: file', event, path)\n this.reloadPdf()\n }", "function onChange(cm, changeObj) {\n var macroModeState = vimGlobalState.macroModeState;\n var lastChange = macroModeState.lastInsertModeChanges;\n if (!macroModeState.isPlaying) {\n while(changeObj) {\n lastChange.expectCursorActivityForChange = true;\n if (lastChange.ignoreCount > 1) {\n lastChange.ignoreCount--;\n } else if (changeObj.origin == '+input' || changeObj.origin == 'paste'\n || changeObj.origin === undefined /* only in testing */) {\n var selectionCount = cm.listSelections().length;\n if (selectionCount > 1)\n lastChange.ignoreCount = selectionCount;\n var text = changeObj.text.join('\\n');\n if (lastChange.maybeReset) {\n lastChange.changes = [];\n lastChange.maybeReset = false;\n }\n if (text) {\n if (cm.state.overwrite && !/\\n/.test(text)) {\n lastChange.changes.push([text]);\n } else {\n lastChange.changes.push(text);\n }\n }\n }\n // Change objects may be chained with next.\n changeObj = changeObj.next;\n }\n }\n }", "function onChange(cm, changeObj) {\n var macroModeState = vimGlobalState.macroModeState;\n var lastChange = macroModeState.lastInsertModeChanges;\n if (!macroModeState.isPlaying) {\n while(changeObj) {\n lastChange.expectCursorActivityForChange = true;\n if (lastChange.ignoreCount > 1) {\n lastChange.ignoreCount--;\n } else if (changeObj.origin == '+input' || changeObj.origin == 'paste'\n || changeObj.origin === undefined /* only in testing */) {\n var selectionCount = cm.listSelections().length;\n if (selectionCount > 1)\n lastChange.ignoreCount = selectionCount;\n var text = changeObj.text.join('\\n');\n if (lastChange.maybeReset) {\n lastChange.changes = [];\n lastChange.maybeReset = false;\n }\n if (text) {\n if (cm.state.overwrite && !/\\n/.test(text)) {\n lastChange.changes.push([text]);\n } else {\n lastChange.changes.push(text);\n }\n }\n }\n // Change objects may be chained with next.\n changeObj = changeObj.next;\n }\n }\n }", "onCursorChange() {\n this.$cursorChange();\n this._signal(\"changeSelection\");\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 handleEditorUpdate() {\n if (updateTimerRef) {\n clearTimeout(updateTimerRef);\n }\n updateTimerRef = setTimeout(refreshRenderContent, timeBeforeEditorUpdate);\n}", "handleEventEdit(e) {\n this.getEventToEdit(e.target.id)\n }", "function onSelectionChangeCursor(e) {\n\n // find node that cursor points to\n var cursorPos = aceEditor.getCursorPosition();\n var astNodes = PARSED && PARSED.stylesheet && PARSED.stylesheet.rules || [];\n \n var cursorAstNode = _findAstNodeForCursorPosition(astNodes, cursorPos);\n\n fileEditor.hDev.publish(CURSOR_POSITION_CHANGE, {\n f: fileEditor.filepath,\n mode: MIME_TYPE,\n p: cursorPos,\n astNode: cursorAstNode ? _pickCssAstData(cursorAstNode) : {},\n });\n }", "async _onEditorSave(target, element, content) {\r\n \treturn this.submit();\r\n\t}", "_codemirrorValueChanged() {\n // Don't trigger change event if we're ignoring changes\n if (this._ignoreNextChange || !this.props.onChange) {\n this._ignoreNextChange = false;\n return;\n }\n\n const value = this.codeMirror.getDoc().getValue();\n\n // Disable linting if the document reaches a maximum size or is empty\n const shouldLint =\n value.length > MAX_SIZE_FOR_LINTING || value.length === 0 ? false : !this.props.noLint;\n const existingLint = this.codeMirror.options.lint || false;\n if (shouldLint !== existingLint) {\n const { lintOptions } = this.props;\n const lint = shouldLint ? lintOptions || true : false;\n this.codeMirror.setOption('lint', lint);\n }\n\n this.props.onChange(value);\n }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n\t\t if (doc.cm && !doc.cm.curOp)\n\t\t return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n\t\t\n\t\t if (change.to.line < doc.first) {\n\t\t shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n\t\t return;\n\t\t }\n\t\t if (change.from.line > doc.lastLine()) return;\n\t\t\n\t\t // Clip the change to the size of this doc\n\t\t if (change.from.line < doc.first) {\n\t\t var shift = change.text.length - 1 - (doc.first - change.from.line);\n\t\t shiftDoc(doc, shift);\n\t\t change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n\t\t text: [lst(change.text)], origin: change.origin};\n\t\t }\n\t\t var last = doc.lastLine();\n\t\t if (change.to.line > last) {\n\t\t change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n\t\t text: [change.text[0]], origin: change.origin};\n\t\t }\n\t\t\n\t\t change.removed = getBetween(doc, change.from, change.to);\n\t\t\n\t\t if (!selAfter) selAfter = computeSelAfterChange(doc, change);\n\t\t if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\n\t\t else updateDoc(doc, change, spans);\n\t\t setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\t\t }", "function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }" ]
[ "0.6988773", "0.68636054", "0.6660369", "0.659211", "0.65215796", "0.638791", "0.6327432", "0.63088477", "0.62785864", "0.62495303", "0.6163697", "0.6127141", "0.6116209", "0.6116209", "0.6100855", "0.60965884", "0.6076851", "0.6076851", "0.6037296", "0.60166854", "0.60105", "0.6002756", "0.6002756", "0.6002756", "0.598994", "0.598994", "0.598994", "0.598994", "0.5979333", "0.5979333", "0.59722257", "0.59722257", "0.59722257", "0.59722257", "0.59722257", "0.59722257", "0.59722257", "0.59722257", "0.59722257", "0.59722257", "0.59722257", "0.5955533", "0.5942543", "0.5930332", "0.59168655", "0.59095174", "0.5903356", "0.58878267", "0.5857532", "0.5840292", "0.5824661", "0.58222336", "0.57851", "0.5779415", "0.57599545", "0.5750987", "0.5725295", "0.5710175", "0.5701021", "0.5698438", "0.56883186", "0.56685525", "0.5658374", "0.56351316", "0.5633603", "0.56023926", "0.5590019", "0.5583519", "0.55810434", "0.55810434", "0.55768013", "0.5547299", "0.5542391", "0.5534145", "0.5534145", "0.55203354", "0.5500423", "0.5483806", "0.54827166", "0.54803675", "0.54763794", "0.5475309", "0.54732597", "0.5459448" ]
0.59418476
58
Rebasing/resetting history to deal with externallysourced changes
function rebaseHistSelSingle(pos, from, to, diff) { if (to < pos.line) { pos.line += diff; } else if (from < pos.line) { pos.line = from; pos.ch = 0; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetHistory() {\n // TODO: clean out localStorage\n ExCommandHistory.resetHistory();\n }", "function clearChangeHistory() {\n changeHistory = [];\n historyPosition = 0;\n }", "function setHistory() {\n // clear undo history\n $('#undoHistoryList')\n .empty();\n\n // load new history list from server\n getHistoryFromServer(addHistList);\n}", "resetStateHistory() {\n // Clears state history, returning it to an empty list.\n this._stateHistory.splice(0, this._stateHistory.length);\n }", "function History_History()\n{\n\t//call reset\n\tthis.Reset();\n}", "resetHistory() {\n this.autoList.removeAll();\n var history = JSON.parse(localStorage.getItem('searchHistory'));\n if (history) {\n for (var i = 0; i < history.length; i++) {\n this.addBack(history[i]);\n }\n }\n }", "function clearUndoHistory() {\n getHistoryFromServer(resetHistList);\n}", "function push_history() {\n\tedit_history_index++;\n\tsave_history();\n\tedit_history.length = edit_history_index+1;\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(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 }", "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 }", "static reset () {\n this.history = [];\n this.position = 0;\n }", "replaceHistState() {\n const params = new URLSearchParams();\n params.set('fg', this.fg);\n params.set('bg', this.bg);\n params.set('mode', this.numberType);\n params.set('showHint', false);\n params.set('directDrive', this.directDrive);\n window.history.replaceState({}, '', '?' + params.toString());\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 }", "reset() {\r\n this._state = this._config.initial;\r\n this._history.push(this._state);\r\n }", "function voltarHistory()\n\t{\n\t\twindow.history.back();\n\t}", "function undoChange() {\n\n this.quill.history.undo();\n}", "reset() {\r\n this.historyStates.push(this.currentState);\r\n this.currentState = this.historyStates[0];\r\n }", "update() {\n this.actionHistory = [];\n this.stateHistory = [];\n this.rewardHistory = [];\n }", "function restoreHistory( delta ) {\n var p = historyPosition + delta;\n if ( delta === 0 || p < 0 || p >= changeHistory.length )\n return true;\n var state = changeHistory[p];\n\n self.mode.off();\n\n $(svgContainer).empty();\n $(state.svg).clone().appendTo(svgContainer);\n self.util.svgRoot = svgRoot = svgContainer.firstChild;\n self.util.mouseCoords = svgRoot.createSVGPoint();\n initDragpoint();\n $(svgRoot).click( removeEditings );\n\n if ( delta < 0 && p < changeHistory.length-1 )\n state = changeHistory[p+1];\n\n if ( state.panzoom ) {\n self.svgPanZoom( state.panzoom[0], state.panzoom[1], state.panzoom[2], state.panzoom[3] );\n boxX0 = state.panzoom[4];\n boxY0 = state.panzoom[5];\n boxW = state.panzoom[6];\n boxH = state.panzoom[7];\n svgRoot.setAttribute( 'viewBox', boxX0+' '+boxY0+' '+boxW+' '+boxH );\n }\n adjustSize();\n\n state.mode();\n if ( state.selected )\n $(state.selected).click();\n\n historyPosition += delta;\n\n for ( var n=0; n<self.cfg.onRestoreHistory.length; n++ )\n self.cfg.onRestoreHistory[n]();\n\n return false;\n }", "reset() {\r\n this.currentState = this.config.initial;\r\n this.history.push(this.currentState);\r\n }", "function resetHistory(ifTemporal) {\n $('#svg_history').remove();\n d3.selectAll(\".code-tree\").remove();\n d3.selectAll(\".kg-network\").remove();\n selectedCode = clone(currentCode);\n updateCodeList();\n renderPtHistory(gPID, gSinPtData, gPtPredData, gSinPtData, gPtPredData, 0, ifTemporal);\n}", "function _clearHistory() {\n _bufferHistory = [];\n _rateSelectionHistory = [];\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}", "revertLastState() {\n // Make sure there is a history of state changes\n if (this._history.length > 0) {\n // Pop off the last state preserved in the history and set the current state equal to that\n this._state = this._history.pop();\n }\n // Since the state has changed, we have to emit those changes\n this._emitChange();\n }", "undo () {\n if (this.editHistory.length === 0) return;\n\n let edit = reverseInput(this.editHistory.pop());\n this.edit(edit);\n this.redoStack.push(edit);\n }", "function resetFormHistory(){\n\t\t_self.emit(\"log\",\"form.js\",\"resetFormHistory()\",\"info\");\n\t\t_historyObj = new Array();\n\t\treturn true;\n\t}", "function clearHistoryAndGuessedNums() {\n history=[];\n guessedNums=[];\n }", "function clear_redo_history() {\n\tredo_history = [];\n}", "function deleteHistory(){\n setHistory([]);\n setOP(\"\");\n setFP(\"\");\n setD(\"\");\n console.log(history);\n }", "reset() {\r\n this.currentState = this.initalState;\r\n this.clearHistory();\r\n }", "undo() {\n const cmd = this.history.pop();\n cmd.undo();\n }", "undo() {\n const cmd = this.history.pop();\n cmd.undo();\n }", "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 }", "restoreCommandHistory() {\n\t\tthis.m_commandHistory = [];\n\n\t\ttry {\n\t\t\tlet history = JSON.parse(localStorage.getItem('_terminal--command-history'));\n\n\t\t\tif (Array.isArray(history))\n\t\t\t\tthis.m_commandHistory = history;\n\t\t} catch (e) {}\n\n\t\tthis.m_commandHistoryCount = this.m_commandHistory.length;\n\t\tthis.m_commandHistoryIndex = this.m_commandHistoryCount;\n\t}", "rollback () {\n this.staged = this.cached\n }", "_setupHistory() {\n if (!this.history) {\n try{ this.history = createHistory(); }\n catch(e) { \n this.history = this.options.history || createMemoryHistory();\n this._isPhantomHistory = true; \n }\n } \n }", "function revertToOriginalURL() {\n var original = window.location.href.substr(0, window.location.href.indexOf('#'))\n history.replaceState({}, document.title, original);\n }", "keepHistory() {\n currentHistory += 1\n history.push(this.state.alasisu)\n }", "revert() { }", "clearHistory(){\n this.setState({\n history: [],\n lastWeighed: 0,\n weighedSum: 0\n });\n }", "function redo (history) {\n debug('redo', {history})\n\n const { past, present, future } = history\n\n if (future.length <= 0) return history\n\n return {\n future: future.slice(1, future.length), // remove element from future\n present: future[0], // set element as new present\n past: [\n ...past,\n present // old present state is in the past now\n ]\n }\n}", "switchHistory() {\n // display history page\n const action1 = switchHistoryPage(true);\n store.dispatch(action1);\n // get history from backend\n service.getHistoryall().then((data) => {\n const action2 = changeHistory(data.files);\n store.dispatch(action2);\n });\n }", "function rememberChangeHistoryAndInvokeOnChangesHook() {\n var simpleChangesStore = getSimpleChangesStore(this);\n var current = simpleChangesStore === null || simpleChangesStore === void 0 ? void 0 : simpleChangesStore.current;\n\n if (current) {\n var previous = simpleChangesStore.previous;\n\n if (previous === EMPTY_OBJ) {\n simpleChangesStore.previous = current;\n } else {\n // New changes are copied to the previous store, so that we don't lose history for inputs\n // which were not changed this time\n for (var key in current) {\n previous[key] = current[key];\n }\n }\n\n simpleChangesStore.current = null;\n this.ngOnChanges(current);\n }\n }", "@action clearUndo() {\n let that = this;\n that.undoHistory = A();\n }", "function manageHistory(option) {\n // options\n switch (option) {\n case 'update':\n currPosition = history[0].length - undoCount;\n history.forEach(element => {\n element.splice(currPosition, history[0].length - 1);\n });\n\n undoCount = 0;\n break;\n case 'clear':\n history = [[], [], [], []];\n undoCount = 0;\n return;\n default:\n break;\n };\n\n // If history's subarray length more than maximum\n if (history[0].length >= UndoLimit + 1) {\n // Delete first element of each \"history\" subarray\n history.forEach(element => {\n element.shift();\n });\n };\n // Add elements to the end of each \"history\" subarray\n history[0].push(CanvasBgr.html()); // canvas\n history[1].push(CurrColor.attr('bgcolor')); // color-picker\n history[2].push(CanvasGrid.prop('checked')); // grid\n if (BgrColor.attr('bgcolor') === undefined) { // background\n history[3].push('')\n }\n else {\n history[3].push(BgrColor.attr('bgcolor'));\n };\n }", "function restorePrevious() {\n\t\t\tif (hasSnapshot()) {\n\t\t\t\tsnap.history.pop();\n\t\t\t\tdoRollback();\n\t\t\t}\n\t\t}", "function undo(){\n if (listyforpoints.length > 0){\n historyforpts.undo();\n }\n}", "function redo(history) {\n const { past, future, _latestUnfiltered } = history;\n\n if (future.length <= 0) return history;\n\n const newPast = _latestUnfiltered != null ? [...past, _latestUnfiltered] : past;\n\n const newPresent = future[0];\n\n return {\n ...newPresent,\n past: newPast,\n future: future.slice(1, future.length),\n _latestUnfiltered: newPresent\n };\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 }", "clearHistory () {\n this.store.updateState({\n [HISTORY_STORE_KEY]: {},\n })\n }", "clearHistory () {\n this.store.updateState({\n [HISTORY_STORE_KEY]: {},\n })\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 resetLocalStorate(){\n localStorage.setItem('history', '[]');\n HTMLhistory.innerHTML = '<p class=\"no-history-available\">No history available</p>';\n}", "function undo() {\n circles.value = clone(history[--index.value]);\n }", "function save_history () {\n\tvar ds = currHds();\n\tedit_history [edit_history_index] = JSON.stringify(ds.toJSON());\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 purgeHistoryStates()\n{\n\tvar desc = new ActionDescriptor();\n\tdesc.putEnumerated( typeNULL, typePurgeItem, enumHistory );\n\texecuteAction( eventPurge, desc, DialogModes.NO );\n}", "function rememberChangeHistoryAndInvokeOnChangesHook() {\n const simpleChangesStore = getSimpleChangesStore(this);\n const current = simpleChangesStore === null || simpleChangesStore === void 0 ? void 0 : simpleChangesStore.current;\n if (current) {\n const previous = simpleChangesStore.previous;\n if (previous === EMPTY_OBJ) {\n simpleChangesStore.previous = current;\n }\n else {\n // New changes are copied to the previous store, so that we don't lose history for inputs\n // which were not changed this time\n for (let key in current) {\n previous[key] = current[key];\n }\n }\n simpleChangesStore.current = null;\n this.ngOnChanges(current);\n }\n}", "function rememberChangeHistoryAndInvokeOnChangesHook() {\n const simpleChangesStore = getSimpleChangesStore(this);\n const current = simpleChangesStore === null || simpleChangesStore === void 0 ? void 0 : simpleChangesStore.current;\n if (current) {\n const previous = simpleChangesStore.previous;\n if (previous === EMPTY_OBJ) {\n simpleChangesStore.previous = current;\n }\n else {\n // New changes are copied to the previous store, so that we don't lose history for inputs\n // which were not changed this time\n for (let key in current) {\n previous[key] = current[key];\n }\n }\n simpleChangesStore.current = null;\n this.ngOnChanges(current);\n }\n}", "function rememberChangeHistoryAndInvokeOnChangesHook() {\n const simpleChangesStore = getSimpleChangesStore(this);\n const current = simpleChangesStore === null || simpleChangesStore === void 0 ? void 0 : simpleChangesStore.current;\n if (current) {\n const previous = simpleChangesStore.previous;\n if (previous === EMPTY_OBJ) {\n simpleChangesStore.previous = current;\n }\n else {\n // New changes are copied to the previous store, so that we don't lose history for inputs\n // which were not changed this time\n for (let key in current) {\n previous[key] = current[key];\n }\n }\n simpleChangesStore.current = null;\n this.ngOnChanges(current);\n }\n}", "function rememberChangeHistoryAndInvokeOnChangesHook() {\n const simpleChangesStore = getSimpleChangesStore(this);\n const current = simpleChangesStore === null || simpleChangesStore === void 0 ? void 0 : simpleChangesStore.current;\n if (current) {\n const previous = simpleChangesStore.previous;\n if (previous === EMPTY_OBJ) {\n simpleChangesStore.previous = current;\n }\n else {\n // New changes are copied to the previous store, so that we don't lose history for inputs\n // which were not changed this time\n for (let key in current) {\n previous[key] = current[key];\n }\n }\n simpleChangesStore.current = null;\n this.ngOnChanges(current);\n }\n}", "function rememberChangeHistoryAndInvokeOnChangesHook() {\n const simpleChangesStore = getSimpleChangesStore(this);\n const current = simpleChangesStore === null || simpleChangesStore === void 0 ? void 0 : simpleChangesStore.current;\n if (current) {\n const previous = simpleChangesStore.previous;\n if (previous === EMPTY_OBJ) {\n simpleChangesStore.previous = current;\n }\n else {\n // New changes are copied to the previous store, so that we don't lose history for inputs\n // which were not changed this time\n for (let key in current) {\n previous[key] = current[key];\n }\n }\n simpleChangesStore.current = null;\n this.ngOnChanges(current);\n }\n}", "function rememberChangeHistoryAndInvokeOnChangesHook() {\n const simpleChangesStore = getSimpleChangesStore(this);\n const current = simpleChangesStore === null || simpleChangesStore === void 0 ? void 0 : simpleChangesStore.current;\n if (current) {\n const previous = simpleChangesStore.previous;\n if (previous === EMPTY_OBJ) {\n simpleChangesStore.previous = current;\n }\n else {\n // New changes are copied to the previous store, so that we don't lose history for inputs\n // which were not changed this time\n for (let key in current) {\n previous[key] = current[key];\n }\n }\n simpleChangesStore.current = null;\n this.ngOnChanges(current);\n }\n}", "function undo() {\n var historyPos = 1 * window.localStorage.getItem('history_pos'),\n historyStart = 1 * window.localStorage.getItem('history_start') || 1;\n if (historyPos > historyStart) {\n\n layerList.layers.parseJSON(window.localStorage.getItem('history_' + (historyPos - 2)));\n window.localStorage.setItem('history_pos', (historyPos - 1));\n\n document.getElementById('data').innerHTML = layerList.layers.toString(false, true);\n document.getElementById('background-color').value = layerList.layers.backgroundColor;\n window.colorPicker.updateColors();\n updateCodeView();\n marquee.hideRect();\n infoPanel.hide();\n $('#redo-button').attr(\"disabled\", false);\n }\n if (historyPos <= 2) {\n $('#undo-button').attr(\"disabled\", true);\n }\n}", "revert() {\n lib.restore();\n }", "undo() {\n const command = this.history.pop();\n if (command) {\n command.undo();\n }\n }", "undo() {\n if (this._history.length && this._historyIndex >= 0){\n this.commit(this._historyIndex - 1);\n } else {\n return false\n }\n }", "function rememberChangeHistoryAndInvokeOnChangesHook() {\n var simpleChangesStore = getSimpleChangesStore(this);\n var current = simpleChangesStore === null || simpleChangesStore === void 0 ? void 0 : simpleChangesStore.current;\n\n if (current) {\n var previous = simpleChangesStore.previous;\n\n if (previous === EMPTY_OBJ) {\n simpleChangesStore.previous = current;\n } else {\n // New changes are copied to the previous store, so that we don't lose history for inputs\n // which were not changed this time\n for (var key in current) {\n previous[key] = current[key];\n }\n }\n\n simpleChangesStore.current = null;\n this.ngOnChanges(current);\n }\n}", "_revertToOriginal() {\n this._storage = {}\n this._length = 0\n this._head = 0\n }", "@action undo() {\n if (this.args.onChange) {\n let that = this;\n let undoHistory = that.undoHistory.toArray();\n\n if (undoHistory.length === 0) {\n alert('No more steps to undo.');\n return false;\n }\n\n var restoreValue = undoHistory.pop();\n\n that.undoHistory = A(undoHistory);\n // that.updateValue();\n this.args.onChange(restoreValue);\n }\n }", "function updateHistory() {\n io.emit('update history', chatrooms);\n }", "_seedHistory() {\n log('Seeding history...');\n COMMON_ENTRY_POINTS.forEach((entryPoint) => this._addEntryPoint(entryPoint));\n this._writeHistoryFile();\n }", "historyBack() {\n const fenCode = this.state.chessBoardHistory.back();\n console.log('back');\n console.log(this.state.chessBoardHistory);\n this.updateBoard(fenCode);\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 undo() {\n var doc = app.activeDocument;\n var states = doc.historyStates;\n \n var curr = 0;\n for (var i=0; i<states.length; i++) {\n if (states[i] == doc.activeHistoryState) {\n curr = i;\n }\n }\n \n var prev = curr - 1;\n if (prev >= 0) {\n doc.activeHistoryState = states[prev];\n return true;\n } else {\n return false;\n }\n }", "function History_Force_MoveBack()\n{\n\t//can we go back?\n\tif (__SIMULATOR.History.CurrentStateIndex > 1)\n\t{\n\t\t//Go back\n\t\t__SIMULATOR.History.MoveBack();\n\t}\n}", "function resetChatHistory() {\n $(\"#txtChat\").attr(\"data-hist-index\", \"-1\");\n }", "function undo() {\n\n // Only works if history is nonempty.\n if (history[0] != -1) {\n\n // Clears the topmost nonempty square of the column in which the most recent piece was played.\n for (var i = 0; (history[i] != -1 && i < 42); i++);\n document.getElementsByClassName(\"row\").item(bottoms[history[i - 1]] + 1)\n .getElementsByClassName(\"bigSquare\").item(history[i - 1])\n .style.backgroundColor = \"white\";\n\n // Updates things.\n didSomebodyWin = false;\n document.getElementById(\"instructions\").innerHTML =\n \"Click on a column to drop in a piece. Upcoming pieces are shown below.\";\n bottoms[history[i - 1]]++;\n currentTurn--;\n changeCounter();\n\n // Erases the most recent move from history.\n history[i - 1] = -1;\n\n // Un-comment to see the game history.\n // printHistory();\n }\n }", "function clearHistory() {\n\tscores = [];\n\tlocalStorage.setItem(\"scores\", JSON.stringify(scores));\n\tlistofscores();\n}", "_reset() {\n if (this.isDirty) {\n let record;\n for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {\n record._nextPrevious = record._next;\n }\n for (record = this._additionsHead; record !== null; record = record._nextAdded) {\n record.previousIndex = record.currentIndex;\n }\n this._additionsHead = this._additionsTail = null;\n for (record = this._movesHead; record !== null; record = record._nextMoved) {\n record.previousIndex = record.currentIndex;\n }\n this._movesHead = this._movesTail = null;\n this._removalsHead = this._removalsTail = null;\n this._identityChangesHead = this._identityChangesTail = null;\n // TODO(vicb): when assert gets supported\n // assert(!this.isDirty);\n }\n }", "_reset() {\n if (this.isDirty) {\n let record;\n for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {\n record._nextPrevious = record._next;\n }\n for (record = this._additionsHead; record !== null; record = record._nextAdded) {\n record.previousIndex = record.currentIndex;\n }\n this._additionsHead = this._additionsTail = null;\n for (record = this._movesHead; record !== null; record = record._nextMoved) {\n record.previousIndex = record.currentIndex;\n }\n this._movesHead = this._movesTail = null;\n this._removalsHead = this._removalsTail = null;\n this._identityChangesHead = this._identityChangesTail = null;\n // TODO(vicb): when assert gets supported\n // assert(!this.isDirty);\n }\n }", "_reset() {\n if (this.isDirty) {\n let record;\n for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {\n record._nextPrevious = record._next;\n }\n for (record = this._additionsHead; record !== null; record = record._nextAdded) {\n record.previousIndex = record.currentIndex;\n }\n this._additionsHead = this._additionsTail = null;\n for (record = this._movesHead; record !== null; record = record._nextMoved) {\n record.previousIndex = record.currentIndex;\n }\n this._movesHead = this._movesTail = null;\n this._removalsHead = this._removalsTail = null;\n this._identityChangesHead = this._identityChangesTail = null;\n // TODO(vicb): when assert gets supported\n // assert(!this.isDirty);\n }\n }", "_reset() {\n if (this.isDirty) {\n let record;\n for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {\n record._nextPrevious = record._next;\n }\n for (record = this._additionsHead; record !== null; record = record._nextAdded) {\n record.previousIndex = record.currentIndex;\n }\n this._additionsHead = this._additionsTail = null;\n for (record = this._movesHead; record !== null; record = record._nextMoved) {\n record.previousIndex = record.currentIndex;\n }\n this._movesHead = this._movesTail = null;\n this._removalsHead = this._removalsTail = null;\n this._identityChangesHead = this._identityChangesTail = null;\n // TODO(vicb): when assert gets supported\n // assert(!this.isDirty);\n }\n }", "_reset() {\n if (this.isDirty) {\n let record;\n for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {\n record._nextPrevious = record._next;\n }\n for (record = this._additionsHead; record !== null; record = record._nextAdded) {\n record.previousIndex = record.currentIndex;\n }\n this._additionsHead = this._additionsTail = null;\n for (record = this._movesHead; record !== null; record = record._nextMoved) {\n record.previousIndex = record.currentIndex;\n }\n this._movesHead = this._movesTail = null;\n this._removalsHead = this._removalsTail = null;\n this._identityChangesHead = this._identityChangesTail = null;\n // TODO(vicb): when assert gets supported\n // assert(!this.isDirty);\n }\n }", "_reset() {\n if (this.isDirty) {\n let record;\n for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {\n record._nextPrevious = record._next;\n }\n for (record = this._additionsHead; record !== null; record = record._nextAdded) {\n record.previousIndex = record.currentIndex;\n }\n this._additionsHead = this._additionsTail = null;\n for (record = this._movesHead; record !== null; record = record._nextMoved) {\n record.previousIndex = record.currentIndex;\n }\n this._movesHead = this._movesTail = null;\n this._removalsHead = this._removalsTail = null;\n this._identityChangesHead = this._identityChangesTail = null;\n // TODO(vicb): when assert gets supported\n // assert(!this.isDirty);\n }\n }", "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}", "undoLastAction(){\n if (this.todoListsBackup.length > 0) {\n this.todoLists = this.todoListsBackup.slice();\n }\n }", "function redo(history) {\n\t debug('redo', { 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 (future.length <= 0) return history;\n\n\t return {\n\t future: future.slice(1, future.length), // remove element from future\n\t present: future[0], // set element as new present\n\t past: [].concat(_toConsumableArray(past), [present // old present state is in the past now\n\t ])\n\t };\n\t}", "redo () {\n if (this.redoStack.length === 0) return;\n\n let edit = reverseInput(this.redoStack.pop());\n this.edit(edit);\n this.editHistory.push(edit);\n }", "function History_MoveBack()\n{\n\t//forward to move to index\n\tthis.MoveToIndex(this.CurrentStateIndex - 1);\n}", "function addToHistory(line){\n history.push(line);\n restoreText = '';\n }", "shift(url, addToHistory) {\n if (addToHistory) window.history.pushState(null, null, `/${this.clearSlashes(url)}`);\n else window.history.replaceState(null, null, `/${this.clearSlashes(url)}`);\n this.current = `${this.clearSlashes(url)}`;\n }", "function changeDirectoryHistory(path){//changes directory form array\n const rememberedDirectory = currentDirectory //stores current\n \n targetDirectory(path,tempHist)\n\n if (currentDirectory === undefined){ ///////// invalid op line\n currentDirectory = rememberedDirectory\n invLine()\n }else{\n folderHistory = []\n folderHistory.push(...tempHist) ////////////////////// if directory works out change directory ---- populate folder history ---- and render new directory to viewport\n currentFolder = folderHistory[folderHistory.length-1]\n renderItems(destinationHTML,currentDirectory)\n } \n console.log(folderHistory)\n}", "function layers_add_history_state(){\n\t\t// Update the browser URl so page can be refreshed\n\t\tif (window.history.pushState) {\n\t\t\t// Newer Browsers only (IE10+, Firefox3+, etc)\n\t\t\tvar url = window.location.href.split('?')[0] + \"?url=\" + wp.customize.previewer.previewUrl();\n\t\t\twindow.history.pushState({}, \"\", url);\n\t\t}\n\t}", "function reset() {\n\n invalidationStrategy = InvalidationStrategies.TIMEOUT;\n\n for (var tileKey in tileCache) {\n if (tileCache.hasOwnProperty(tileKey)) {\n var tileEntry = tileCache[tileKey];\n if (tileEntry.tile.destruct) {\n tileEntry.tile.destruct();\n }\n }\n }\n tileCache = {};\n\n modalLevel = 0;\n\n for (var i = 0; i < containers.length; i++) {\n if (containers[i].params.destruct) {\n containers[i].params.destruct();\n }\n }\n containers = [];\n\n logging.debug(\"init history\");\n if (history) {\n history.destruct();\n }\n history = new History({\n changeListener: function(item, changeListenerParams) {\n console.log(0);\n Routes.mapPath(changeListenerParams.newHash)\n .then(function(route) {\n if (item) {\n activateTile(item.container, item, changeListenerParams);\n } else if (route) {\n logging.debug(\"Opening \" + route.tileName);\n item = {\n \"name\": route.tileName,\n \"params\": route.params,\n \"data\": null,\n \"modal\": false,\n \"modalLevel\": modalLevel\n };\n var targetContainer = getTargetContainerForElement(null, route.tileName) || containers[0];\n activateTile(targetContainer, item, { \"direction\": \"forward\", \"hash\": changeListenerParams.newHash });\n }\n\n if (changeListenerParams.direction === \"back\") {\n if (changeListenerParams.prevItem.promise) {\n var prevTileKey = getTileKey(changeListenerParams.prevItem);\n var prevTileEntry = tileCache[prevTileKey];\n if (prevTileEntry) {\n changeListenerParams.prevItem.promise.fulfill(prevTileEntry.tile);\n modalLevel--;\n }\n }\n\n invalidationStrategy();\n\n // finally fulfill the backpromise exposed via Tiles.back()\n if (backPromise !== null) {\n backPromise.fulfill();\n backPromise = null;\n }\n }\n });\n }\n });\n transitionStartListeners = [];\n }", "runOneStepBackwards() {\n this.stateHistory.previousState()\n }", "function voltar(){\n history.back();\n}", "save() {\n if (this._history.length > 9){\n this._history.shift();\n }\n this._history.push(this.internalData);\n // Make the commit to setup the index and the state\n this.commit();\n }", "function undo() {\r\n if (!gGame.isOn) return\r\n if (gMovesHistory.length === 0) return //possible to disable/enable during game\r\n var prevMove = gMovesHistory.pop();\r\n while (gMovesHistory.length > 0 && !prevMove.userClicked) {\r\n undoPrevMove(prevMove);\r\n prevMove = gMovesHistory.pop();\r\n }\r\n undoPrevMove(prevMove);\r\n}", "function back() {\n if (history.length > 1) {\n setHistory(prev => prev.slice(0, prev.length - 1));\n }\n }" ]
[ "0.7397952", "0.7375274", "0.711438", "0.6920561", "0.6904765", "0.687358", "0.686189", "0.680521", "0.67269665", "0.6600654", "0.6581299", "0.65552354", "0.65401167", "0.6529911", "0.6517975", "0.6485189", "0.6480019", "0.64591163", "0.6439742", "0.64371014", "0.64327615", "0.6385524", "0.63716924", "0.63425016", "0.6331633", "0.63301754", "0.6328398", "0.63136923", "0.62927544", "0.62461853", "0.6204777", "0.6199276", "0.6199276", "0.6198224", "0.6190285", "0.6189284", "0.6165419", "0.61610657", "0.61601335", "0.61487025", "0.6125875", "0.6119991", "0.61198074", "0.6115358", "0.6084904", "0.60610217", "0.6051461", "0.6044738", "0.60420066", "0.60250205", "0.602249", "0.602249", "0.6011555", "0.5993812", "0.5981489", "0.5978792", "0.5969661", "0.596635", "0.5960299", "0.5960299", "0.5960299", "0.5960299", "0.5960299", "0.5960299", "0.59596336", "0.59575975", "0.59537905", "0.5950725", "0.5925382", "0.5921995", "0.5908284", "0.59030753", "0.59022796", "0.58955055", "0.5890739", "0.5888522", "0.5884556", "0.58840823", "0.5882594", "0.588013", "0.58798766", "0.58798766", "0.58798766", "0.58798766", "0.58798766", "0.58798766", "0.5879121", "0.5876586", "0.5875844", "0.5871346", "0.5869538", "0.5868251", "0.58515084", "0.58494586", "0.58493346", "0.5842045", "0.58381397", "0.58363783", "0.5835711", "0.5828047", "0.58279413" ]
0.0
-1
Tries to rebase an array of history events given a change in the document. If the change touches the same lines as the event, the event, and everything 'behind' it, is discarded. If the change is before the event, the event's positions are updated. Uses a copyonwrite scheme for the positions, to avoid having to reallocate them all on every rebase, but also avoid problems with shared position objects being unsafely updated.
function rebaseHistArray(array, from, to, diff) { for (var i = 0; i < array.length; ++i) { var sub = array[i], ok = true; if (sub.ranges) { if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; } for (var j = 0; j < sub.ranges.length; j++) { rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff); rebaseHistSelSingle(sub.ranges[j].head, from, to, diff); } continue } for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) { var cur = sub.changes[j$1]; if (to < cur.from.line) { cur.from = Pos(cur.from.line + diff, cur.from.ch); cur.to = Pos(cur.to.line + diff, cur.to.ch); } else if (from <= cur.to.line) { ok = false; break } } if (!ok) { array.splice(0, i + 1); i = 0; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n for (var j = 0; j < sub.changes.length; ++j) {\n var cur = sub.changes[j];\n if (!sub.copied) { cur.from = copyPos(cur.from); cur.to = copyPos(cur.to); }\n if (to < cur.from.line) {\n cur.from.line += diff;\n cur.to.line += diff;\n } else if (from <= cur.to.line) {\n ok = false;\n break;\n }\n }\n if (!sub.copied) {\n sub.anchorBefore = copyPos(sub.anchorBefore); sub.headBefore = copyPos(sub.headBefore);\n sub.anchorAfter = copyPos(sub.anchorAfter); sub.readAfter = copyPos(sub.headAfter);\n sub.copied = true;\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n } else {\n rebaseHistSel(sub.anchorBefore); rebaseHistSel(sub.headBefore);\n rebaseHistSel(sub.anchorAfter); rebaseHistSel(sub.headAfter);\n }\n }\n }", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n for (var j = 0; j < sub.changes.length; ++j) {\n var cur = sub.changes[j];\n if (!sub.copied) { cur.from = copyPos(cur.from); cur.to = copyPos(cur.to); }\n if (to < cur.from.line) {\n cur.from.line += diff;\n cur.to.line += diff;\n } else if (from <= cur.to.line) {\n ok = false;\n break;\n }\n }\n if (!sub.copied) {\n sub.anchorBefore = copyPos(sub.anchorBefore); sub.headBefore = copyPos(sub.headBefore);\n sub.anchorAfter = copyPos(sub.anchorAfter); sub.readAfter = copyPos(sub.headAfter);\n sub.copied = true;\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n } else {\n rebaseHistSel(sub.anchorBefore); rebaseHistSel(sub.headBefore);\n rebaseHistSel(sub.anchorAfter); rebaseHistSel(sub.headAfter);\n }\n }\n }", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n for (var j = 0; j < sub.changes.length; ++j) {\n var cur = sub.changes[j];\n if (!sub.copied) { cur.from = copyPos(cur.from); cur.to = copyPos(cur.to); }\n if (to < cur.from.line) {\n cur.from.line += diff;\n cur.to.line += diff;\n } else if (from <= cur.to.line) {\n ok = false;\n break;\n }\n }\n if (!sub.copied) {\n sub.anchorBefore = copyPos(sub.anchorBefore); sub.headBefore = copyPos(sub.headBefore);\n sub.anchorAfter = copyPos(sub.anchorAfter); sub.readAfter = copyPos(sub.headAfter);\n sub.copied = true;\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n } else {\n rebaseHistSel(sub.anchorBefore); rebaseHistSel(sub.headBefore);\n rebaseHistSel(sub.anchorAfter); rebaseHistSel(sub.headAfter);\n }\n }\n }", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n for (var j = 0; j < sub.changes.length; ++j) {\n var cur = sub.changes[j];\n if (!sub.copied) { cur.from = copyPos(cur.from); cur.to = copyPos(cur.to); }\n if (to < cur.from.line) {\n cur.from.line += diff;\n cur.to.line += diff;\n } else if (from <= cur.to.line) {\n ok = false;\n break;\n }\n }\n if (!sub.copied) {\n sub.anchorBefore = copyPos(sub.anchorBefore); sub.headBefore = copyPos(sub.headBefore);\n sub.anchorAfter = copyPos(sub.anchorAfter); sub.readAfter = copyPos(sub.headAfter);\n sub.copied = true;\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n } else {\n rebaseHistSel(sub.anchorBefore); rebaseHistSel(sub.headBefore);\n rebaseHistSel(sub.anchorAfter); rebaseHistSel(sub.headAfter);\n }\n }\n }", "function rebaseHistArray(array, from, to, diff) {\n\t\t for (var i = 0; i < array.length; ++i) {\n\t\t var sub = array[i], ok = true;\n\t\t if (sub.ranges) {\n\t\t if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n\t\t for (var j = 0; j < sub.ranges.length; j++) {\n\t\t rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n\t\t rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n\t\t }\n\t\t continue\n\t\t }\n\t\t for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n\t\t var cur = sub.changes[j$1];\n\t\t if (to < cur.from.line) {\n\t\t cur.from = Pos(cur.from.line + diff, cur.from.ch);\n\t\t cur.to = Pos(cur.to.line + diff, cur.to.ch);\n\t\t } else if (from <= cur.to.line) {\n\t\t ok = false;\n\t\t break\n\t\t }\n\t\t }\n\t\t if (!ok) {\n\t\t array.splice(0, i + 1);\n\t\t i = 0;\n\t\t }\n\t\t }\n\t\t }", "function rebaseHistArray(array, from, to, diff) {\n\t\t for (var i = 0; i < array.length; ++i) {\n\t\t var sub = array[i], ok = true;\n\t\t if (sub.ranges) {\n\t\t if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n\t\t for (var j = 0; j < sub.ranges.length; j++) {\n\t\t rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n\t\t rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n\t\t }\n\t\t continue;\n\t\t }\n\t\t for (var j = 0; j < sub.changes.length; ++j) {\n\t\t var cur = sub.changes[j];\n\t\t if (to < cur.from.line) {\n\t\t cur.from = Pos(cur.from.line + diff, cur.from.ch);\n\t\t cur.to = Pos(cur.to.line + diff, cur.to.ch);\n\t\t } else if (from <= cur.to.line) {\n\t\t ok = false;\n\t\t break;\n\t\t }\n\t\t }\n\t\t if (!ok) {\n\t\t array.splice(0, i + 1);\n\t\t i = 0;\n\t\t }\n\t\t }\n\t\t }", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue;\n }\n for (var j = 0; j < sub.changes.length; ++j) {\n var cur = sub.changes[j];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break;\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue;\n }\n for (var j = 0; j < sub.changes.length; ++j) {\n var cur = sub.changes[j];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break;\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue;\n }\n for (var j = 0; j < sub.changes.length; ++j) {\n var cur = sub.changes[j];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break;\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue;\n }\n for (var j = 0; j < sub.changes.length; ++j) {\n var cur = sub.changes[j];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break;\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue;\n }\n for (var j = 0; j < sub.changes.length; ++j) {\n var cur = sub.changes[j];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break;\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue;\n }\n for (var j = 0; j < sub.changes.length; ++j) {\n var cur = sub.changes[j];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break;\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue;\n }\n for (var j = 0; j < sub.changes.length; ++j) {\n var cur = sub.changes[j];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break;\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }", "function rebaseHistArray(array, from, to, diff) {\r\n for (var i = 0; i < array.length; ++i) {\r\n var sub = array[i], ok = true;\r\n if (sub.ranges) {\r\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\r\n for (var j = 0; j < sub.ranges.length; j++) {\r\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\r\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\r\n }\r\n continue;\r\n }\r\n for (var j = 0; j < sub.changes.length; ++j) {\r\n var cur = sub.changes[j];\r\n if (to < cur.from.line) {\r\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\r\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\r\n } else if (from <= cur.to.line) {\r\n ok = false;\r\n break;\r\n }\r\n }\r\n if (!ok) {\r\n array.splice(0, i + 1);\r\n i = 0;\r\n }\r\n }\r\n }", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff)\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff)\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1]\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch)\n cur.to = Pos(cur.to.line + diff, cur.to.ch)\n } else if (from <= cur.to.line) {\n ok = false\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1)\n i = 0\n }\n }\n}", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff)\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff)\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1]\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch)\n cur.to = Pos(cur.to.line + diff, cur.to.ch)\n } else if (from <= cur.to.line) {\n ok = false\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1)\n i = 0\n }\n }\n}", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i],\n ok = true;\n\n if (sub.ranges) {\n if (!sub.copied) {\n sub = array[i] = sub.deepCopy();\n sub.copied = true;\n }\n\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n\n continue;\n }\n\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break;\n }\n }\n\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }", "function rebaseHistArray(array, from, to, diff) {\r\n for (var i = 0; i < array.length; ++i) {\r\n var sub = array[i], ok = true;\r\n if (sub.ranges) {\r\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\r\n for (var j = 0; j < sub.ranges.length; j++) {\r\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\r\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\r\n }\r\n continue\r\n }\r\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\r\n var cur = sub.changes[j$1];\r\n if (to < cur.from.line) {\r\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\r\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\r\n } else if (from <= cur.to.line) {\r\n ok = false;\r\n break\r\n }\r\n }\r\n if (!ok) {\r\n array.splice(0, i + 1);\r\n i = 0;\r\n }\r\n }\r\n}", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n}", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n}", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n}", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n}", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n}", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n}", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n}", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n}", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n}", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n}", "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n}", "function rebaseHistArray(array, from, to, diff) {\n\t for (var i = 0; i < array.length; ++i) {\n\t var sub = array[i], ok = true;\n\t if (sub.ranges) {\n\t if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n\t for (var j = 0; j < sub.ranges.length; j++) {\n\t rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n\t rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n\t }\n\t continue;\n\t }\n\t for (var j = 0; j < sub.changes.length; ++j) {\n\t var cur = sub.changes[j];\n\t if (to < cur.from.line) {\n\t cur.from = Pos(cur.from.line + diff, cur.from.ch);\n\t cur.to = Pos(cur.to.line + diff, cur.to.ch);\n\t } else if (from <= cur.to.line) {\n\t ok = false;\n\t break;\n\t }\n\t }\n\t if (!ok) {\n\t array.splice(0, i + 1);\n\t i = 0;\n\t }\n\t }\n\t }", "function rebaseHistArray(array, from, to, diff) {\n\t for (var i = 0; i < array.length; ++i) {\n\t var sub = array[i], ok = true;\n\t if (sub.ranges) {\n\t if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n\t for (var j = 0; j < sub.ranges.length; j++) {\n\t rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n\t rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n\t }\n\t continue;\n\t }\n\t for (var j = 0; j < sub.changes.length; ++j) {\n\t var cur = sub.changes[j];\n\t if (to < cur.from.line) {\n\t cur.from = Pos(cur.from.line + diff, cur.from.ch);\n\t cur.to = Pos(cur.to.line + diff, cur.to.ch);\n\t } else if (from <= cur.to.line) {\n\t ok = false;\n\t break;\n\t }\n\t }\n\t if (!ok) {\n\t array.splice(0, i + 1);\n\t i = 0;\n\t }\n\t }\n\t }", "function rebaseHistArray(array, from, to, diff) {\n\t for (var i = 0; i < array.length; ++i) {\n\t var sub = array[i], ok = true;\n\t if (sub.ranges) {\n\t if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n\t for (var j = 0; j < sub.ranges.length; j++) {\n\t rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n\t rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n\t }\n\t continue;\n\t }\n\t for (var j = 0; j < sub.changes.length; ++j) {\n\t var cur = sub.changes[j];\n\t if (to < cur.from.line) {\n\t cur.from = Pos(cur.from.line + diff, cur.from.ch);\n\t cur.to = Pos(cur.to.line + diff, cur.to.ch);\n\t } else if (from <= cur.to.line) {\n\t ok = false;\n\t break;\n\t }\n\t }\n\t if (!ok) {\n\t array.splice(0, i + 1);\n\t i = 0;\n\t }\n\t }\n\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 copyHistoryArray(events, newGroup) {\n for (var i = 0, copy = []; i < events.length; ++i) {\n var event = events[i], changes = event.changes, newChanges = [];\n copy.push({changes: newChanges, anchorBefore: event.anchorBefore, headBefore: event.headBefore,\n anchorAfter: event.anchorAfter, headAfter: event.headAfter});\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) {\n for (var i = 0, copy = []; i < events.length; ++i) {\n var event = events[i], changes = event.changes, newChanges = [];\n copy.push({changes: newChanges, anchorBefore: event.anchorBefore, headBefore: event.headBefore,\n anchorAfter: event.anchorAfter, headAfter: event.headAfter});\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) {\n for (var i = 0, copy = []; i < events.length; ++i) {\n var event = events[i], changes = event.changes, newChanges = [];\n copy.push({changes: newChanges, anchorBefore: event.anchorBefore, headBefore: event.headBefore,\n anchorAfter: event.anchorAfter, headAfter: event.headAfter});\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) {\n for (var i = 0, copy = []; i < events.length; ++i) {\n var event = events[i], changes = event.changes, newChanges = [];\n copy.push({changes: newChanges, anchorBefore: event.anchorBefore, headBefore: event.headBefore,\n anchorAfter: event.anchorAfter, headAfter: event.headAfter});\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 }", "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 }", "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 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) {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\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) { 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 calcChanges(childArr, oldChildArr) {\n\tvar subIndex = 0;\n\tvar changes = [];\n\n\tif (oldChildArr.length === 0 && childArr.length === 0) {\n\t\treturn [];\n\t}\n\n\tfor (; subIndex < childArr.length; subIndex++) {\n\t\tvar oldChild = oldChildArr[subIndex];\n\t\tvar newChild = childArr[subIndex];\n\t\tif (oldChild === newChild) {\n\t\t\tcontinue;\n\t\t};\n\t\tvar type = oldChild != null && newChild == null ? 'rm' : oldChild == null && newChild != null ? 'add' : 'set';\n\n\t\t// aggregate consecutive changes of the similar type to perform batch operations\n\t\tvar lastChange = changes.length > 0 ? changes[changes.length - 1] : null;\n\t\t// if there was a similiar change we add this change to the last change\n\t\tif (lastChange && lastChange.type === type) {\n\t\t\tif (type == 'rm') {\n\t\t\t\t// we just count the positions\n\t\t\t\tlastChange.num++;\n\t\t\t} else {\n\t\t\t\t// for add and set operations we need the exact index of the child and the child element to insert\n\t\t\t\tlastChange.indexes.push(subIndex);\n\t\t\t\tlastChange.elems.push(newChild);\n\t\t\t}\n\t\t} else {\n\t\t\t// if we couldn't aggregate we push a new change\n\t\t\tchanges.push({\n\t\t\t\tindexes: [subIndex],\n\t\t\t\telems: [newChild],\n\t\t\t\tnum: 1,\n\t\t\t\ttype: type\n\t\t\t});\n\t\t}\n\t}\n\t// all elements that are not in the new list got deleted\n\tif (subIndex < oldChildArr.length) {\n\t\tchanges.push({\n\t\t\tindexes: [subIndex],\n\t\t\tnum: oldChildArr.length - subIndex,\n\t\t\ttype: 'rm'\n\t\t});\n\t}\n\n\treturn changes;\n}", "handleChange(undo, oldState) {\n const { noteTracker, tr, markType } = this;\n const rebuildRange = undo\n ? noteTracker.diffRange(tr, oldState)\n : noteTracker.insertedRange(tr);\n\n if (rebuildRange) {\n const { from, to } = rebuildRange;\n const positions = notesFromDoc(tr.doc, markType, from, to);\n\n this.rebuildRange(\n rebuildRange,\n positions.map((p) => ({\n id: p.id,\n from: p.start,\n to: p.end,\n meta: p.meta,\n }))\n );\n\n return this;\n }\n\n // Else if rebuildRange is false, mappingPositions will handle removal\n\n return this;\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}" ]
[ "0.6718455", "0.6718455", "0.6718455", "0.6718455", "0.6492295", "0.648774", "0.6472811", "0.6472811", "0.6472811", "0.6472811", "0.6472811", "0.6472811", "0.6472811", "0.64685804", "0.64341486", "0.64341486", "0.6425354", "0.6421519", "0.63940966", "0.63940966", "0.63940966", "0.63940966", "0.63940966", "0.63940966", "0.63940966", "0.63940966", "0.63940966", "0.63940966", "0.63940966", "0.63924044", "0.63924044", "0.63924044", "0.6233235", "0.6190123", "0.6190123", "0.6190123", "0.6190123", "0.60989827", "0.6088494", "0.6088494", "0.6088494", "0.6088494", "0.6088494", "0.6088494", "0.6088494", "0.6088494", "0.6088494", "0.6088494", "0.6088494", "0.6088494", "0.6088494", "0.6088494", "0.6088494", "0.6088494", "0.6088494", "0.607688", "0.60763216", "0.6066846", "0.6066846", "0.6066846", "0.6066846", "0.6066846", "0.6066846", "0.6066846", "0.6066846", "0.6066846", "0.6066846", "0.6066846", "0.6051639", "0.6051639", "0.6051639", "0.6051639", "0.6051639", "0.6051639", "0.6051639", "0.6043359", "0.60408413", "0.60408413", "0.60408413", "0.6039213", "0.6039213", "0.60388607", "0.60329276", "0.60131204" ]
0.64719915
28
Utility for applying a change to a line by handle or number, returning the number and optionally registering the line as changed.
function changeLine(doc, handle, changeType, op) { var no = handle, line = handle; if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); } else { no = lineNo(handle); } if (no == null) { return null } if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); } return line }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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, 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) {\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\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 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 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", "updateLineNumber(editor, fromLine, toLine) {\n const annotations = this.getAnnotations(editor, fromLine)\n return this._setAnnotations(\n editor,\n annotations.map(annotation => {\n return {\n ...annotation,\n lineNumber: toLine,\n }\n })\n )\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) {\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\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 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 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) {\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}", "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 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\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 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) {\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 }" ]
[ "0.7356353", "0.7356353", "0.7356353", "0.73486423", "0.73486423", "0.73486423", "0.73486423", "0.73486423", "0.73486423", "0.73486423", "0.7346209", "0.73159844", "0.7314361", "0.7234829", "0.7234829", "0.7226441", "0.7226441", "0.7226441", "0.7226441", "0.7226441", "0.7226441", "0.7226441", "0.7226441", "0.7226441", "0.7226441", "0.7226441", "0.72259295", "0.7144771", "0.654258", "0.64772636", "0.64772636", "0.64772636", "0.64772636", "0.64772636", "0.64772636", "0.64772636", "0.64772636", "0.6464466", "0.6464466", "0.6464466", "0.6464466", "0.6464466", "0.6464466", "0.6464466", "0.6464466", "0.6464466", "0.6464466", "0.6464466", "0.6464466", "0.6464466", "0.6464466", "0.6464466", "0.6464466", "0.6464466", "0.6460466", "0.6460466", "0.6457327", "0.64462316", "0.64426965", "0.64426965", "0.6442159", "0.64399964", "0.6430772", "0.6430772", "0.6430772", "0.6430772", "0.6430772", "0.6430772", "0.6430772", "0.6430772", "0.6430772", "0.6430772", "0.6430772", "0.63901204", "0.6140033", "0.6140033", "0.6140033", "0.6126943", "0.6119694", "0.6108219", "0.6108219", "0.610678", "0.610678", "0.610678" ]
0.73417675
24
The document is represented as a BTree consisting of leaves, with chunk of lines in them, and branches, with up to ten leaves or other branch nodes below them. The top node is always a branch node, and is the document object itself (meaning it has additional methods and properties). All nodes have parent links. The tree is used both to go from line numbers to line objects, and to go from objects to numbers. It also indexes by height, and is used to convert between height and line object, and to find the total height of the document. See also
function LeafChunk(lines) { var this$1 = this; this.lines = lines; this.parent = null; var height = 0; for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1; height += lines[i].height; } this.height = height; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BTree(){\n\tthis.root = null;\n\tthis.length = 0;\n}", "function documentFragment(children, height, depth, maxFontSize) {\n this.children = children || [];\n this.height = height || 0;\n this.depth = depth || 0;\n this.maxFontSize = maxFontSize || 0;\n}", "function documentFragment(children, height, depth, maxFontSize) {\n this.children = children || [];\n this.height = height || 0;\n this.depth = depth || 0;\n this.maxFontSize = maxFontSize || 0;\n}", "constructor() {\n\t\t/**\n\t\t *\n\t\t * @type {(BTreeNode|null)}\n\t\t */\n\t\tthis.left = null;\n\t\t/**\n\t\t * Entries counters.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.entriesLength = 0;\n\t\t/**\n\t\t *\n\t\t * @type {(BTreeNodeEntry|null)}\n\t\t */\n\t\tthis.firstEntry = null;\n\t}", "function RBTree() {\n this._root = null;\n }", "function Tree() {\n // ----------\n // Attributes\n // ----------\n\n this.root = null; // Note the NULL root node of this tree.\n this.cur = {}; // Note the EMPTY current node of the tree we're building.\n\n\n // -- ------- --\n // -- Methods --\n // -- ------- --\n\n // Add a node: kind in {branch, leaf}.\n this.addNode = function(name, kind) {\n // Construct the node object.\n var node = {\n name: name,\n children: [],\n parent: {}\n };\n\n // Check to see if it needs to be the root node.\n if ((this.root == null) || (!this.root)) {\n // We are the root node.\n this.root = node;\n } else {\n // We are the children.\n // Make our parent the CURrent node...\n node.parent = this.cur;\n // ... and add ourselves (via the unfrotunately-named\n // \"push\" function) to the children array of the current node.\n this.cur.children.push(node);\n }\n // If we are an interior/branch node, then...\n if (kind == \"branch\") {\n // ... update the CURrent node pointer to ourselves.\n this.cur = node;\n }\n };\n\n // Note that we're done with this branch of the tree...\n this.endChildren = function() {\n // ... by moving \"up\" to our parent node (if possible).\n if ((this.cur.parent !== null) && (this.cur.parent.name !== undefined)) {\n this.cur = this.cur.parent;\n } else {\n // TODO: Some sort of error logging.\n // This really should not happen, but it will, of course.\n }\n };\n\n // Return a string representation of the tree.\n this.toString = function() {\n // Initialize the result string.\n var traversalResult = \"\";\n var level = 0;\n // Recursive function to handle the expansion of the nodes.\n function expand(node, depth) {\n // Space out based on the current depth so\n // this looks at least a little tree-like.\n for (var i = 0; i < depth; i++) {\n traversalResult += \"-\";\n }\n\n // If there are no children (i.e., leaf nodes)...\n if (!node.children || node.children.length === 0) {\n // ... note the leaf node.\n traversalResult += \"[\" + node.name + \"]\";\n traversalResult += \"\\n\";\n } else {\n // There are children, so note these interior/branch nodes and ...\n traversalResult += \"<\" + node.name + \"> \\n\";\n // .. recursively expand them.\n for (var i = 0; i < node.children.length; i++) {\n expand(node.children[i], depth + 1);\n }\n // depth-=1;\n }\n }\n // Make the initial call to expand from the root.\n expand(this.root, 0);\n // Return the result.\n return traversalResult;\n };\n}", "function Tree(branch) {\n this.branch = branch;\n this.branch = branch;\n }", "get tree() {\n return this.buffer ? null : this._tree._tree;\n }", "constructor(\n /// The start of the unchanged range pointed to by this fragment.\n /// This refers to an offset in the _updated_ document (as opposed\n /// to the original tree).\n from, \n /// The end of the unchanged range.\n to, \n /// The tree that this fragment is based on.\n tree, \n /// The offset between the fragment's tree and the document that\n /// this fragment can be used against. Add this when going from\n /// document to tree positions, subtract it to go from tree to\n /// document positions.\n offset, openStart = false, openEnd = false) {\n this.from = from;\n this.to = to;\n this.tree = tree;\n this.offset = offset;\n this.open = (openStart ? 1 /* Open.Start */ : 0) | (openEnd ? 2 /* Open.End */ : 0);\n }", "function tree() {\n var separation = defaultSeparation$1,\n dx = 1,\n dy = 1,\n nodeSize = null;\n\n function tree(root) {\n var t = treeRoot(root);\n\n // Compute the layout using Buchheim et al.’s algorithm.\n t.eachAfter(firstWalk), t.parent.m = -t.z;\n t.eachBefore(secondWalk);\n\n // If a fixed node size is specified, scale x and y.\n if (nodeSize) root.eachBefore(sizeNode);\n\n // If a fixed tree size is specified, scale x and y based on the extent.\n // Compute the left-most, right-most, and depth-most nodes for extents.\n else {\n var left = root,\n right = root,\n bottom = root;\n root.eachBefore(function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2,\n tx = s - left.x,\n kx = dx / (right.x + s + tx),\n ky = dy / (bottom.depth || 1);\n root.eachBefore(function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n\n return root;\n }\n\n // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n // applied recursively to the children of v, as well as the function\n // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n // node v is placed to the midpoint of its outermost children.\n function firstWalk(v) {\n var children = v.children,\n siblings = v.parent.children,\n w = v.i ? siblings[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n\n // Computes all real x-coordinates by summing up the modifiers recursively.\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n\n // The core of the algorithm. Here, a new subtree is combined with the\n // previous subtrees. Threads are used to traverse the inside and outside\n // contours of the left and right subtree up to the highest common level. The\n // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n // superscript o means outside and i means inside, the subscript - means left\n // subtree and + means right subtree. For summing up the modifiers along the\n // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n // nodes of the inside contours conflict, we compute the left one of the\n // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n // Finally, we add a new thread (if necessary).\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v,\n vop = v,\n vim = w,\n vom = vip.parent.children[0],\n sip = vip.m,\n sop = vop.m,\n sim = vim.m,\n som = vom.m,\n shift;\n while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n\n tree.separation = function(x) {\n return arguments.length ? (separation = x, tree) : separation;\n };\n\n tree.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n };\n\n tree.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n };\n\n return tree;\n}", "function tree(chunk, xoff, yoff, zoff, height, i, k) {\n // leave if chunk is above/below tree height\n var js = chunk.shape[1]\n var treelo = height\n var treemax = treelo + 20\n if (yoff>treemax || yoff+js<treelo) return\n\n // don't build at chunk border for now\n var border = 5\n if (i<border || k<border) return\n var is = chunk.shape[0]\n var ks = chunk.shape[2]\n if (i>is-border || k>ks-border) return\n\n // sparse trees\n var x = xoff + i\n var z = zoff + k\n var thash = hash(x, z)\n if (floor(800*thash)!==0) return\n\n // build the treetrunk\n var treehi = treelo + 6 + floor(6*hash(x,z,1))\n for (var y=treelo; y<treehi; ++y) {\n var j = y-yoff\n if (j<0 || j>js) continue\n chunk.set( i,j,k, woodID );\n }\n\n // spherical-ish foliage\n for (var ci=-3; ci<=3; ++ci) { \n for (var cj=-3; cj<=3; ++cj) { \n for (var ck=-3; ck<=3; ++ck) {\n var tj = treehi + cj - yoff\n if (ci===0 && ck===0 && cj<0) continue\n if (tj<0 || tj>js) continue\n var rad = ci*ci + cj*cj + ck*ck\n if (rad>15) continue\n if (rad>5) {\n if (rad*hash(x+z+tj,ci,ck,cj) < 6) continue\n }\n chunk.set( i+ci, tj, k+ck, leafID );\n }\n }\n }\n}", "function Tree(opts) {\n\t\tif (opts.Xml) {\n\t\t\tvar allNodesArray = opts.Xml;\n\t\t\tvar rootNodeId = opts.RootId;\n\t\t\n\t\t\tthis.rootNode = new TreeNode({\"XML\": allNodesArray, \"RootId\": rootNodeId, \"Tree\": this});\n\t\t\tthis.highestId = Math.max.apply(Math, allNodesArray.map(function(o) { return o.id;}));\n\t\t}\n\t\telse {\n\t\t\tthis.rootNode = new TreeNode({\"SingleId\": 1});\n\t\t\tthis.highestId = 1;\n\t\t}\n\t\n\t\tif (opts.SvgDoc) {\n\t\t\tthis.setSvg(opts.SvgDoc);\n\t\t}\n\t\t{\n\t\t\tswitch (opts.Positioning) {\n\t\t\t\tcase AdHavocBinaryTree.ALGORITHM.LEFT_ALIGNED:\n\t\t\t\t\tthis._setPositioningFunction(this._calculateTreePositionsWithLeftAligned);\n\t\t\t\t\tbreak;\n\t\t\t\tcase AdHavocBinaryTree.ALGORITHM.BALANCED:\n\t\t\t\t\tthis._setPositioningFunction(this._calculateTreePositionsWithBalancedParent);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthis._setPositioningFunction(this._calculateTreePositionsWithFullBalance);\n\t\t\t\t\tbreak;\n\t\t\t}\t\t\t\n\t\t\tthis.recalculatePositions();\n\t\t\tthis.setViewBox();\n\t\t\tthis.drawTree();\n\t\t}\n\t}", "generate() {\r\n const rootNode = new TreeNode(0, null, null)\r\n let parent = rootNode\r\n let cursor = rootNode\r\n $('.readme .markdown-body :header').each((idx, obj) => {\r\n let element = $(obj).get(0)\r\n let tag = element.tagName\r\n // extract header level\r\n let level = /H(\\d)/i.exec(tag)[1]\r\n // extract anchor\r\n let content = {\r\n href: $($(element).children().get(0)).attr('href'),\r\n text: element.innerText\r\n }\r\n // build tree\r\n if (level > cursor.level) {\r\n parent = cursor\r\n } else if (level < cursor.level) {\r\n while (level <= parent.level) {\r\n parent = parent.parent\r\n }\r\n } \r\n let node = new TreeNode(level, content, parent)\r\n parent.addChild(node)\r\n cursor = node\r\n })\r\n return rootNode\r\n }", "function tree() {\n var separation = defaultSeparation,\n dx = 1,\n dy = 1,\n nodeSize = null;\n\n function tree(root) {\n var t = treeRoot(root);\n\n // Compute the layout using Buchheim et al.’s algorithm.\n t.eachAfter(firstWalk), t.parent.m = -t.z;\n t.eachBefore(secondWalk);\n\n // If a fixed node size is specified, scale x and y.\n if (nodeSize) root.eachBefore(sizeNode);\n\n // If a fixed tree size is specified, scale x and y based on the extent.\n // Compute the left-most, right-most, and depth-most nodes for extents.\n else {\n var left = root,\n right = root,\n bottom = root;\n root.eachBefore(function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2,\n tx = s - left.x,\n kx = dx / (right.x + s + tx),\n ky = dy / (bottom.depth || 1);\n root.eachBefore(function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n\n return root;\n }\n\n // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n // applied recursively to the children of v, as well as the function\n // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n // node v is placed to the midpoint of its outermost children.\n function firstWalk(v) {\n var children = v.children,\n siblings = v.parent.children,\n w = v.i ? siblings[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n\n // Computes all real x-coordinates by summing up the modifiers recursively.\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n\n // The core of the algorithm. Here, a new subtree is combined with the\n // previous subtrees. Threads are used to traverse the inside and outside\n // contours of the left and right subtree up to the highest common level. The\n // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n // superscript o means outside and i means inside, the subscript - means left\n // subtree and + means right subtree. For summing up the modifiers along the\n // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n // nodes of the inside contours conflict, we compute the left one of the\n // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n // Finally, we add a new thread (if necessary).\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v,\n vop = v,\n vim = w,\n vom = vip.parent.children[0],\n sip = vip.m,\n sop = vop.m,\n sim = vim.m,\n som = vom.m,\n shift;\n while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n\n tree.separation = function(x) {\n return arguments.length ? (separation = x, tree) : separation;\n };\n\n tree.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n };\n\n tree.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n };\n\n return tree;\n}", "function tree() {\n var separation = defaultSeparation$1,\n dx = 1,\n dy = 1,\n nodeSize = null;\n\n function tree(root) {\n var t = treeRoot(root);\n\n // Compute the layout using Buchheim et al.’s algorithm.\n t.eachAfter(firstWalk), t.parent.m = -t.z;\n t.eachBefore(secondWalk);\n\n // If a fixed node size is specified, scale x and y.\n if (nodeSize) root.eachBefore(sizeNode);\n\n // If a fixed tree size is specified, scale x and y based on the extent.\n // Compute the left-most, right-most, and depth-most nodes for extents.\n else {\n var left = root,\n right = root,\n bottom = root;\n root.eachBefore(function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2,\n tx = s - left.x,\n kx = dx / (right.x + s + tx),\n ky = dy / (bottom.depth || 1);\n root.eachBefore(function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n\n return root;\n }\n\n // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n // applied recursively to the children of v, as well as the function\n // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n // node v is placed to the midpoint of its outermost children.\n function firstWalk(v) {\n var children = v.children,\n siblings = v.parent.children,\n w = v.i ? siblings[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n\n // Computes all real x-coordinates by summing up the modifiers recursively.\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n\n // The core of the algorithm. Here, a new subtree is combined with the\n // previous subtrees. Threads are used to traverse the inside and outside\n // contours of the left and right subtree up to the highest common level. The\n // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n // superscript o means outside and i means inside, the subscript - means left\n // subtree and + means right subtree. For summing up the modifiers along the\n // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n // nodes of the inside contours conflict, we compute the left one of the\n // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n // Finally, we add a new thread (if necessary).\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v,\n vop = v,\n vim = w,\n vom = vip.parent.children[0],\n sip = vip.m,\n sop = vop.m,\n sim = vim.m,\n som = vom.m,\n shift;\n while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n\n tree.separation = function(x) {\n return arguments.length ? (separation = x, tree) : separation;\n };\n\n tree.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n };\n\n tree.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n };\n\n return tree;\n }", "function tree() {\n var separation = defaultSeparation$1,\n dx = 1,\n dy = 1,\n nodeSize = null;\n\n function tree(root) {\n var t = treeRoot(root);\n\n // Compute the layout using Buchheim et al.’s algorithm.\n t.eachAfter(firstWalk), t.parent.m = -t.z;\n t.eachBefore(secondWalk);\n\n // If a fixed node size is specified, scale x and y.\n if (nodeSize) root.eachBefore(sizeNode);\n\n // If a fixed tree size is specified, scale x and y based on the extent.\n // Compute the left-most, right-most, and depth-most nodes for extents.\n else {\n var left = root,\n right = root,\n bottom = root;\n root.eachBefore(function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2,\n tx = s - left.x,\n kx = dx / (right.x + s + tx),\n ky = dy / (bottom.depth || 1);\n root.eachBefore(function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n\n return root;\n }\n\n // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n // applied recursively to the children of v, as well as the function\n // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n // node v is placed to the midpoint of its outermost children.\n function firstWalk(v) {\n var children = v.children,\n siblings = v.parent.children,\n w = v.i ? siblings[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n\n // Computes all real x-coordinates by summing up the modifiers recursively.\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n\n // The core of the algorithm. Here, a new subtree is combined with the\n // previous subtrees. Threads are used to traverse the inside and outside\n // contours of the left and right subtree up to the highest common level. The\n // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n // superscript o means outside and i means inside, the subscript - means left\n // subtree and + means right subtree. For summing up the modifiers along the\n // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n // nodes of the inside contours conflict, we compute the left one of the\n // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n // Finally, we add a new thread (if necessary).\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v,\n vop = v,\n vim = w,\n vom = vip.parent.children[0],\n sip = vip.m,\n sop = vop.m,\n sim = vim.m,\n som = vom.m,\n shift;\n while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n\n tree.separation = function(x) {\n return arguments.length ? (separation = x, tree) : separation;\n };\n\n tree.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n };\n\n tree.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n };\n\n return tree;\n }", "function tree() {\n var separation = defaultSeparation$1, dx = 1, dy = 1, nodeSize = null;\n function tree(root) {\n var t = treeRoot(root);\n // Compute the layout using Buchheim et al.’s algorithm.\n (t.eachAfter(firstWalk), t.parent.m = -t.z);\n t.eachBefore(secondWalk);\n // If a fixed node size is specified, scale x and y.\n if (nodeSize) root.eachBefore(sizeNode); else // If a fixed tree size is specified, scale x and y based on the extent.\n // Compute the left-most, right-most, and depth-most nodes for extents.\n {\n var left = root, right = root, bottom = root;\n root.eachBefore(function (node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2, tx = s - left.x, kx = dx / (right.x + s + tx), ky = dy / (bottom.depth || 1);\n root.eachBefore(function (node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n return root;\n }\n // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n // applied recursively to the children of v, as well as the function\n // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n // node v is placed to the midpoint of its outermost children.\n function firstWalk(v) {\n var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n // Computes all real x-coordinates by summing up the modifiers recursively.\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n // The core of the algorithm. Here, a new subtree is combined with the\n // previous subtrees. Threads are used to traverse the inside and outside\n // contours of the left and right subtree up to the highest common level. The\n // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n // superscript o means outside and i means inside, the subscript - means left\n // subtree and + means right subtree. For summing up the modifiers along the\n // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n // nodes of the inside contours conflict, we compute the left one of the\n // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n // Finally, we add a new thread (if necessary).\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift;\n while ((vim = nextRight(vim), vip = nextLeft(vip), vim && vip)) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n tree.separation = function (x) {\n return arguments.length ? (separation = x, tree) : separation;\n };\n tree.size = function (x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : nodeSize ? null : [dx, dy];\n };\n tree.nodeSize = function (x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : nodeSize ? [dx, dy] : null;\n };\n return tree;\n }", "function tree() {\n\t var separation = defaultSeparation$1,\n\t dx = 1,\n\t dy = 1,\n\t nodeSize = null;\n\t\n\t function tree(root) {\n\t var t = treeRoot(root);\n\t\n\t // Compute the layout using Buchheim et al.’s algorithm.\n\t t.eachAfter(firstWalk), t.parent.m = -t.z;\n\t t.eachBefore(secondWalk);\n\t\n\t // If a fixed node size is specified, scale x and y.\n\t if (nodeSize) root.eachBefore(sizeNode);\n\t\n\t // If a fixed tree size is specified, scale x and y based on the extent.\n\t // Compute the left-most, right-most, and depth-most nodes for extents.\n\t else {\n\t var left = root,\n\t right = root,\n\t bottom = root;\n\t root.eachBefore(function(node) {\n\t if (node.x < left.x) left = node;\n\t if (node.x > right.x) right = node;\n\t if (node.depth > bottom.depth) bottom = node;\n\t });\n\t var s = left === right ? 1 : separation(left, right) / 2,\n\t tx = s - left.x,\n\t kx = dx / (right.x + s + tx),\n\t ky = dy / (bottom.depth || 1);\n\t root.eachBefore(function(node) {\n\t node.x = (node.x + tx) * kx;\n\t node.y = node.depth * ky;\n\t });\n\t }\n\t\n\t return root;\n\t }\n\t\n\t // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n\t // applied recursively to the children of v, as well as the function\n\t // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n\t // node v is placed to the midpoint of its outermost children.\n\t function firstWalk(v) {\n\t var children = v.children,\n\t siblings = v.parent.children,\n\t w = v.i ? siblings[v.i - 1] : null;\n\t if (children) {\n\t executeShifts(v);\n\t var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n\t if (w) {\n\t v.z = w.z + separation(v._, w._);\n\t v.m = v.z - midpoint;\n\t } else {\n\t v.z = midpoint;\n\t }\n\t } else if (w) {\n\t v.z = w.z + separation(v._, w._);\n\t }\n\t v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n\t }\n\t\n\t // Computes all real x-coordinates by summing up the modifiers recursively.\n\t function secondWalk(v) {\n\t v._.x = v.z + v.parent.m;\n\t v.m += v.parent.m;\n\t }\n\t\n\t // The core of the algorithm. Here, a new subtree is combined with the\n\t // previous subtrees. Threads are used to traverse the inside and outside\n\t // contours of the left and right subtree up to the highest common level. The\n\t // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n\t // superscript o means outside and i means inside, the subscript - means left\n\t // subtree and + means right subtree. For summing up the modifiers along the\n\t // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n\t // nodes of the inside contours conflict, we compute the left one of the\n\t // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n\t // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n\t // Finally, we add a new thread (if necessary).\n\t function apportion(v, w, ancestor) {\n\t if (w) {\n\t var vip = v,\n\t vop = v,\n\t vim = w,\n\t vom = vip.parent.children[0],\n\t sip = vip.m,\n\t sop = vop.m,\n\t sim = vim.m,\n\t som = vom.m,\n\t shift;\n\t while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n\t vom = nextLeft(vom);\n\t vop = nextRight(vop);\n\t vop.a = v;\n\t shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n\t if (shift > 0) {\n\t moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n\t sip += shift;\n\t sop += shift;\n\t }\n\t sim += vim.m;\n\t sip += vip.m;\n\t som += vom.m;\n\t sop += vop.m;\n\t }\n\t if (vim && !nextRight(vop)) {\n\t vop.t = vim;\n\t vop.m += sim - sop;\n\t }\n\t if (vip && !nextLeft(vom)) {\n\t vom.t = vip;\n\t vom.m += sip - som;\n\t ancestor = v;\n\t }\n\t }\n\t return ancestor;\n\t }\n\t\n\t function sizeNode(node) {\n\t node.x *= dx;\n\t node.y = node.depth * dy;\n\t }\n\t\n\t tree.separation = function(x) {\n\t return arguments.length ? (separation = x, tree) : separation;\n\t };\n\t\n\t tree.size = function(x) {\n\t return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n\t };\n\t\n\t tree.nodeSize = function(x) {\n\t return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n\t };\n\t\n\t return tree;\n\t }", "function tree() {\n\t var separation = defaultSeparation$1,\n\t dx = 1,\n\t dy = 1,\n\t nodeSize = null;\n\t\n\t function tree(root) {\n\t var t = treeRoot(root);\n\t\n\t // Compute the layout using Buchheim et al.’s algorithm.\n\t t.eachAfter(firstWalk), t.parent.m = -t.z;\n\t t.eachBefore(secondWalk);\n\t\n\t // If a fixed node size is specified, scale x and y.\n\t if (nodeSize) root.eachBefore(sizeNode);\n\t\n\t // If a fixed tree size is specified, scale x and y based on the extent.\n\t // Compute the left-most, right-most, and depth-most nodes for extents.\n\t else {\n\t var left = root,\n\t right = root,\n\t bottom = root;\n\t root.eachBefore(function(node) {\n\t if (node.x < left.x) left = node;\n\t if (node.x > right.x) right = node;\n\t if (node.depth > bottom.depth) bottom = node;\n\t });\n\t var s = left === right ? 1 : separation(left, right) / 2,\n\t tx = s - left.x,\n\t kx = dx / (right.x + s + tx),\n\t ky = dy / (bottom.depth || 1);\n\t root.eachBefore(function(node) {\n\t node.x = (node.x + tx) * kx;\n\t node.y = node.depth * ky;\n\t });\n\t }\n\t\n\t return root;\n\t }\n\t\n\t // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n\t // applied recursively to the children of v, as well as the function\n\t // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n\t // node v is placed to the midpoint of its outermost children.\n\t function firstWalk(v) {\n\t var children = v.children,\n\t siblings = v.parent.children,\n\t w = v.i ? siblings[v.i - 1] : null;\n\t if (children) {\n\t executeShifts(v);\n\t var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n\t if (w) {\n\t v.z = w.z + separation(v._, w._);\n\t v.m = v.z - midpoint;\n\t } else {\n\t v.z = midpoint;\n\t }\n\t } else if (w) {\n\t v.z = w.z + separation(v._, w._);\n\t }\n\t v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n\t }\n\t\n\t // Computes all real x-coordinates by summing up the modifiers recursively.\n\t function secondWalk(v) {\n\t v._.x = v.z + v.parent.m;\n\t v.m += v.parent.m;\n\t }\n\t\n\t // The core of the algorithm. Here, a new subtree is combined with the\n\t // previous subtrees. Threads are used to traverse the inside and outside\n\t // contours of the left and right subtree up to the highest common level. The\n\t // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n\t // superscript o means outside and i means inside, the subscript - means left\n\t // subtree and + means right subtree. For summing up the modifiers along the\n\t // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n\t // nodes of the inside contours conflict, we compute the left one of the\n\t // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n\t // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n\t // Finally, we add a new thread (if necessary).\n\t function apportion(v, w, ancestor) {\n\t if (w) {\n\t var vip = v,\n\t vop = v,\n\t vim = w,\n\t vom = vip.parent.children[0],\n\t sip = vip.m,\n\t sop = vop.m,\n\t sim = vim.m,\n\t som = vom.m,\n\t shift;\n\t while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n\t vom = nextLeft(vom);\n\t vop = nextRight(vop);\n\t vop.a = v;\n\t shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n\t if (shift > 0) {\n\t moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n\t sip += shift;\n\t sop += shift;\n\t }\n\t sim += vim.m;\n\t sip += vip.m;\n\t som += vom.m;\n\t sop += vop.m;\n\t }\n\t if (vim && !nextRight(vop)) {\n\t vop.t = vim;\n\t vop.m += sim - sop;\n\t }\n\t if (vip && !nextLeft(vom)) {\n\t vom.t = vip;\n\t vom.m += sip - som;\n\t ancestor = v;\n\t }\n\t }\n\t return ancestor;\n\t }\n\t\n\t function sizeNode(node) {\n\t node.x *= dx;\n\t node.y = node.depth * dy;\n\t }\n\t\n\t tree.separation = function(x) {\n\t return arguments.length ? (separation = x, tree) : separation;\n\t };\n\t\n\t tree.size = function(x) {\n\t return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n\t };\n\t\n\t tree.nodeSize = function(x) {\n\t return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n\t };\n\t\n\t return tree;\n\t }", "function LeafChunk(lines) {\n\t\t this.lines = lines;\n\t\t this.parent = null;\n\t\t var height = 0;\n\t\t for (var i = 0; i < lines.length; ++i) {\n\t\t lines[i].parent = this;\n\t\t height += lines[i].height;\n\t\t }\n\t\t this.height = height;\n\t\t }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n\n this.height = height;\n }", "static of(text) {\n if (text.length == 0)\n throw new RangeError(\"A document must have at least one line\");\n if (text.length == 1 && !text[0])\n return Text.empty;\n return text.length <= 32 /* Tree.Branch */ ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, e = lines.length, height = 0; i < e; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, e = lines.length, height = 0; i < e; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, e = lines.length, height = 0; i < e; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n\t\t this.lines = lines;\n\t\t this.parent = null;\n\t\t for (var i = 0, height = 0; i < lines.length; ++i) {\n\t\t lines[i].parent = this;\n\t\t height += lines[i].height;\n\t\t }\n\t\t this.height = height;\n\t\t }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }", "function Btnode(val){\n this.val = val;\n this.left = null;\n this.right = null;\n this.parent = null;\n this.height = function(){\n if(this.left){\n var lHeight = this.left.height();\n } else{\n var lHeight = 0;\n }\n if(this.right){\n var rHeight = this.right.height();\n } else{\n var rHeight = 0;\n }\n return 1 + Math.max(lHeight, rHeight);\n }\n}", "function tree() {\n\t var separation = defaultSeparation$1,\n\t dx = 1,\n\t dy = 1,\n\t nodeSize = null;\n\n\t function tree(root) {\n\t var t = treeRoot(root);\n\n\t // Compute the layout using Buchheim et al.’s algorithm.\n\t t.eachAfter(firstWalk), t.parent.m = -t.z;\n\t t.eachBefore(secondWalk);\n\n\t // If a fixed node size is specified, scale x and y.\n\t if (nodeSize) root.eachBefore(sizeNode);\n\n\t // If a fixed tree size is specified, scale x and y based on the extent.\n\t // Compute the left-most, right-most, and depth-most nodes for extents.\n\t else {\n\t var left = root,\n\t right = root,\n\t bottom = root;\n\t root.eachBefore(function(node) {\n\t if (node.x < left.x) left = node;\n\t if (node.x > right.x) right = node;\n\t if (node.depth > bottom.depth) bottom = node;\n\t });\n\t var s = left === right ? 1 : separation(left, right) / 2,\n\t tx = s - left.x,\n\t kx = dx / (right.x + s + tx),\n\t ky = dy / (bottom.depth || 1);\n\t root.eachBefore(function(node) {\n\t node.x = (node.x + tx) * kx;\n\t node.y = node.depth * ky;\n\t });\n\t }\n\n\t return root;\n\t }\n\n\t // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n\t // applied recursively to the children of v, as well as the function\n\t // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n\t // node v is placed to the midpoint of its outermost children.\n\t function firstWalk(v) {\n\t var children = v.children,\n\t siblings = v.parent.children,\n\t w = v.i ? siblings[v.i - 1] : null;\n\t if (children) {\n\t executeShifts(v);\n\t var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n\t if (w) {\n\t v.z = w.z + separation(v._, w._);\n\t v.m = v.z - midpoint;\n\t } else {\n\t v.z = midpoint;\n\t }\n\t } else if (w) {\n\t v.z = w.z + separation(v._, w._);\n\t }\n\t v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n\t }\n\n\t // Computes all real x-coordinates by summing up the modifiers recursively.\n\t function secondWalk(v) {\n\t v._.x = v.z + v.parent.m;\n\t v.m += v.parent.m;\n\t }\n\n\t // The core of the algorithm. Here, a new subtree is combined with the\n\t // previous subtrees. Threads are used to traverse the inside and outside\n\t // contours of the left and right subtree up to the highest common level. The\n\t // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n\t // superscript o means outside and i means inside, the subscript - means left\n\t // subtree and + means right subtree. For summing up the modifiers along the\n\t // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n\t // nodes of the inside contours conflict, we compute the left one of the\n\t // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n\t // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n\t // Finally, we add a new thread (if necessary).\n\t function apportion(v, w, ancestor) {\n\t if (w) {\n\t var vip = v,\n\t vop = v,\n\t vim = w,\n\t vom = vip.parent.children[0],\n\t sip = vip.m,\n\t sop = vop.m,\n\t sim = vim.m,\n\t som = vom.m,\n\t shift;\n\t while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n\t vom = nextLeft(vom);\n\t vop = nextRight(vop);\n\t vop.a = v;\n\t shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n\t if (shift > 0) {\n\t moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n\t sip += shift;\n\t sop += shift;\n\t }\n\t sim += vim.m;\n\t sip += vip.m;\n\t som += vom.m;\n\t sop += vop.m;\n\t }\n\t if (vim && !nextRight(vop)) {\n\t vop.t = vim;\n\t vop.m += sim - sop;\n\t }\n\t if (vip && !nextLeft(vom)) {\n\t vom.t = vip;\n\t vom.m += sip - som;\n\t ancestor = v;\n\t }\n\t }\n\t return ancestor;\n\t }\n\n\t function sizeNode(node) {\n\t node.x *= dx;\n\t node.y = node.depth * dy;\n\t }\n\n\t tree.separation = function(x) {\n\t return arguments.length ? (separation = x, tree) : separation;\n\t };\n\n\t tree.size = function(x) {\n\t return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n\t };\n\n\t tree.nodeSize = function(x) {\n\t return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n\t };\n\n\t return tree;\n\t }", "function BNode() {\n\t/**\n\t * The keys stored it the node.\n\t * @type {Array<*>}\n\t */\n\tthis.keys = [];\n\t/**\n\t * The items stored in the node.\n\t * @type {Array<*>}\n\t */\n\tthis.items = [];\n\t/**\n\t * The nodes child of the node.\n\t * @type {Array<BNode>}\n\t */\n\tthis.childs = [];\n}", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines\n this.parent = null\n var height = 0\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1\n height += lines[i].height\n }\n this.height = height\n}", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n}", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n}", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n}", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n}", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n}", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n}", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n}", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n}", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n}", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n}", "function LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n}", "function LeafChunk(lines) {\r\n this.lines = lines;\r\n this.parent = null;\r\n for (var i = 0, height = 0; i < lines.length; ++i) {\r\n lines[i].parent = this;\r\n height += lines[i].height;\r\n }\r\n this.height = height;\r\n }", "calcOctree ()\n\t{\n\t\tif (this.octr) return this.octr;\n\n\t\t// Bounding box is the cube itself\n\t\tvar bBox = new Utils.BoundingBox (this.center, this._edge);\n\t\t// var bBox = Utils.BoundingBox (this.center, this._edge);\n\n\t\t// Only the root node completely filled\n\t\t// no parent, cube bounding box, filled, no kids\n\t\tthis.octr = new Octree.Node(null, bBox, Octree.BLACK, []);\n\t\treturn this.octr;\n\t}", "height() {\n return this.heightVisitor(this.root)\n }", "function LeafChunk(lines) {\n\t this.lines = lines;\n\t this.parent = null;\n\t for (var i = 0, height = 0; i < lines.length; ++i) {\n\t lines[i].parent = this;\n\t height += lines[i].height;\n\t }\n\t this.height = height;\n\t }", "function LeafChunk(lines) {\n\t this.lines = lines;\n\t this.parent = null;\n\t for (var i = 0, height = 0; i < lines.length; ++i) {\n\t lines[i].parent = this;\n\t height += lines[i].height;\n\t }\n\t this.height = height;\n\t }", "function LeafChunk(lines) {\n\t this.lines = lines;\n\t this.parent = null;\n\t for (var i = 0, height = 0; i < lines.length; ++i) {\n\t lines[i].parent = this;\n\t height += lines[i].height;\n\t }\n\t this.height = height;\n\t }", "function TreeNode(name, file, line, parent_ref = undefined) {\n this.count = 0;\n this.child_count = 0;\n if (parent_ref) {\n this.parent_ref = parent_ref;\n parent_ref.children.push(this);\n } else {\n this.parent_ref = undefined;\n }\n this.children = [];\n this.file = file;\n this.name = name;\n this.line = line;\n this.colour = colours[0];\n this.width = 0;\n this.x_pos = 0;\n this.depth = (parent_ref === undefined) ? 0 : parent_ref.depth + 1;\n this.selected = false;\n this.addTicks = function(ticks) {\n this.count += ticks;\n let next_parent = this.parent_ref;\n while (next_parent) {\n next_parent.child_count += ticks;\n next_parent = next_parent.parent_ref;\n }\n };\n all_tree_nodes.push(this);\n max_depth = Math.max(max_depth, this.depth);\n}", "GetTreeHeight() {\n return this.m_contactManager.m_broadPhase.GetTreeHeight();\n }", "static process_lines(lines)\r\n {\r\n if (DEBUG) console.log(`Processing ${lines.length} lines`);\r\n let doc = new Document();\r\n let definition = null;\r\n // Lists\r\n let actual_list = null;\r\n let actual_level = 0;\r\n // Main loop\r\n for (const [index, line] of lines.entries())\r\n {\r\n let text = undefined;\r\n let id = undefined;\r\n let value = undefined;\r\n // List\r\n if (actual_list !== null && line.type !== 'unordered_list'\r\n && line.type !== 'ordered_list'\r\n && line.type !== 'reverse_list')\r\n {\r\n doc.add_node(actual_list.root());\r\n actual_list = null;\r\n actual_level = 0;\r\n }\r\n let elem_is_unordered = false;\r\n let elem_is_ordered = false;\r\n let elem_is_reverse = false;\r\n switch (line.type)\r\n {\r\n case 'title':\r\n let lvl = 0;\r\n for (const char of line.value)\r\n {\r\n if (char === '#')\r\n {\r\n lvl += 1;\r\n }\r\n else\r\n {\r\n break;\r\n }\r\n }\r\n text = line.value.substring(lvl).trim();\r\n doc.add_node(new Title(doc, text, lvl));\r\n doc.add_label(doc.make_anchor(text), '#' + doc.make_anchor(text));\r\n break;\r\n case 'separator':\r\n doc.add_node(new HR(doc));\r\n break;\r\n case 'text':\r\n if (line.value.trim().startsWith('\\\\* ')) line.value = line.value.trim().substring(1);\r\n let n = Hamill.process_inner_string(doc, line.value);\r\n doc.add_node(new TextLine(doc, n));\r\n break;\r\n case 'unordered_list':\r\n elem_is_unordered = true;\r\n if (actual_list === null)\r\n {\r\n actual_list = new List(doc, null, false, false);\r\n actual_level = 1;\r\n }\r\n // next\r\n case 'ordered_list':\r\n if (line.type === 'ordered_list') elem_is_ordered = true;\r\n if (actual_list === null)\r\n {\r\n actual_list = new List(doc, null, true, false);\r\n actual_level = 1;\r\n }\r\n // next\r\n case 'reverse_list':\r\n if (line.type === 'reverse_list') elem_is_reverse = true;\r\n if (actual_list === null)\r\n {\r\n actual_list = new List(doc, null, true, true);\r\n actual_level = 1;\r\n }\r\n // common code\r\n // compute item level\r\n let delimiters = {'unordered_list': '* ', 'ordered_list': '+ ', 'reverse_list': '- '};\r\n let delimiter = delimiters[line.type];\r\n let list_level = Math.floor(line.value.indexOf(delimiter) / 2) + 1;\r\n // coherency\r\n if (list_level === actual_level)\r\n {\r\n if ((elem_is_unordered && (actual_list.ordered || actual_list.reverse))\r\n || (elem_is_ordered && !actual_list.ordered)\r\n || (elem_is_reverse && !actual_list.reverse))\r\n {\r\n throw new Error(`Incoherency with previous item ${actual_level} at this level ${list_level}: ul:${elem_is_unordered} ol:${elem_is_unordered} r:${elem_is_reverse} vs o:${actual_list.ordered} r:${actual_list.reverse}`);\r\n }\r\n }\r\n while (list_level > actual_level)\r\n {\r\n let last = actual_list.pop(); // get and remove the last item\r\n let c = new Composite(doc, actual_list); // create a new composite\r\n c.add_child(last); // put the old last item in it\r\n actual_list = actual_list.add_child(c); // link the new composite to the list\r\n let sub = new List(doc, c, elem_is_ordered, elem_is_reverse); // create a new list\r\n actual_list = actual_list.add_child(sub);\r\n actual_level += 1;\r\n }\r\n while (list_level < actual_level)\r\n {\r\n actual_list = actual_list.parent();\r\n actual_level -= 1;\r\n if (! actual_list instanceof List)\r\n {\r\n throw new Error(\"List incoherency: last element is not a list.\");\r\n }\r\n }\r\n // creation\r\n let item_text = line.value.substring(line.value.indexOf(delimiter) + 2).trim();\r\n let item_nodes = Hamill.process_inner_string(doc, item_text);\r\n actual_list.add_child(new TextLine(doc, item_nodes));\r\n break;\r\n case 'html':\r\n doc.add_node(new RawHTML(doc, line.value.replace('!html ', '').trim()));\r\n break;\r\n case 'css':\r\n text = line.value.replace('!css ', '').trim();\r\n doc.add_css(text);\r\n break;\r\n case 'include':\r\n let include = line.value.replace('!include ', '').trim();\r\n doc.add_node(new Include(doc, include));\r\n break;\r\n case 'require':\r\n text = line.value.replace('!require ', '').trim();\r\n doc.add_required(text);\r\n break;\r\n case 'const':\r\n text = line.value.replace('!const ', '').split('=');\r\n id = text[0].trim();\r\n value = text[1].trim();\r\n doc.set_variable(id, value, 'string', true);\r\n break;\r\n case 'var':\r\n text = line.value.replace('!var ', '').split('=');\r\n id = text[0].trim();\r\n value = text[1].trim();\r\n if (value === 'true') value = true;\r\n if (value === 'TRUE') value = true;\r\n if (value === 'false') value = false;\r\n if (value === 'FALSE') value = false;\r\n let type = 'string';\r\n if (typeof value === 'boolean')\r\n {\r\n type = 'boolean';\r\n }\r\n doc.add_node(new SetVar(doc, id, value, type, false));\r\n break;\r\n case 'label':\r\n value = line.value.replace(/::/, '').trim();\r\n text = value.split('::');\r\n let label = text[0].trim();\r\n let url = text[1].trim();\r\n doc.add_label(label, url);\r\n break;\r\n case 'div':\r\n value = line.value.substring(2, line.value.length - 2).trim();\r\n let res = Hamill.process_inner_markup(value);\r\n if (res['has_only_text'] && res['text'] === 'end')\r\n {\r\n doc.add_node(new EndDiv(doc));\r\n }\r\n else if (res['has_only_text'] && res['text'] === 'begin')\r\n {\r\n doc.add_node(new StartDiv(doc));\r\n }\r\n else if (res['has_only_text'])\r\n {\r\n console.log(res);\r\n throw new Error(`Unknown quick markup: ${res['text']} in ${line}`);\r\n }\r\n else\r\n {\r\n doc.add_node(new StartDiv(doc, res['id'], res['class']));\r\n }\r\n break;\r\n case 'comment':\r\n doc.add_node(new Comment(doc, line.value.substring(2)));\r\n break;\r\n case 'row':\r\n let content = line.value.substring(1, line.value.length - 1);\r\n if (content.length === (content.match(/(-|\\|)/g) || []).length)\r\n {\r\n let i = doc.nodes.length - 1;\r\n while (doc.get_node(i) instanceof Row)\r\n {\r\n doc.get_node(i).is_header = true;\r\n i -= 1;\r\n }\r\n }\r\n else\r\n {\r\n let parts = content.split('|'); // Handle escape\r\n let all_nodes = [];\r\n for (let p of parts)\r\n {\r\n let nodes = Hamill.process_inner_string(doc, p);\r\n all_nodes.push(nodes);\r\n }\r\n doc.add_node(new Row(doc, all_nodes));\r\n }\r\n break;\r\n case 'empty':\r\n doc.add_node(new EmptyNode(doc));\r\n break;\r\n case 'definition-header':\r\n definition = Hamill.process_inner_string(doc, line.value);\r\n break;\r\n case 'definition-content':\r\n if (definition === null)\r\n {\r\n throw new Error('Definition content without header: ' + line.value);\r\n }\r\n doc.add_node(new Definition(doc, definition, Hamill.process_inner_string(doc, line.value)));\r\n definition = null;\r\n break;\r\n case 'quote':\r\n doc.add_node(new Quote(doc, line.value));\r\n break;\r\n case 'code':\r\n doc.add_node(new Code(doc, line.value));\r\n break;\r\n default:\r\n throw new Error(`Unknown ${line.type}`);\r\n }\r\n }\r\n // List\r\n if (actual_list !== null)\r\n {\r\n doc.add_node(actual_list.root());\r\n }\r\n return doc;\r\n }", "function treeFromLines(lines: string[]): tree.Node {\n const data: Array<[string, number]> = [];\n for (const line of lines) {\n let [sizeStr, path] = line.split(/\\s+/);\n path = path || '';\n const size = Number(sizeStr);\n data.push([path, size]);\n }\n let node = tree.treeify(data);\n\n // If there's a common empty parent, skip it.\n if (node.id === undefined && node.children && node.children.length === 1) {\n node = node.children[0];\n }\n\n // If there's an empty parent, roll up for it.\n if (node.size === 0 && node.children) {\n for (const c of node.children) {\n node.size += c.size;\n }\n }\n\n tree.rollup(node);\n tree.sort(node);\n tree.flatten(node);\n\n return node;\n}", "function AbstractTree() {\n\n\tthis.root = null;\n\tthis.cur = null;\n\n\t// Add a node: kind = [branch|leaf]\n\tthis.addNode = function(token, kind) {\n\n\t\t// Construct the node object\n\t\tvar node = new Node(token, this.cur);\n\n\t\t// if there are no nodes in the tree yet, start the tree here\n\t\tif(!this.cur) {\n\t\t\tthis.cur = node;\n\n\t\t// otherwise, add this node to the children array\n\t\t} else {\n\t\t\tthis.cur.addChild(node);\n\t\t}\n\n\t\t// if we are an interior/branch node, then update the current node to be this node\n\t\tif (kind === \"branch\") {\n\t\t\tthis.cur = node;\n\t\t}\n\n\t\t// if this node is the super root, set it as the root of the tree\n\t\tif(token === \"Super Root\") {\n\t\t\tthis.root = node;\n\t\t}\n\n\t\toutVerbose(parseTabs() + \"Added node -> \" + node.toString());\n\n\t};\n\n\tthis.startBranch = function(branchName) {\n\t\tthis.addNode(branchName, \"branch\");\n\n\t\tif((typeof branchName === \"object\") && !isNaN(branchName.type)) {\n\t\t\tif(branchName.value) {\n\t\t\t\tbranchName = getTokenType(branchName.type) + \" \" + branchName.value;\n\t\t\t} else {\n\t\t\t\tbranchName = getTokenType(branchName.type);\n\t\t\t}\n\t\t}\n\n\t\toutVerbose(parseTabs() + \"Creating \" + branchName + \" branch\");\n\t\tnumTabs++;\n\t};\n\n\tthis.endBranch = function() {\n\n\t\t// if the current node has a parent (i.e. is NOT the superRoot)\n\t\tif(this.cur.parent) {\n\n\t\t\t// move the current node up to this node's parent\n\t\t\tthis.cur = this.cur.parent;\n\n\t\t// otherwise, we have a problem\n\t\t} else {\n\t\t\toutError(\"ERROR: can't end branch because parent does not exist.\");\n\t\t}\n\n\t\tnumTabs--;\n\n\t};\n\n\tthis.traverseTree = function(treeRoot) {\n\n\t\t// if token type is a number\n\t\tif(!isNaN(treeRoot.token.type)) {\n\t\t\tthis.addNode(treeRoot.token, \"leaf\");\n\t\t\treturn;\n\t\t}\n\n\t\tswitch(treeRoot.token) {\n\n\t\t\tcase \"Statement\":\n\n\t\t\t\t// print statement\n\t\t\t\tif(treeRoot.children[0].token.type === T_TYPE.PRINT) {\n\t\t\t\t\tthis.startBranch(\"print\");\n\t\t\t\t\tthis.traverseTree(treeRoot.children[2]);\n\t\t\t\t\tthis.endBranch();\n\t\t\t\t}\n\n\t\t\t\t// assignment statement\n\t\t\t\telse if(treeRoot.children[1] && treeRoot.children[1].token.type === T_TYPE.EQUAL) {\n\t\t\t\t\tthis.startBranch(\"assign\");\n\t\t\t\t\tthis.addNode(treeRoot.children[0].token, \"leaf\");\n\t\t\t\t\tthis.traverseTree(treeRoot.children[2]);\n\t\t\t\t\tthis.endBranch();\n\t\t\t\t}\n\n\t\t\t\t// block\n\t\t\t\telse if(treeRoot.children[0] && treeRoot.children[0].token.type === T_TYPE.BRACE) {\n\t\t\t\t\tthis.startBranch(\"block\");\n\t\t\t\t\t// ignore } if it's the next node\n\t\t\t\t\tif(treeRoot.children[1].token.type !== T_TYPE.BRACE && treeRoot.children[1].token.value !== \"}\") {\n\t\t\t\t\t\tthis.traverseTree(treeRoot.children[1]);\n\t\t\t\t\t}\n\t\t\t\t\tthis.endBranch();\n\t\t\t\t}\n\n\t\t\t\t// otherwise (VarDecl)\n\t\t\t\telse if(treeRoot.children[0]) {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[0]);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase \"IfStatement\":\n\t\t\t\tthis.startBranch(\"if\");\n\n\t\t\t\t// BooleanExpr\n\t\t\t\tthis.traverseTree(treeRoot.children[1]);\n\n\t\t\t\t// block\n\t\t\t\tthis.startBranch(\"block\");\n\t\t\t\t// ignore } if it's the next node\n\t\t\t\tif(treeRoot.children[3].token.type !== T_TYPE.BRACE && treeRoot.children[3].token.value !== \"}\") {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[3]);\n\t\t\t\t}\n\t\t\t\tthis.endBranch();\n\n\t\t\t\tthis.endBranch();\n\t\t\t\tbreak;\n\n\t\t\tcase \"WhileStatement\":\n\t\t\t\tthis.startBranch(\"while\");\n\n\t\t\t\t// BooleanExpr\n\t\t\t\tthis.traverseTree(treeRoot.children[1]);\n\n\t\t\t\t// block\n\t\t\t\tthis.startBranch(\"block\");\n\t\t\t\t// ignore } if it's the next node\n\t\t\t\tif(treeRoot.children[3].token.type !== T_TYPE.BRACE && treeRoot.children[3].token.value !== \"}\") {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[3]);\n\t\t\t\t}\n\t\t\t\tthis.endBranch();\n\n\t\t\t\tthis.endBranch();\n\t\t\t\tbreak;\n\n\t\t\tcase \"StatementList\":\n\t\t\t\tif(treeRoot.children[0]) {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[0]);\n\t\t\t\t}\n\t\t\t\tif(treeRoot.children[1]) {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[1]);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase \"IntExpr\":\n\t\t\t\tif(treeRoot.children[1]) {\n\t\t\t\t\tthis.startBranch(treeRoot.children[1].token); // use operation as branch root\n\t\t\t\t\tthis.traverseTree(treeRoot.children[0]);\n\t\t\t\t\tthis.traverseTree(treeRoot.children[2]);\n\t\t\t\t\tthis.endBranch();\n\t\t\t\t} else {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[0]);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase \"StringExpr\":\n\t\t\t\tthis.startBranch(\"string\");\n\t\t\t\tthis.traverseTree(treeRoot.children[1]);\n\t\t\t\tthis.endBranch();\n\t\t\t\tbreak;\n\n\t\t\tcase \"BooleanExpr\":\n\t\t\t\tif(treeRoot.children[1]) {\n\t\t\t\t\tthis.startBranch(\"equal?\");\n\t\t\t\t\tthis.traverseTree(treeRoot.children[1]);\n\t\t\t\t\tthis.traverseTree(treeRoot.children[3]);\n\t\t\t\t\tthis.endBranch();\n\t\t\t\t} else {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[0]);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase \"CharList\":\n\t\t\t\tthis.traverseTree(treeRoot.children[0]);\n\t\t\t\tif(treeRoot.children[1]) {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[1]);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase \"VarDecl\":\n\t\t\t\tthis.startBranch(\"declare\");\n\t\t\t\tthis.addNode(treeRoot.children[0].token, \"leaf\"); // Type\n\t\t\t\tthis.addNode(treeRoot.children[1].token, \"leaf\"); // Id\n\t\t\t\tthis.endBranch();\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tif(treeRoot.children[0]) {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[0]);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t}\n\n\t};\n\n\tthis.addNode(\"Super Root\", \"branch\");\n\tthis.traverseTree(parseTree.root);\n\n}", "function LeafChunk(lines) {\r\n var this$1 = this;\r\n\r\n this.lines = lines;\r\n this.parent = null;\r\n var height = 0;\r\n for (var i = 0; i < lines.length; ++i) {\r\n lines[i].parent = this$1;\r\n height += lines[i].height;\r\n }\r\n this.height = height;\r\n}", "function Octree(c, r, curr_level){\n\n this.center = c;\n this.radius = r;\n\n this.level = curr_level;\n this.atom_IDS = [];\n this.max_level = 0;\n this.array_index = -1;\n this.parent = null;\n this.childs = [null, null, null, null, null, null, null, null];\n\n this.getParent = function(){\n return this.parent;\n }\n this.getChild = function(index){\n if(index>=8)\n return null;\n return this.childs[index];\n }\n this.getMax = function(){\n return [this.center[0] + this.radius[0], this.center[1] + this.radius[1], this.center[2] + this.radius[2]];\n }\n this.getMin = function(){\n return [this.center[0] - this.radius[0], this.center[1] - this.radius[1], this.center[2] - this.radius[2]];;\n }\n this.getLevel = function(){\n return this.level;\n }\n this.getArr_Index = function(){\n return this.array_index;\n }\n}", "function documentFragment(children) {\n this.children = children || [];\n this.height = 0;\n this.depth = 0;\n this.maxFontSize = 0;\n}", "function ye(e){e=de(e);for(var t=0,a=e.parent,n=0;n<a.lines.length;++n){var r=a.lines[n];if(r==e)break;t+=r.height}for(var f=a.parent;f;a=f,f=a.parent)for(var o=0;o<f.children.length;++o){var i=f.children[o];if(i==a)break;t+=i.height}return t}", "heightOfTree(root) {\n if (root === null) {\n return 0;\n }\n let leftHeight = this.heightOfTree(root.left);\n let rightHeight = this.heightOfTree(root.right);\n return 1 + Math.max(leftHeight, rightHeight)\n\n }", "function DocumentFragment(children) {\n this.children = void 0;\n this.classes = void 0;\n this.height = void 0;\n this.depth = void 0;\n this.maxFontSize = void 0;\n this.style = void 0;\n this.children = children;\n this.classes = [];\n this.height = 0;\n this.depth = 0;\n this.maxFontSize = 0;\n this.style = {};\n }", "function DocumentFragment(children) {\n this.children = void 0;\n this.classes = void 0;\n this.height = void 0;\n this.depth = void 0;\n this.maxFontSize = void 0;\n this.style = void 0;\n this.children = children;\n this.classes = [];\n this.height = 0;\n this.depth = 0;\n this.maxFontSize = 0;\n this.style = {};\n }", "function DocumentFragment(children) {\n this.children = void 0;\n this.classes = void 0;\n this.height = void 0;\n this.depth = void 0;\n this.maxFontSize = void 0;\n this.style = void 0;\n this.children = children;\n this.classes = [];\n this.height = 0;\n this.depth = 0;\n this.maxFontSize = 0;\n this.style = {};\n }", "function genTreeText(aT, aProcess)\n{\n var treeBytes = aT._amount;\n var rootStringLength = aT.toString().length;\n var isExplicitTree = aT._name == 'explicit';\n\n /**\n * Generates the text for a particular tree, without a heading.\n *\n * @param aT\n * The tree.\n * @param aIndentGuide\n * Records what indentation is required for this tree. It has one\n * entry per level of indentation. For each entry, ._isLastKid\n * records whether the node in question is the last child, and\n * ._depth records how many chars of indentation are required.\n * @param aParentStringLength\n * The length of the formatted byte count of the top node in the tree.\n * @return The generated text.\n */\n function genTreeText2(aT, aIndentGuide, aParentStringLength)\n {\n function repeatStr(aC, aN)\n {\n var s = \"\";\n for (var i = 0; i < aN; i++) {\n s += aC;\n }\n return s;\n }\n\n // Generate the indent. There's a subset of the Unicode \"light\"\n // box-drawing chars that are widely implemented in terminals, and\n // this code sticks to that subset to maximize the chance that\n // cutting and pasting about:memory output to a terminal will work\n // correctly:\n const kHorizontal = \"\\u2500\",\n kVertical = \"\\u2502\",\n kUpAndRight = \"\\u2514\",\n kVerticalAndRight = \"\\u251c\";\n var indent = \"<span class='treeLine'>\";\n if (aIndentGuide.length > 0) {\n for (var i = 0; i < aIndentGuide.length - 1; i++) {\n indent += aIndentGuide[i]._isLastKid ? \" \" : kVertical;\n indent += repeatStr(\" \", aIndentGuide[i]._depth - 1);\n }\n indent += aIndentGuide[i]._isLastKid ? kUpAndRight : kVerticalAndRight;\n indent += repeatStr(kHorizontal, aIndentGuide[i]._depth - 1);\n }\n\n // Indent more if this entry is narrower than its parent, and update\n // aIndentGuide accordingly.\n var tString = aT.toString();\n var extraIndentLength = Math.max(aParentStringLength - tString.length, 0);\n if (extraIndentLength > 0) {\n for (var i = 0; i < extraIndentLength; i++) {\n indent += kHorizontal;\n }\n aIndentGuide[aIndentGuide.length - 1]._depth += extraIndentLength;\n }\n indent += \"</span>\";\n\n // Generate the percentage.\n var perc = \"\";\n if (aT._amount === treeBytes) {\n perc = \"100.0\";\n } else {\n perc = (100 * aT._amount / treeBytes).toFixed(2);\n perc = pad(perc, 5, '0');\n }\n perc = \"<span class='mrPerc'>(\" + perc + \"%)</span> \";\n\n // We don't want to show '(nonheap)' on a tree like 'map/vsize', since the\n // whole tree is non-heap.\n var kind = isExplicitTree ? aT._kind : undefined;\n var text = indent + genMrValueText(tString) + \" \" + perc +\n genMrNameText(kind, aT._description, aT._name,\n aT._hasProblem, aT._nMerged);\n\n for (var i = 0; i < aT._kids.length; i++) {\n // 3 is the standard depth, the callee adjusts it if necessary.\n aIndentGuide.push({ _isLastKid: (i === aT._kids.length - 1), _depth: 3 });\n text += genTreeText2(aT._kids[i], aIndentGuide, tString.length);\n aIndentGuide.pop();\n }\n return text;\n }\n\n var text = genTreeText2(aT, [], rootStringLength);\n\n // The explicit tree is not collapsed, but all other trees are, so pass\n // !isExplicitTree for genSectionMarkup's aCollapsed parameter.\n return genSectionMarkup(aProcess, aT._name, text, !isExplicitTree);\n}", "function tree (treeBuild) {\n\tnumberChars = 1;\n\tvar spacesForTree = treeBuild.height - 1;\n\t\t// width of tree \"box\" = (height * 2) - 1\n\tfor (var i = 0; i < treeBuild.height; i++) {\n\t\taddBlanks(spacesForTree);\n\t\taddChars(treeBuild.char);\n\t\tprintTree();\n\t\tspacesForTree--;\n\t}\n}", "function BinaryTree() {\n this._root = null;\n}", "function lineAtHeight(chunk, h) {\n\t\t var n = chunk.first;\n\t\t outer: do {\n\t\t for (var i = 0; i < chunk.children.length; ++i) {\n\t\t var child = chunk.children[i], ch = child.height;\n\t\t if (h < ch) { chunk = child; continue outer; }\n\t\t h -= ch;\n\t\t n += child.chunkSize();\n\t\t }\n\t\t return n;\n\t\t } while (!chunk.lines);\n\t\t for (var i = 0; i < chunk.lines.length; ++i) {\n\t\t var line = chunk.lines[i], lh = line.height;\n\t\t if (h < lh) break;\n\t\t h -= lh;\n\t\t }\n\t\t return n + i;\n\t\t }", "function OBJECT_FOR_TREE(id) {\n this.id = id || 0;\n this.cell = this.obj = this.pre = this.next = null;\n }", "function BinarySearchTree() {\n /**\n * Pointer to root node in the tree.\n * @property _root\n * @type Object\n */\n this._root = null;\n}", "function getLine(doc, n) {\n n -= doc.first;\n if (n < 0 || n >= doc.size) throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\");\n for (var chunk = doc; !chunk.lines;) {\n for (var i = 0;; ++i) {\n var child = chunk.children[i], sz = child.chunkSize();\n if (n < sz) { chunk = child; break; }\n n -= sz;\n }\n }\n return chunk.lines[n];\n }", "function getLine(doc, n) {\n n -= doc.first;\n if (n < 0 || n >= doc.size) throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\");\n for (var chunk = doc; !chunk.lines;) {\n for (var i = 0;; ++i) {\n var child = chunk.children[i], sz = child.chunkSize();\n if (n < sz) { chunk = child; break; }\n n -= sz;\n }\n }\n return chunk.lines[n];\n }", "function getLine(doc, n) {\n n -= doc.first;\n if (n < 0 || n >= doc.size) throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\");\n for (var chunk = doc; !chunk.lines;) {\n for (var i = 0;; ++i) {\n var child = chunk.children[i], sz = child.chunkSize();\n if (n < sz) { chunk = child; break; }\n n -= sz;\n }\n }\n return chunk.lines[n];\n }", "function getLine(doc, n) {\n n -= doc.first;\n if (n < 0 || n >= doc.size) throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\");\n for (var chunk = doc; !chunk.lines;) {\n for (var i = 0;; ++i) {\n var child = chunk.children[i], sz = child.chunkSize();\n if (n < sz) { chunk = child; break; }\n n -= sz;\n }\n }\n return chunk.lines[n];\n }", "function getLine(doc, n) {\n n -= doc.first;\n if (n < 0 || n >= doc.size) throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\");\n for (var chunk = doc; !chunk.lines;) {\n for (var i = 0;; ++i) {\n var child = chunk.children[i], sz = child.chunkSize();\n if (n < sz) { chunk = child; break; }\n n -= sz;\n }\n }\n return chunk.lines[n];\n }", "function getLine(doc, n) {\n n -= doc.first;\n if (n < 0 || n >= doc.size) throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\");\n for (var chunk = doc; !chunk.lines;) {\n for (var i = 0;; ++i) {\n var child = chunk.children[i], sz = child.chunkSize();\n if (n < sz) { chunk = child; break; }\n n -= sz;\n }\n }\n return chunk.lines[n];\n }", "function getLine(doc, n) {\n n -= doc.first;\n if (n < 0 || n >= doc.size) throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\");\n for (var chunk = doc; !chunk.lines;) {\n for (var i = 0;; ++i) {\n var child = chunk.children[i], sz = child.chunkSize();\n if (n < sz) { chunk = child; break; }\n n -= sz;\n }\n }\n return chunk.lines[n];\n }", "function DocumentNode(body, loc) {\n this.type = \"Document\";\n this.body = body;\n this.loc = loc;\n }", "function FBXTree() {}", "function FBXTree() {}", "function DocumentNode(body, loc) {\n this.type = \"Document\";\n this.body = body;\n this.loc = loc;\n}" ]
[ "0.56859744", "0.54539", "0.54539", "0.53151244", "0.5282311", "0.5281514", "0.5276573", "0.52501154", "0.52340657", "0.5199419", "0.51836556", "0.51800025", "0.5177543", "0.51744926", "0.5172286", "0.5172286", "0.5167587", "0.5155838", "0.5155838", "0.5152973", "0.5139416", "0.5139416", "0.5139416", "0.5139416", "0.5139416", "0.5139416", "0.5139416", "0.5139416", "0.5135997", "0.51156497", "0.5082578", "0.5082578", "0.5082578", "0.50764745", "0.5073324", "0.5073324", "0.5073324", "0.5073324", "0.5073324", "0.5073324", "0.5073324", "0.5049358", "0.5043078", "0.50348234", "0.5019129", "0.4996637", "0.4996637", "0.4996637", "0.4996637", "0.4996637", "0.4996637", "0.4996637", "0.4996637", "0.4996637", "0.4996637", "0.4996637", "0.4990266", "0.49879286", "0.4987875", "0.49847078", "0.49847078", "0.49847078", "0.49839747", "0.4977426", "0.49611366", "0.4960452", "0.4955176", "0.49550855", "0.4937938", "0.49360508", "0.4931158", "0.48963207", "0.48951742", "0.48951742", "0.48951742", "0.4892705", "0.48747474", "0.48553", "0.48433664", "0.48334238", "0.4832326", "0.48199043", "0.48199043", "0.48199043", "0.48199043", "0.48199043", "0.48199043", "0.48199043", "0.48167625", "0.4812375", "0.4812375", "0.48058718" ]
0.5045281
49
Create a marker, wire it up to the right lines, and
function markText(doc, from, to, options, type) { // Shared markers (across linked documents) are handled separately // (markTextShared will call out to this again, once per // document). if (options && options.shared) { return markTextShared(doc, from, to, options, type) } // Ensure we are in an operation. if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) } var marker = new TextMarker(doc, type), diff = cmp(from, to); if (options) { copyObj(options, marker, false); } // Don't connect empty markers unless clearWhenEmpty is false if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false) { return marker } if (marker.replacedWith) { // Showing up as a widget implies collapsed (widget replaces text) marker.collapsed = true; marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget"); if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); } if (options.insertLeft) { marker.widgetNode.insertLeft = true; } } if (marker.collapsed) { if (conflictingCollapsedRange(doc, from.line, from, to, marker) || from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker)) { throw new Error("Inserting collapsed marker partially overlapping an existing one") } seeCollapsedSpans(); } if (marker.addToHistory) { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); } var curLine = from.line, cm = doc.cm, updateMaxLine; doc.iter(curLine, to.line + 1, function (line) { if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine) { updateMaxLine = true; } if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); } addMarkedSpan(line, new MarkedSpan(marker, curLine == from.line ? from.ch : null, curLine == to.line ? to.ch : null)); ++curLine; }); // lineIsHidden depends on the presence of the spans, so needs a second pass if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) { if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); } }); } if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); } if (marker.readOnly) { seeReadOnlySpans(); if (doc.history.done.length || doc.history.undone.length) { doc.clearHistory(); } } if (marker.collapsed) { marker.id = ++nextMarkerId; marker.atomic = true; } if (cm) { // Sync editor state if (updateMaxLine) { cm.curOp.updateMaxLine = true; } if (marker.collapsed) { regChange(cm, from.line, to.line + 1); } else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css) { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } } if (marker.atomic) { reCheckSelection(cm.doc); } signalLater(cm, "markerAdded", cm, marker); } return marker }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawMarker(lineWidth, lineHeightPerc, offset, markerLength, horiz) {\n var start, end;\n var height = em.height();\n if (horiz) {\n start = { x: offset, y: height};\n end = { x: offset, y: height - (markerLength*lineHeightPerc)};\n } else {\n start = { x: 0, y: height-offset};\n end = { x: markerLength*lineHeightPerc, y: height-offset};\n }\n //console.log('drawing marker from ' + start.x +\",\" + start.y +\" to \"+ end.x + \",\" + end.y);\n draw.drawLine(start, end, { lineWidth: lineWidth, lineColor: opts.ruler.lineColor, lineCap: 'round'});\n }", "createMarker(d, n) {\r\n this._createMarker(d, n);\r\n }", "createIconMarker (line1, line2) {\n \n let { M, H,Map,CORV } = this.state;\n \n var svgMarker = this.props.CORV.svgMarkerImage_Line;\n \n // every long address not shown \n // correctly in marker\n if (line2 && line2.length > 42) {\n line2 = line2.substring(0, 40);\n line2 = line2 + \"..\";\n }\n \n svgMarker = svgMarker.replace(/__line1__/g, line1);\n svgMarker = svgMarker.replace(/__line2__/g, (line2 != undefined ? line2 : \"\"));\n svgMarker = svgMarker.replace(/__width__/g, (line2 != undefined ? line2.length * 2 + 80: (line1.length * 2 + 80)));\n svgMarker = svgMarker.replace(/__widthAll__/g, (line2 != undefined ? line2.length * 2 + 160 : (line1.length * 2 + 160)));\n var icon = new H.map.Icon(svgMarker, {\n anchor: new H.math.Point(24, 57),\n size: { w: 250, h: 80 },\n });\n \n return icon;\n \n // svgMarker = svgMarker.replace(/__line1__/g, line1);\n\t\t\t// \tsvgMarker = svgMarker.replace(/__line2__/g, (line2 != undefined ? line2 : \"\"));\n\t\t\t// \tsvgMarker = svgMarker.replace(/__width__/g, (line2 != undefined ? line2.length * 4 + 20 : (line1.length * 4 + 80)));\n\t\t\t// \tsvgMarker = svgMarker.replace(/__widthAll__/g, (line2 != undefined ? line2.length * 4 + 80 : (line1.length * 4 + 150)));\n\t\t\t// \tconsole.log(svgMarker);\n\t\t\t// \tvar icon = new H.map.Icon(svgMarker, {\n\t\t\t// \t\tanchor: new H.math.Point(24, 57)\n\t\t\t// \t});\n }", "function addMarker(defs, link, inverse) {\n defs\n .append('marker')\n .attr('id', getMarkerId(link, inverse))\n .attr('viewBox', '0 -8 14 16')\n .attr('refX', inverse ? 0 : 12)\n .attr('refY', 0)\n .attr('markerWidth', 12) // ArrowSize\n .attr('markerHeight', 12)\n .attr('markerUnits', 'userSpaceOnUse')\n .attr('orient', 'auto') // Orientation of Arrow\n .attr('class', (link.type ? link.type : 'normal') + 'Marker')\n .append('path')\n .attr('d', function() {\n return inverse ? 'M12,-8L0,0L12,8Z' : 'M0,-8L12,0L0,8Z';\n });\n }", "marker(marker, width, height, block) {\n var attr = ['marker']; // Build attribute name\n\n if (marker !== 'all') attr.push(marker);\n attr = attr.join('-'); // Set marker attribute\n\n marker = arguments[1] instanceof Marker_Marker ? arguments[1] : this.defs().marker(width, height, block);\n return this.attr(attr, marker);\n }", "function createMarker(pos, obj, map) {\r\n var marker = new google.maps.Marker({\r\n position: pos,\r\n map: map,\r\n icon: DEFAULT_ICON,\r\n data: obj\r\n });\r\n\r\n // When the user clicks a marker, check if this is the first marker\r\n // if that's the case make this the starting point.\r\n // If it's the second marker, make it the ending point.\r\n // If it's above the second marker, shift everything\r\n marker.addListener(\"click\", function(e) {\r\n markers.push(marker);\r\n\r\n if(markers.length > 2) {\r\n markers = shiftMarkers(markers);\r\n }\r\n\r\n updateInfo();\r\n });\r\n\r\n\r\n return marker;\r\n }", "function mapper_create_marker(point,title,glyph) {\n var number = map_markers.length\n var marker_options = { title:title }\n if ( glyph != null ) {\n\tmarker_options[\"icon\"] = glyph;\n }\n else if ( map_icons.length > 0 ) {\n\tmarker_options[\"icon\"] = map_icons[map_icons.length-1];\n }\n var marker = new GMarker(point, marker_options );\n map_markers.push(marker)\n marker.value = number;\n GEvent.addListener(marker, \"click\", function() {\n // marker.openInfoWindowHtml(title);\n map.openInfoWindowHtml(point,title);\n });\n map.addOverlay(marker);\n return marker;\n}", "drawLinesBetweenMarkers() {\n let lineString = new H.geo.LineString();\n for(let i = 0; i < this.markers.length; i++) {\n lineString.pushPoint(this.markers[i].getPosition());\n }\n this.map.addObject(new H.map.Polyline(\n lineString, { style: { strokeColor: \"green\", lineWidth: 5 }}\n ));\n }", "function Marker(mark) {\n if (!mark) mark = '';\n this.mark = mark;\n}", "createMarker(){\n\t\tif (!this.values.marker.is_created){\n\t\t\tvar $target = this.getTarget(),\n\t\t\t\tmarker = this.getMarker();\n\n\t\t\t$target.append(\n\t\t\t\tmarker.$elm.append(\n\t\t\t\t\tmarker.$content.append(marker.$img,marker.$header,marker.$body),\n\t\t\t\t\tmarker.$shadow\n\t\t\t\t)\n\t\t\t);\n\t\t\tmarker.is_created = true;\n\t\t}\n\t\t\n\t\treturn this;\n\t}", "function createMarker(stopName,stopBuses,point, markerNum,iconType) \r\n \r\n\t{\r\n //var infoWindowHtml = generateInfoWindowHtml(biz)\r\n\t\t\r\n\t\tvar splitBuses=stopBuses.split(\",\");\r\n\t\tvar busString='';\r\n\t\tvar len=0;\r\n\t\tif(splitBuses.length>5)\r\n\t\t{\r\n\t\t\tfor(i=0;i<splitBuses.length;i++)\r\n\t\t\t{\r\n\t\t\t\tbusString=busString+splitBuses[i]+\",\";\r\n\t\t\t\tif(i%8==7)\r\n\t\t\t\t\tbusString=busString+\"<br>\";\r\n\t\t\t}\r\n\t\t\tlen=busString.length-2;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tbusString=stopBuses;\r\n\t\t\tlen=busString.length;\r\n\t\t}\r\n\r\n\t\t\r\n\t\tvar infoWindowHtml = stopName+\"<br/>\"+busString.substring(0,len);\r\n\r\n var marker = new GMarker(point, iconType);\r\n map.addOverlay(marker);\r\n \r\n\t\t// required to collect data for the proper centering of the map\r\n\t\tbounds.extend(marker.getPoint());\r\n \r\n\t\tGEvent.addListener(marker, \"click\", function() {\r\n marker.openInfoWindowHtml(infoWindowHtml, {maxWidth:400});\r\n });\r\n // automatically open first marker\r\n // if (markerNum == 0)\r\n // marker.openInfoWindowHtml(infoWindowHtml, {maxWidth:400});\r\n\t\t//return marker;\r\n }", "function markPosition(x, y, markerObject) {\n if (x >= 0 && x < size && y >= 0 && y < size){\n if (matrix[y][x] && matrix[y][x].marker != markerObject.marker)\n matrix[y][x] = {steps: matrix[y][x].steps + markerObject.steps, marker: 'x'};\n else \n matrix[y][x] = markerObject;\n }\n}", "function mainMarker(x,y,name,i) {\n \n \n var marker = new google.maps.Marker({\n position: {lat: x, lng: y},\n map: map,\n label:(++i).toString(), \n \n title: name\n });\n markerArray.push(marker);\n }", "function PlaceMarker(vstrType, vintX, vintY) {\n //----\n // set pattern masks\n //----\n var lintMask = 0;\n var larrPosition = new Array('on', 'on', 'on', 'on', 'on', 'on', 'on',\n 'on', 'off', 'off', 'off', 'off', 'off', 'on',\n 'on', 'off', 'on', 'on', 'on', 'off', 'on',\n 'on', 'off', 'on', 'on', 'on', 'off', 'on',\n 'on', 'off', 'on', 'on', 'on', 'off', 'on',\n 'on', 'off', 'off', 'off', 'off', 'off', 'on',\n 'on', 'on', 'on', 'on', 'on', 'on', 'on');\n \n var larrAlignment = new Array('on', 'on', 'on', 'on', 'on',\n 'on', 'off', 'off', 'off', 'on',\n 'on', 'off', 'on', 'off', 'on',\n 'on', 'off', 'off', 'off', 'on',\n 'on', 'on', 'on', 'on', 'on');\n \n //----\n // switch base on type\n //----\n switch(vstrType) {\n case \"position\":\n //----\n // do position mark\n //----\n for(ii=(vintY - 4); ii < (vintY + 3); ii++) {\n for(nn=(vintX - 4); nn < (vintX + 3); nn++) {\n lobjModule = document.getElementById('div'+ ii +'_'+ nn);\n lobjModule.className = lobjModule.className.replace('off', \n larrPosition[lintMask] + ' protected');\n lintMask ++;\n }\n }\n \n break;\n default:\n //----\n // do alignment mark\n //----\n for(ii=(vintY - 2); ii <= (vintY + 2); ii++) {\n for(nn=(vintX - 2); nn <= (vintX + 2); nn++) {\n lobjModule = document.getElementById('div'+ ii +'_'+ nn);\n lobjModule.className = lobjModule.className.replace('off', \n larrPosition[lintMask] + ' protected');\n lintMask ++;\n }\n }\n break;\n }\n}", "function createMarker(point,infoWin, icon) {\r\n var marker = new GMarker(point, {icon:icon});\r\n GEvent.addListener(marker, \"click\", function() {\r\n marker.openInfoWindowHtml(infoWin);\r\n });\r\n return marker;\r\n }", "drawMarker(markerLoc) {\n this.context2d.beginPath();\n this.context2d.lineWidth = this.markerWidth;\n this.context2d.strokeStyle = this.markerColour;\n this.context2d.moveTo(markerLoc, 50);\n this.context2d.lineTo(markerLoc, 130);\n this.context2d.stroke();\n this.context2d.closePath();\n this.annotateMarker(markerLoc);\n }", "function addMarker(xPos, yPos, foodTruck) {\n L.marker(xy(xPos, yPos), { foodTruck })\n .setIcon(foodTruckIcon)\n .addTo(map)\n .on('mouseover', showTooltip)\n .on('mouseout', hideTooltip)\n .on('click', showDetails);\n}", "createSimpleMarkerSymbol () {\n var markerSymbol = new SimpleMarkerSymbol({\n color: [226, 119, 40],\n\n outline: new SimpleLineSymbol({\n color: [255, 255, 255],\n width: 2\n })\n });\n\n return markerSymbol;\n }", "function createMarker() {\n\t\t\t\t\tvar marker = new google.maps.Marker({\n\t\t\t\t\t\tposition: latLng,\n\t\t\t\t\t\tmap: map,\n\t\t\t\t\t\ttitle: title,\n\t\t\t\t\t});\n\t\t\t\t\n\t\t\t\t\tvar infowindow = new google.maps.InfoWindow({\n\t\t\t\t\t\tcontent: title,\n\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\tgoogle.maps.event.addListener(marker, 'click', function() {\n\t\t\t\t\t\tif (lastOpened != undefined) {\n\t\t\t\t\t\t\tlastOpened.close();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinfowindow.open(map, marker);\n\t\t\t\t\t\tmap.panTo(marker.position);\n\t\t\t\t\t\tlastOpened = infowindow;\n\t\t\t\t\t});\n\t\t\t\t\tmarker.setMap(map);\n\t\t\t\t}", "function createMarker(point, descr, icn) {\n var marker = new GMarker(point, icn);\n\n // Show this marker's index in the info window when it is clicked\n var html = '<div style=\"width: 10em\">'+'<b> <font size=-8 face=\"Arial\">' + descr + '</font> </b>' + '</div>';\n GEvent.addListener(marker, \"click\", function() {\n marker.openInfoWindowHtml(html);\n });\n\n return marker;\n }", "function createMarker( location_in, index_in ) {\n var mark = new google.maps.Marker( { position: location_in, map: map } );\n marker[ index_in ] = mark;\n }", "function createCustomMarker( image ) {\n // create holder\n var holder = document.createElement( 'div' );\n holder.className = 'map-marker';\n holder.title = image.title;\n holder.style.position = 'absolute';\n\n // create dot\n var dot = document.createElement( 'div' );\n dot.className = 'dot';\n holder.appendChild( dot );\n\n // create pulse\n var pulse = document.createElement( 'div' );\n pulse.className = 'pulse';\n holder.appendChild( pulse );\n\n // append the marker to the map container\n image.chart.chartDiv.appendChild( holder );\n\n return holder;\n }", "function add_marker(point,id,type,cu){\n markersArray.push(create_marker_object(point,id,type,cu));\n}", "_addMarker (newM, leftM, rightM) {\n // first, make this middlemarker a regular marker\n newM.off('movestart')\n newM.off('click')\n\n // now, create the polygon coordinate point for that marker\n // and push into marker array\n // and associate polygon coordinate with marker coordinate\n const latlng = newM.getLatLng()\n const coords = this._layer._latlngs\n\n // the index path to the marker inside the multidimensional marker array\n const { indexPath, index, parentPath } = this.findDeepMarkerIndex(\n this._markers,\n leftM\n )\n\n // define the coordsRing that is edited\n const coordsRing = indexPath.length > 1 ? get(coords, parentPath) : coords\n\n // define the markers array that is edited\n const markerArr =\n indexPath.length > 1 ? get(this._markers, parentPath) : this._markers\n\n // add coordinate to coordinate array\n coordsRing.splice(index + 1, 0, latlng)\n\n // add marker to marker array\n markerArr.splice(index + 1, 0, newM)\n\n // set new latlngs to update polygon\n this._layer.setLatLngs(coords)\n\n // create the new middlemarkers\n this._createMiddleMarker(leftM, newM)\n this._createMiddleMarker(newM, rightM)\n\n // fire edit event\n this._fireEdit()\n\n this._layer.fire('pm:vertexadded', {\n layer: this._layer,\n marker: newM,\n indexPath: this.findDeepMarkerIndex(this._markers, newM).indexPath,\n latlng\n // TODO: maybe add latlng as well?\n })\n\n if (this.options.snappable) {\n this._initSnappableMarkers()\n }\n }", "annotateMarker(annoLoc) {\n this.context2d.fillText('' + (this.calculateAnnoConversion(annoLoc)), annoLoc, 140);\n }", "function createMarker(point, index) {\n\n\t\t// Set up our GMarkerOptions object\n\t\tmarkerOptions = { icon:baseIcon };\n\t\tvar marker = new GMarker(point, markerOptions);\n\t\tGEvent.addListener(marker, \"click\", function() {\n\t\t\tmarker.openInfoWindowHtml(\"Marker information\");\n\t\t});\n\t\t\n\t\treturn marker;\n\t}", "function place_marker(name) {\n var node = range[name + 'Container'],\n offset = range[name + 'Offset'],\n marker = document.createElement('span'),\n parent = node.parentNode,\n text = node.nodeValue,\n ending = document.createTextNode((''+text).substr(offset));\n\n marker.setAttribute('rrte-'+name, '1');\n\n function insert_after(content, anchor) {\n if (anchor.nextSibling) {\n anchor.parentNode.insertBefore(content, anchor.nextSibling);\n } else {\n anchor.parentNode.appendChild(content);\n }\n }\n\n if (node.nodeType === 3) { // text-node\n if (offset === 0) {\n parent.insertBefore(marker,\n // in case both of the markers are at the beginning of\n // the same node, the 'end' marker will be already there\n // and we will need to insert the 'start' one before it.\n name === 'start' && range.collapsed ? node.previousSibling : node\n );\n } else if (offset === text.length) {\n insert_after(marker, node);\n } else { // splitting the text node in two\n node.nodeValue = text.substr(0, offset);\n insert_after(ending, node);\n parent.insertBefore(marker, ending);\n }\n\n } else if (node.nodeType === 1) { // elements\n if (offset === 0) {\n if (node.firstChild) {\n node.insertBefore(marker, node.firstChild);\n } else if (node.hasChildNodes()) {\n node.appendChild(marker);\n }\n } else if (offset === node.childNodes.length) {\n node.appendChild(marker);\n } else {\n node.insertBefore(marker, node.childNodes[offset]);\n }\n }\n }", "function Marker(latlon, message, drugdrink, misdemean, theft, violent, total){\n this.latlon = latlon;\n this.message = message;\n this.drugdrink = drugdrink;\n this.misdemean = misdemean;\n this.theft = theft;\n this.violent = violent;\n this.total = total\n }", "function createMarker(themap, point, number, thisName, drag, letter, thecolor) {\r\r\n //var letteredIcon = new GIcon(baseIcon);\r\r\n var linecolors=['red' ,'orange','yellow','green' ,'blue' ,'indigo','violet','white' ,'black' ,'grey'];\r\r\n var colorcode=['ff0000','ff8000','ffff00','01DF01','0101DF','8A0886','FA58F4','ffffff','000000','848484'];\r\r\n if (letter=='T'){thecolor='01DF01'}\r\r\n if (letter=='H'){thecolor='848484'}\r\r\n if (letter=='P'){thecolor='ff0000'}\r\r\n if (letter=='B'){thecolor='ffffff'}\r\r\n \r\r\n var image = 'http://thydzik.com/thydzikGoogleMap/markerlink.php?text='+letter+'&color='+thecolor;\r\r\n var shape = {\r\r\n coord: [1, 1, 1, 20, 18, 20, 18 , 1], type: 'poly'};\r\r\n var beachMarker = new google.maps.Marker({\r\r\n position: point,\r\r\n map: themap,\r\r\n icon: image,\r\r\n shape: shape,\r\r\n title: '\" + Request.QueryString(\"namefrom\") + \"'\r\r\n });\r\r\n \r\r\n var infowindow = new google.maps.InfoWindow({\r\r\n content: '<font style=\"\"color:blue\"\">' + thisName + '</font>',\r\r\n size: new google.maps.Size(50,50)\r\r\n });\r\r\n\r\r\n google.maps.event.addListener(beachMarker, 'click', function() {\r\r\n infowindow.open(map,beachMarker);\r\r\n });\r\r\n \r\r\n \r\r\n //return beachMarker;\r\r\n }", "addMarker(markerObj) {\n this.level.addMarker(this.level.maze, this.level.openings, markerObj);\n }", "function makeMarker(position, icon, title, label, section){\r\n\t\tvar contenido = '<b>'+label+'</b><br>'+section;\r\n\t\tvar marker = new google.maps.Marker({\r\n\t\t\tposition: position,\r\n\t\t\tmap: map,\r\n\t\t\ticon: icon,\r\n\t\t\ttitle: title\r\n\t\t});\r\n\t\tmarkersArray.push(marker);\r\n\t\tnew google.maps.event.addListener(marker, 'click', function() {\r\n \t\tinfoWindow.setContent(contenido); \r\n \t\tinfoWindow.open(map,marker);\r\n \t});\r\n\t}", "createRepresentativeMarker(markers, latLngBounds) {\n /*\n\n I think I really need to extend the L.marker class so that my markers can have their own data. Data should conform to an interface that allows\n for a quick description, images, full text description, etc. If I do this, then I need to decide details though: is my data fundamentall a marker? Or do \n i want to separate markers from the actual data? What are pros, cons? If I keep data as a separate class than markers, this means I can use it elsewhere \n when there is no need for any of the functionality a marker provides. However, if my data is primarily meant to be associated with a set of coordinates, then doesnt it \n already make sense to extend it from a marker? \n\n */\n if (markers.length != 0) {\n if (markers.length == 1){\n var soloMarker = markers[0];\n var marker = new L.marker(soloMarker.getLatLng(), {icon: this.getIcon(entry) }); //.addTo(m.getMap());\n marker.bindPopup(() => { return this.getPopupController().getPopupContent(entry) });\n marker.on(\"popupopen\", (event) => { marker.setIcon(this.getActiveIcon(entry)) });\n marker.on(\"popupclose\", (event) => { marker.setIcon(this.getIcon(entry)) });\n } else {\n\n }\n \n }\n\n\n\n }", "function createMarker(point,name,html,iconName) { \n\tvar iconUrl='';\n\tif (iconName=='start') {\n\t\ticonUrl= \"https://maps.google.com/mapfiles/kml/pal4/icon61.png\";\n\t} else {\n\t\ticonUrl= \"https://maps.google.com/mapfiles/kml/pal4/icon53.png\";\n\t}\t\t\t\n\tvar marker = new google.maps.Marker({\n\t\tposition: point, \n\t\tmap: map,\n\t\ticon: iconUrl,\n\t\ttitle:name\n\t});\n\n\tgmarkers[markers_num] = marker;\n\thtmls[markers_num] = html;\n\n\tgoogle.maps.event.addListener(marker, 'click', function() {\n\t infowindow.setContent(html); \n\t infowindow.open(map,marker);\n\t});\n\t \n\t// add a line to the side_bar html\n\tside_bar_html = '<a href=\"javascript:myclick(' + markers_num + ')\">' + name + '</a>';\n\tmarkers_num++;\n\t\n\treturn marker;\n}", "function DotMarker(point, image, info) {\n this.point_ = point;\n this.image_ = image\n this.info_ = info;\n}", "modify_mark(marker) {\n if (!marker.offset_handled) {\n marker.start_pos += this.offset;\n marker.end_pos += this.offset;\n }\n return marker;\n }", "function createMarker() {\n var marker = L.marker(currentLocation).addTo(map);\n markers.push(marker);\n}", "initMarkerArrow() {\n\t\tthis.svgSelector.append('svg:defs').append('svg:marker')\n\t\t\t.attr('id', this.arrowId)\n\t\t\t.attr('viewBox', '0 0 10 10')\n\t\t\t.attr('refX', 10)\n\t\t\t.attr('refY', 5)\n\t\t\t.attr('markerWidth', 6)\n\t\t\t.attr('markerHeight', 6)\n\t\t\t.attr('orient', 'auto')\n\t\t\t.append('path')\n\t\t\t.attr('d', 'M 0 0 L 10 5 L 0 10 z')\n\t\t\t.style('stroke', 'black')\n\t}", "function createObserverMarker(lon, lat, tab, color) {\n\t\t\t\tvar point = new GLatLng(lat, lon);\n\t\t\t\tvar infoTabs = [\n\t\t\t\t tab\n\t\t\t\t];\n\t\t\t\tvar marker = createMarker(point, infoTabs, createIcon(color));\n\t\t\t\treturn marker;\t\t\n\t\t\t}", "function createObserverMarker(lon, lat, tab, color) {\n\t\t\t\tvar point = new GLatLng(lat, lon);\n\t\t\t\tvar infoTabs = [\n\t\t\t\t tab\n\t\t\t\t];\n\t\t\t\tvar marker = createMarker(point, infoTabs, createIcon(color));\n\t\t\t\treturn marker;\t\t\n\t\t\t}", "function draw_markers()\n\t{\n\t\t// This calculates which markers are the red \"multi\" markers.\n\t\tvar overlap_map = MapOverlappingMarkers ( g_main_map.response_object );\n\t\t\n\t\t// Draw the meeting markers.\n\t\tfor ( var c = 0; c < overlap_map.length; c++ )\n\t\t\t{\n\t\t\tCreateMapMarker ( overlap_map[c] );\n\t\t\t};\n\t\t\n\t\t// Finish with the main (You are here) marker.\n\t\tCreateMarker ( g_location_coords, g_center_icon_shadow, g_center_icon_image, g_center_icon_shape );\n\t}", "function create_marker(type, position, title) {\n icon = create_marker_icon(type);\n return new GMarker(position, {title:title, icon:icon});\n}", "function createMarker(point, text) {\n var marker = new GMarker(point);\n\n GEvent.addListener(marker, \"click\", function() {\n\tmarker.openInfoWindowHtml('<div class=\"maptext\">' + text + '</div>');\n });\n return marker;\n}", "addMarker(coord, text, iconKey) {\n let marker = L.marker([coord.lat, coord.lng], {\n icon: this.icons[iconKey],\n }).addTo(this.map);\n marker.bindPopup(text);\n return marker;\n }", "function addMarker () {\n\t\tif (this.innerHTML != \"X\" && this.innerHTML != \"O\") {\n\t\t\tif (turn % 2 === 0 && winningCondition === false) {\n\t\t\t\tthis.style.backgroundColor=\"Gold\";\n\t\t\t\tthis.innerHTML=\"X\";\n\t\t\t\tdocument.getElementById(\"message\").innerHTML = \"'X's turn\";\n\t\t\t} else {\n\t\t\t\tthis.style.backgroundColor=\"IndianRed\";\n\t\t\t\tthis.innerHTML=\"O\";\n\t\t\t\tdocument.getElementById(\"message\").innerHTML = \"'O's turn\";\n\t\t\t}\n\t\t\tturn++;\n\t\t}\n\t}", "function marker () {\n return new ClickTool(markerHandler);\n }", "function marker () {\n return new ClickTool(markerHandler);\n }", "function addMarker(model, position, markerType, inBoundary) {\r\n\t\t\tvar marker = createMarker(\r\n\t\t\t\tmodel.name,\r\n\t\t\t\tposition,\r\n\t\t\t\tfalse/*draggable*/,\r\n\t\t\t\tmarkerType\r\n\t\t\t);\r\n\r\n\t\t\tjQuery.extend(marker.details, model);\r\n\t\t\tattachTooltip(marker);\r\n\t\t\t_markers.push(marker);\r\n\t\t\tinBoundary.extend(position);\r\n\r\n\t\t\t// wire up click event\r\n\t\t\tgm.event.addListener(marker, \"click\", function () {\r\n\t\t\t\tvar m = this;\r\n\t\t\t\tcloseTooltips();\r\n\t\t\t\tm.showTooltip(false/*inRwMode*/);\r\n\t\t\t});\r\n\t\t\tif (model.autoShow) {\r\n\t\t\t\t// show on load enabled for marker\r\n\t\t\t\tmarker.showTooltip(false/*inRwMode*/);\r\n\t\t\t}\r\n\r\n\t\t\t_areBoundsSet = true;\r\n\r\n\t\t\treturn marker;\r\n\r\n\t\t} // addMarker", "function add_live_loc(x, y, z) {\n\n marker_pos_x = \"\";\n marker_pos_y = \"\";\n // here y shows left-right position and x shows top-bottom position(x-top_bottom,y-left_right)\n //alert(z);\n // console.log(x);\n // console.log(y);\n\n\n var result = z.split(\"-\");\n //marker render for left side\n if (result[1] == \"L\") {\n marker_pos_x = x + 20;\n marker_pos_y = y - 90;\n\n }\n //marker render for right side\n else if (result[1] == \"R\") {\n marker_pos_x = x + 20;\n marker_pos_y = y + 90;\n\n }\n\n else if (result[1] == \"RR\") {\n marker_pos_x = x + 20;\n marker_pos_y = y + 260;\n\n }\n //marker render for top side\n else if (result[1] == \"T\") {\n marker_pos_x = x + 90;\n marker_pos_y = y + 5;\n\n }\n //marker render for bottom side\n\n else if (result[1] == \"B\") {\n marker_pos_x = x - 50;\n marker_pos_y = y + 5;\n\n }\n\n else if (result[1] == \"L1\") {\n marker_pos_x = x + 20;\n marker_pos_y = y - 180;\n\n }\n else if (result[1] == \"L2\") {\n marker_pos_x = x + 20;\n marker_pos_y = y - 270;\n\n }\n else if (result[1] == \"L3\") {\n marker_pos_x = x + 20;\n marker_pos_y = y - 360;\n\n }\n\n else if (result[1] == \"L4\") {\n marker_pos_x = x + 20;\n marker_pos_y = y - 450;\n\n }\n\n else if (result[1] == \"L5\") {\n marker_pos_x = x + 20;\n marker_pos_y = y - 540;\n\n }\n\n else if (result[1] == \"L6\") {\n marker_pos_x = x + 20;\n marker_pos_y = y - 630;\n\n }\n\n\n else if (result[1] == \"LA1\" || result[1] == \"LA2\" || result[1] == \"LA3\" || result[1] == \"LA4\") {\n\n marker_pos_x = x + 25;\n marker_pos_y = y - 150;\n\n }\n\n else if (result[1] == \"LB1\" || result[1] == \"LB2\" || result[1] == \"LB3\" || result[1] == \"LB4\") {\n\n marker_pos_x = x + 25;\n marker_pos_y = y - 120;\n\n }\n else if (result[1] == \"LC1\" || result[1] == \"LC2\" || result[1] == \"LC3\" || result[1] == \"LC4\") {\n\n marker_pos_x = x + 25;\n marker_pos_y = y - 90;\n\n }\n\n else if (result[1] == \"LD1\" || result[1] == \"LD2\" || result[1] == \"LD3\" || result[1] == \"LD4\") {\n\n marker_pos_x = x + 25;\n marker_pos_y = y - 60;\n\n }\n\n else if (result[1] == \"RD1\" || result[1] == \"RD2\" || result[1] == \"RD3\" || result[1] == \"RD4\") {\n\n marker_pos_x = x + 25;\n marker_pos_y = y + 60;\n }\n\n else if (result[1] == \"RC1\" || result[1] == \"RC2\" || result[1] == \"RC3\" || result[1] == \"RC4\") {\n\n marker_pos_x = x + 25;\n marker_pos_y = y + 80;\n }\n\n else if (result[1] == \"RB1\" || result[1] == \"RB2\" || result[1] == \"RB3\" || result[1] == \"RB4\") {\n\n marker_pos_x = x + 25;\n marker_pos_y = y + 110;\n }\n\n else if (result[1] == \"RA1\" || result[1] == \"RA2\" || result[1] == \"RA3\" || result[1] == \"RA4\") {\n\n marker_pos_x = x + 25;\n marker_pos_y = y + 140;\n }\n\n /*else {\n \n marker_pos_x=0;\n marker_pos_y=0;\n }*/\n\n\n\n updated_lat = marker_pos_x;\n updated_lng = marker_pos_y;\n var LeafIcon = L.Icon.extend({\n options: { iconSize: [40, 40] }\n });\n\n //http://maps.google.com/mapfiles/ms/icons/red-dot.png\n //var greenIcon = new LeafIcon({iconUrl: 'http://maps.google.com/mapfiles/ms/icons/red-dot.png'});\n //var greenIcon = new LeafIcon({ iconUrl: \"{{ url_for('static', filename='live_loc.png')}}\"});\n var greenIcon = new LeafIcon({ iconUrl: \"{{ url_for('static', filename='red_loc.png')}}\" });\n\n // var greenIcon = new LeafIcon({iconUrl: 'http://labs.google.com/ridefinder/images/mm_20_yellow.png'});\n live_marker = L.marker([updated_lat, updated_lng], { icon: greenIcon })\n live_marker.addTo(myFeatureGroup)\n live_marker_array.push(live_marker);\n for (i = 0; i < live_marker_array.length - 1; i++) {\n if (live_marker_array.length > 1) {\n live_marker_array[i].remove();\n\n }\n }\n //console.log(\"done\");\n\n}", "appendInto(e){this.startNode=e.appendChild(createMarker()),this.endNode=e.appendChild(createMarker())}", "function _createMarker() {\n this.mapMarker = {\n image: new Surface({\n classes: this.options.classes.concat(['marker', 'image']),\n properties: {\n backgroundSize: 'contain'\n }\n }),\n mod: new MapModifier({\n mapView: this.mapView,\n position: this.options.mapView.mapOptions.center\n }),\n lc: new LayoutController({\n layout: function(context, size) {\n var marker = this.options.marker;\n var backSize = [marker.size[0], marker.size[1] - marker.pinSize[1]];\n var top = -marker.size[1];\n context.set('back', {\n size: backSize,\n translate: [backSize[0] / -2, top, 1]\n });\n var imageSize = [this.options.marker.size[0] - (this.options.marker.borderWidth * 2), this.options.marker.size[0] - (this.options.marker.borderWidth * 2)];\n context.set('image', {\n size: imageSize,\n translate: [imageSize[0] / -2, top + ((backSize[1] - imageSize[1]) / 2), 2]\n });\n context.set('pin', {\n size: marker.pinSize,\n translate: [marker.pinSize[0] / -2, top + backSize[1], 1]\n });\n }.bind(this),\n dataSource: {\n back: new Surface({\n classes: this.options.classes.concat(['marker', 'back'])\n }),\n pin: new Surface({\n classes: this.options.classes.concat(['marker', 'pin']),\n content: '<div></div>'\n })\n }\n })\n };\n this.add(this.mapMarker.mod).add(this.mapMarker.lc);\n this.mapMarker.lc.insert('image', this.mapMarker.image);\n}", "function createCustomMarker(text, latitudine, longitudine, iconUrl, drag, dim, pulse) {\r\n if (!pulse) {\r\n var cMark = L.icon({\r\n iconUrl: iconUrl,\r\n iconSize: dim, // size of the icon\r\n iconAnchor: [dim[0] / 2, dim[1]]\r\n\r\n });\r\n }\r\n else {\r\n var cMark = L.icon({\r\n iconUrl: iconUrl,\r\n iconSize: dim, // size of the icon\r\n iconAnchor: [dim[0] / 2, dim[1] - 12]\r\n\r\n });\r\n }\r\n var marker = new L.Marker([latitudine, longitudine], { icon: cMark, draggable: drag });\r\n if (!pulse) {\r\n marker.bindPopup(text);\r\n marker.on('click', function (e) {\r\n this.openPopup();\r\n });\r\n marker.on('mouseout', function (e) {\r\n this.closePopup();\r\n });\r\n marker.on(\"drag\", function (e) {\r\n var marker = e.target;\r\n var position = marker.getLatLng();\r\n lat.value = position.lat;\r\n lng.value = position.lng;\r\n });\r\n }\r\n return marker;\r\n}", "addMarker(level, openings, itemObj, startPosX = -1, startPosY = -1) {\n let startPos = startPosX + startPosY;\n if (startPos >= 0 && openings.indexOf(startPos) === -1 && startPos < this.maze.length) {\n level[startPos] = itemObj;\n }\n else {\n let randomCell = Math.floor(Math.random() * openings.length);\n let addMarkerPosn = openings.splice(randomCell, 1)[0];\n level[addMarkerPosn] = itemObj;\n }\n }", "function createCustomMarker(image) {\n // create holder\n var holder = document.createElement('div');\n\n if (image.text) {\n holder.innerHTML = image.text;\n holder.style.color = image.color;\n holder.style['font-size'] = image.fontSize;\n holder.style['font-family'] = image.fontFamily;\n\n\n holder.style.position = 'absolute';\n }\n else {\n holder.className = 'map-marker';\n holder.title = image.title;\n holder.style.position = 'absolute';\n // maybe add a link to it?\n if (undefined != image.url) {\n holder.onclick = function() {\n window.location.href = image.url;\n };\n holder.className += ' map-clickable';\n }\n // create dot\n var dot = document.createElement('div');\n dot.className = 'dot';\n holder.appendChild(dot);\n // create pulse\n var pulse = document.createElement('div');\n pulse.className = 'pulse';\n holder.appendChild(pulse);\n }\n // append the marker to the map container\n image.chart.chartDiv.appendChild(holder);\n\n return holder;\n }", "function createMarker(i, lats, longs, dates, map_) {\n\tvar dateVar = new Date(dates[i]);\n\tvar marker = new google.maps.Marker({ // add marker\n\t\tposition: new google.maps.LatLng(lats[i], longs[i]),\n\t\tmap: map_,\n\t\ttitle: moment(dateVar).format('h:mm A MMMM Do, YYYY')\n\t});\n\t\n\tvar contentString = 'Latitude: ' + lats[i] + '<br>' +\n\t\t'Longitude: ' + longs[i] + '<br>' +\n\t\tmoment(dateVar).format('h:mm A MMMM Do, YYYY');\n\n\tvar infowindow = new google.maps.InfoWindow({ // add info box popup\n\t\tcontent: contentString,\n\t\tmaxWidth: 200\n\t});\n\n\tgoogle.maps.event.addListener(marker, 'click', function() {\n\t\tinfowindow.open(map_,marker);\n\t});\n}", "function drawMarker(data){\n\n\t//Canvas and Context\n\t//1 is used for drawing the actual marker\n\t//2 is used for drawing the shadow\n\t//3 is used for combinding marker and shadow\n\tvar canvas = [];\n\tvar ctx = [];\n\tfor(var i = 0; i<3; i++){\n\t\tcanvas[i] = document.createElement('canvas');\n\t\tctx[i] = canvas[i].getContext('2d');\n\t\tcanvas[i].style.width = w+'px';\n\t\tcanvas[i].style.height = h+'px';\n\t\tcanvas[i].width = w;\n\t\tcanvas[i].height = h;\t\n\t}\n\n\t/*\n\n\t\tSTART — DRAWING THE MARKER\n\n\t*/\n\n\tctx[0].strokeStyle = \"rgba(0, 0, 0, 0.5)\";\n\tctx[0].lineJoin = \"round\";\n\tctx[0].lineCap = \"round\";\n\tctx[0].lineWidth = 0.5;\n\n\tctx[0].save();\t\n\tctx[0].translate(50,50);\n\n\tctx[0].beginPath();\n\tctx[0].moveTo(polar_x(20, 0), polar_y(20, 0));\n\tctx[0].fillStyle = \"rgba(255,255,255,1)\";\n\tctx[0].lineTo(polar_x(20, 60), polar_y(20, 60));\n\tctx[0].lineTo(polar_x(20, 120), polar_y(20, 120));\n\tctx[0].lineTo(polar_x(30, 180), polar_y(30, 180));\n\tctx[0].lineTo(polar_x(20, 240), polar_y(20, 240));\n\tctx[0].lineTo(polar_x(20, 300), polar_y(20, 300));\n\tctx[0].lineTo(polar_x(20, 360), polar_y(20, 360));\n\tctx[0].closePath();\n\tctx[0].fill();\n\tctx[0].stroke();\n\n\tctx[0].beginPath();\n\tctx[0].moveTo(polar_x(20, 0), polar_y(20, 0));\n\tctx[0].fillStyle = \"rgba(255,0,0,0.2)\";\n\tctx[0].lineTo(polar_x(20, 60), polar_y(20, 60));\n\tctx[0].lineTo(polar_x(20, 120), polar_y(20, 120));\n\tctx[0].lineTo(polar_x(30, 180), polar_y(30, 180));\n\tctx[0].lineTo(polar_x(20, 240), polar_y(20, 240));\n\tctx[0].lineTo(polar_x(20, 300), polar_y(20, 300));\n\tctx[0].lineTo(polar_x(20, 360), polar_y(20, 360));\n\tctx[0].closePath();\n\tctx[0].fill();\n\n\tfor(var i = 0; i<10; i++){\n\t\tctx[0].fillStyle = \"rgba(\"+Math.round(Math.random()*255)+\",\"+Math.round(Math.random()*255)+\",\"+Math.round(Math.random()*255)+\",\"+Math.random()/2+\")\";\n\t\tvar cr = 20;\n\t\tctx[0].beginPath();\n\t\tvar a = Math.round(Math.random()*6)*60;\n\t\tif(a==180){cr=30;}else{cr=20;}\n\t\tctx[0].moveTo(polar_x(cr, a), polar_y(cr, a));\n\t\tvar a1 = a+60;\n\t\tif(a1>360){a1 -= 360;}\n\t\tif(a1==180){cr=30;}else{cr=20;}\n\t\tctx[0].lineTo(polar_x(cr, a1), polar_y(cr, a1));\n\t\tvar a2 = a1+180;\n\t\tif(a2 > 360){a2 -= 360;}\n\t\tif(a2==180){cr=30;}else{cr=20;}\n\t\tctx[0].lineTo(polar_x(cr, a2), polar_y(cr, a2));\n\t\tctx[0].closePath();\n\t\tctx[0].fill();\n\t}\n\n\tctx[0].restore();\n\n\t/*\n\n\t\tEND — DRAWING THE MARKER\n\n\t*/\n\n\t//The marker is copied to an image\n\tvar image = ctx[0].getImageData(0,0,canvas[0].width,canvas[0].height);\n\n\t//The image is drawn onto the second canvas (this is a backup of our original marker which is going to copied to the final image in the end)\n\tctx[1].drawImage(canvas[0], 0, 0);\n\n\t//The image of our marker is now turned in greyscale\n\t//Attention if you want your shadow to be a greyscale version of your marker this is fine\n\t//But in most cases you actually want a black version of your marker\n\t//1. There are two solutions to this, draw a second version of your marker in black\n\t//2. Write a new Filter that turns every colored pixel black\n\t//It depends on the complexity of your marker, but in my cases drawing a second version was faster\n\tvar tImage = Filters.filterImage(Filters.grayscale, image);\n\t//The following line is making the shadow transparent\n\ttImage = Filters.filterImage(Filters.convolute, tImage,\n\t [ 1/19, 1/19, 1/19,\n\t 1/19, 1/19, 1/19,\n\t 1/19, 1/19, 1/19 ]\n\t);\n\n\t//The greyscale image is drawn again onto the first canvas\n\tctx[0].putImageData(tImage, 0, 0);\n\n\n\t//The next four lines draw a distorted version of the marker shadow\n\tctx[2].save();\n ctx[2].transform(1,0,-1.5,1,0,0);\n\tctx[2].drawImage(canvas[0], 138, 40, 100, 55);\n\tctx[2].restore();\n\n\t//finally we draw our marker on top\n\tctx[2].drawImage(canvas[1], 0, 0);\n\n\t//and send back the image file-string\n\treturn canvas[2].toDataURL(\"image/png\");\n}", "function add_marker(lat, lon, comuna_name, comuna_id, comuna_n_avistamientos) {\n let marker_title = comuna_name + \": \";\n if (comuna_n_avistamientos === 1) {\n marker_title += comuna_n_avistamientos + \" avistamiento.\";\n } else {\n marker_title += comuna_n_avistamientos + \" avistamientos.\";\n }\n\n let new_marker = L.marker([lat, lon], {\n icon: marker_icon,\n title: marker_title});\n new_marker.addTo(map);\n new_marker.bindPopup(`<b>Now loading comuna ${comuna_id}... Please wait</b>`); // Default message of the popup.\n new_marker.on('popupopen', function (event) {\n // Execute the creation of the inside of the popup when it's open.\n\n let opened_popup = event.popup;\n crochet_marker_popup(comuna_id, opened_popup);\n })\n\n markers.push(new_marker);\n}", "function addMarker(marker, map) {\n var color;\n var label;\n if (marker.status == 'enrolled'){\n label = labels[enrolledCount % 26];\n enrolledCount++;\n color = 'green';\n } else if (marker.status == 'skilled'){\n label = labels[skilledCount % 26];\n skilledCount++;\n color = 'yellow';\n } else if (marker.status == 'placed') {\n label = labels[placedCount % 26];\n placedCount++;\n color = 'pink';\n }\n img = 'markers/' + color + '_Marker' + label + '.png'\n var added = new google.maps.Marker({\n position: marker,\n map: map,\n icon: img\n });\n}", "function setMarker(element, marker) {\n\n [ MARKER_ATTACH, MARKER_OK, MARKER_NOT_OK, MARKER_NEW_PARENT ].forEach(function(m) {\n\n if (m === marker) {\n canvas.addMarker(element, m);\n } else {\n canvas.removeMarker(element, m);\n }\n });\n }", "function setMarker(element, marker) {\n\n [ MARKER_ATTACH, MARKER_OK, MARKER_NOT_OK, MARKER_NEW_PARENT ].forEach(function(m) {\n\n if (m === marker) {\n canvas.addMarker(element, m);\n } else {\n canvas.removeMarker(element, m);\n }\n });\n }", "function createMarker(obj) {\r\n\r\n // prepare new Marker object\r\n var mark = new google.maps.Marker({\r\n position: obj.geometry.location,\r\n map: map,\r\n title: obj.name\r\n });\r\n markers.push(mark);\r\n\r\n // prepare info window\r\n var infowindow = new google.maps.InfoWindow({\r\n content: '<img src=\"' + obj.icon + '\" /><font style=\"color:#000;\">' + obj.name + \r\n '<br />Rating: ' + obj.rating + '<br />Vicinity: ' + obj.vicinity + '</font>'\r\n });\r\n\t\r\n\t\r\n\t\t \r\n\t\t\r\n \r\n\t\t\r\n\t\t\r\n\r\n // add event handler to current marker\r\n google.maps.event.addListener(mark, 'click', function() {\r\n clearInfos();\r\n infowindow.open(map,mark);\r\n });\r\n infos.push(infowindow);\r\n\t\r\n\t\r\n\t\r\n\t\r\n}", "function createMarker(point) {\n\t\tGoogleMapsFactory.createMarker({\n\t\t\tposition: {\n\t\t\t\tlat: parseFloat(point.latitude),\n\t\t\t\tlng: parseFloat(point.longitude)\n\t\t\t},\n\t\t\ttitle: point.name\n\t\t}, point.id, point.rating, function() {\n\t\t\t$scope.openMarkerInfowindow(point.id);\n\t\t});\n\t}", "function time_line_marker (id) {\n _astr_time_line = id;\n var marker_ = L.marker([_astr_time_line.reclat, _astr_time_line.reclong], {icon: mya}).addTo(map);\n marker_.bindPopup( '<b>' + _astr_time_line.name + '</b> <br>' + '<b>Year : </b>' + _astr_time_line.year + '<br>' + '<b>Mass : </b>' + _astr_time_line.mass + ' kg' , 50);\n}", "function drawMarker(ctx, p) {\n ctx.beginPath();\n ctx.moveTo(p.x-floor(rectW/2), p.y-floor(rectH/2));\n ctx.lineTo(p.x+floor(rectW/2), p.y+floor(rectH/2));\n ctx.closePath();\n ctx.strokeStyle = 'red';\n ctx.stroke();\n ctx.closePath();\n \n ctx.beginPath();\n ctx.moveTo(p.x-floor(rectW/2), p.y+floor(rectH/2));\n ctx.lineTo(p.x+floor(rectW/2), p.y-floor(rectH/2));\n ctx.closePath();\n ctx.strokeStyle = 'red';\n ctx.stroke();\n \n ctx.strokeStyle = 'black';\n ctx.strokeRect(p.x-floor(rectW/2), p.y-floor(rectH/2), rectW, rectH);\n}", "function createMarker(map,point,image, txt) {\n var marker = new google.maps.Marker({\n position: point,\n map: map,\n icon: image\n });\n\n \n\n var infowindow = new google.maps.InfoWindow({\n content: txt\n });\n google.maps.event.addListener(marker, 'click', function() {\n \n infowindow.open(map,marker);\n \n });\n \n \n return marker;\n }", "function createCustomMarker( image ) {\r\n // create holder\r\n var holder = document.createElement( 'div' );\r\n holder.className = 'map-marker';\r\n holder.title = image.title;\r\n holder.style.position = 'absolute';\r\n\r\n // maybe add a link to it?\r\n if ( undefined != image.url ) {\r\n holder.onclick = function() {\r\n window.location.href = image.url;\r\n };\r\n holder.className += ' map-clickable';\r\n }\r\n\r\n // create dot\r\n var dot = document.createElement( 'div' );\r\n dot.className = 'dot';\r\n holder.appendChild( dot );\r\n\r\n // create pulse\r\n var pulse = document.createElement( 'div' );\r\n pulse.className = 'locator';\r\n holder.appendChild( pulse );\r\n\r\n // append the marker to the map container\r\n image.chart.chartDiv.appendChild( holder );\r\n\r\n return holder;\r\n}", "function createCustomMarker( image ) {\r\n // create holder\r\n var holder = document.createElement( 'div' );\r\n holder.className = 'map-marker';\r\n holder.title = image.title;\r\n holder.style.position = 'absolute';\r\n\r\n // maybe add a link to it?\r\n if ( undefined != image.url ) {\r\n holder.onclick = function() {\r\n window.location.href = image.url;\r\n };\r\n holder.className += ' map-clickable';\r\n }\r\n\r\n // create dot\r\n var dot = document.createElement( 'div' );\r\n dot.className = 'dot';\r\n holder.appendChild( dot );\r\n\r\n // create pulse\r\n var pulse = document.createElement( 'div' );\r\n pulse.className = 'locator';\r\n holder.appendChild( pulse );\r\n\r\n // append the marker to the map container\r\n image.chart.chartDiv.appendChild( holder );\r\n\r\n return holder;\r\n}", "function createMarker() {\n for (var i = 0; i < locationsList().length; i++ ){\n var initialLocation = locationsList()[i];\n var placeLoc = initialLocation.location;\n var marker = new google.maps.Marker({\n map: map,\n position: placeLoc,\n title: initialLocation.name,\n visible: true\n });\n initialLocation.marker = marker;\n markers.push(marker);\n //add event listeners to the markers to open the relevant infowindow\n google.maps.event.addListener(marker, 'click', (function(initialLocation) {\n return function() {\n closeAllInfoWindows();\n deselectAll();\n toggleBounce(initialLocation);\n initialLocation.selected(true);\n infowindow.setContent(contentString(initialLocation));\n infowindow.open(map, this);\n infowindows.push(infowindow);\n };\n })(initialLocation));\n }\n }", "function createCustomMarker( image ) {\n // create holder\n var holder = document.createElement( 'div' );\n holder.className = 'map-marker';\n holder.title = image.title;\n holder.style.position = 'absolute';\n\n // maybe add a link to it?\n if ( undefined != image.url ) {\n holder.onclick = function() {\n window.location.href = image.url;\n };\n holder.className += ' map-clickable';\n }\n\n // create dot\n var dot = document.createElement( 'div' );\n dot.className = 'dot';\n holder.appendChild( dot );\n\n // create pulse\n var pulse = document.createElement( 'div' );\n pulse.className = 'pulse';\n holder.appendChild( pulse );\n\n // append the marker to the map container\n image.chart.chartDiv.appendChild( holder );\n\n return holder;\n}", "function addMarker(board, marker) {\n var currentStrength = board.markers[marker.x][marker.y][marker.quadrant][marker.botColor]\n if (typeof currentStrength === 'undefined') {\n currentStrength = 0.0\n }\n\n currentStrength += INIT_MARKER_STRENGTH\n if (currentStrength >= MAX_MARKER_STRENGTH) {\n currentStrength = MAX_MARKER_STRENGTH\n }\n\n board.markers[marker.x][marker.y][marker.quadrant][marker.botColor] =\n currentStrength\n}", "function setMarker(element, marker) {\n [MARKER_ATTACH$1, MARKER_OK$3, MARKER_NOT_OK$3, MARKER_NEW_PARENT$1].forEach(function (m) {\n if (m === marker) {\n canvas.addMarker(element, m);\n } else {\n canvas.removeMarker(element, m);\n }\n });\n }", "function createMarker(point,html) {\n var marker = new GMarker(point);\n GEvent.addListener(marker, \"click\", function() {\n marker.openInfoWindowHtml(html);\n });\n return marker;\n }", "function addSingleMaker(){\n\tmarker = new google.maps.Marker({\n\t\tposition:{\n\t\t\tlat: -41.295005,\n\t\t\tlng: 174.78362\n\t\t},\n\t\tmap: map,\n\t\tanimation: google.maps.Animation.DROP,\n\t\ticon: \"img/person.png\",\n\t\ttitle : \"Yoobee School of Design\",\n\t\tdescription: \"Description for Yoobee School of Design\"\n\t})\n}", "function createCustomMarker(image) {\n // create holder\n var holder = document.createElement('div');\n holder.className = 'map-marker';\n holder.title = image.title;\n holder.style.position = 'absolute';\n\n // maybe add a link to it?\n if (undefined != image.url) {\n holder.onclick = function () {\n window.location.href = image.url;\n };\n holder.className += ' map-clickable';\n }\n\n // create dot\n var dot = document.createElement('div');\n var dotClass = (image.dotColor) ? ' bg-' + image.dotColor : '';\n var pulseClass = (image.pulseColor) ? ' pulse-' + image.pulseColor : '';\n dot.className = 'dot-shape dot-shape-lg' + dotClass + pulseClass;\n holder.appendChild(dot);\n\n // append the marker to the map container\n image.chart.chartDiv.appendChild(holder);\n\n return holder;\n }", "function makeMarker(position, icon, name) {\n new google.maps.Marker({\n position: position,\n map: gmap,\n icon: icon,\n title: name\n });\n}", "function createMarker(obj) {\n // prepare new Marker object\n var mark = new google.maps.Marker({\n position: obj.geometry.location,\n map: map,\n title: obj.name\n });\n markers.push(mark);\n // prepare info window\n var infowindow = new google.maps.InfoWindow({\n content: '<img src=\"' + obj.icon + '\" /><font style=\"color:#000;\">' + obj.name +\n '<br />Rating: ' + obj.rating + '<br />Vicinity: ' + obj.vicinity + '</font>'\n });\n // add event handler to current marker\n google.maps.event.addListener(mark, 'click', function() {\n clearInfos();\n infowindow.open(map, mark);\n });\n infos.push(infowindow);\n}", "function insertMarkers(series){\n _.each(series, function(s){\n var data = s.data;\n if(data && data.length && !data[0].marker){\n var marker = {symbol: 'url(./assets/' + data[0].name + '_48x48.png)'}\n data[0].marker = marker;\n data[data.length - 1].marker = marker;\n }\n });\n }", "function createMarker(latlng, locatid, title, tracktype,locationtype) {\n var pinImage;\n var listImage;\n if(locationtype == '0'){\n\t pinImage = generalPointsIcon;\n\t listImage = \"images/generalPoints.png\";\n }else if(locationtype == '2'){\n pinImage = learnPointsIcon;\n\tlistImage = \"images/learnPoints.png\";\n }else if(locationtype == '1' || locationtype == '3'){\n var types = tracktype.split(\";\");//one point can be in multiple tracks\n var index = types.indexOf(track_type);\n if(index == '-1'){//not this track's point\n\t\tpinImage = notincurrenttrackPointsIcon;\n\t\tlistImage = \"images/notincurrenttrackPoints.png\";\n }else{//is this track's point\n pinImage = adventurePointsIcon;\n\t listImage = \"images/adventurePoints.png\";\n }\n }\n side_content += \"&nbsp;&nbsp;<img src='\" + listImage + \"' >Point:&nbsp;<a class='wraplink' name='\"+ locatid +\"' onclick='viewPointDescription(this)'><b>\" + locatid + \" \" + title + \"</b></a><br>\"; \n var marker = new google.maps.Marker({\n position: latlng,\n map: map,\n id:locatid,\n icon: pinImage,\n\t\t//draggable:true,\n zIndex: Math.round(latlng.lat()*-100000)<<5\n });\n\n google.maps.event.addListener(marker, 'click', function() {\n document.getElementById(\"locat-id\").value = marker.id;\n viewDescription(marker.id);\n\t\tif(role_id == '1' || role_id == '2'){//admin or citizen\n\t\t\tif(locationtype == '0' || locationtype == '2'){//general or learn as you go points only\n\t\t\tinfowindow.setContent(\"<p><b>Title: \"+ title + \"</b><br><a class='wraplink' name='\" + marker.id + \"' id='\" + locationtype + \"' onclick='addPointToTrack(this)'><b>Add Me To This Track!</b></a></p>\");\n\t\t\t}else if(locationtype == '1' || locationtype == '3'){\n\t\t\t var types = tracktype.split(\";\");//one point can be in multiple tracks\n\t\t\t var index = types.indexOf(track_type);\n\t\t\t if(index == '-1'){//not this track's point\n\t\t\t\tinfowindow.setContent(\"<p><b>Title: \"+ title + \"</b><br><a class='wraplink' name='\" + marker.id + \"' id='\" + locationtype + \"' onclick='addPointToTrack(this)'><b>Add Me To This Track!</b></a></p>\");\n\t\t\t }else{//is this track's point\n\t\t\t\t\n\t\t\t\t $.ajax({ url: 'countQuestions.php',\n\t\t\t\t\t data: {locatID: marker.id, userID:user_id, roleID:role_id, trackType:track_type, locationType: locationtype},\n\t\t\t\t\t type: 'post',\n\t\t\t\t\t success: function(output) {\n\t\t\t\t\t\t infowindow.setContent(output);\n\t\t\t\t\t }\n\t\t\t\t});\n\t\t\t }\n\t\t\t}\n\t\t\tinfowindow.open(map,marker); \n\t\t}else{//normal user\n\t\t\tif(locationtype == '1' || locationtype == '3'){\n\t\t\t var types = tracktype.split(\";\");//one point can be in multiple tracks\n\t\t\t var index = types.indexOf(track_type);\n\t\t\t if(index == '-1'){//not this track's point\n\t\t\t\t//do nothing\n\t\t\t }else{//is this track's point\n\t\t\t\t $.ajax({ url: 'countQuestions.php',\n\t\t\t\t\t data: {locatID: marker.id, userID:user_id, roleID:role_id, trackType:track_type, locationType: locationtype},\n\t\t\t\t\t type: 'post',\n\t\t\t\t\t success: function(output) {\n\t\t\t\t\t\t infowindow.setContent(output);\n\t\t\t\t\t }\n\t\t\t\t});\n\t\t\t\tinfowindow.open(map,marker); \n\t\t\t }\n\t\t\t}\n\t\t\t\n\t\t}\n \n\t\t\n \n });\n\t\t//google.maps.event.addListener(marker, 'dragend', function (event) {\n\t\t\t//infowindow.setContent(\"<p>Point ID: \" + marker.id + \"<br>\" + this.getPosition().lat() + \" , \" + this.getPosition().lng() + \"</p><p><h4>Are you sure to move? </h4><a id='\" + marker.id + \"' onclick='updateLocation(this)'><b >Yes</b></a>&nbsp;&nbsp;&nbsp;<a><b onclick='resetLocation()'>No</b></a></p>\"); \n\t\t\t//infowindow.open(map,marker);\n\t\t//});\n gmarkers.push(marker);\n\t\n \n //titles.forEach(function(des,i){\n //side_content += \"&nbsp;&nbsp;<img src='\" + listImage + \"' >Point:&nbsp;<a name='\"+ locat_id[i] +\"' onclick='viewPointDescription(this)'><b>\" + locat_id[i] + \" \" + des + \"</b></a><br>\"; \n //})\n side_bar_html = side_content;\n right_bar_html = \"<p>&nbsp;&nbsp;Click on points to view description!</p>\";\n\n}", "function PosMarker(index, x, y, z, personObj) {\n\tBaseMarker.call(this);\n\tthis.className = 'marker';\n\tthis.id = 'marker' + index;\n\tthis.position = new THREE.Vector3(x, y, z);\n\tthis.data = personObj;\n\tif (!personObj) alert('no personObj for marker ' + index);\n\tthis.innerHTML = '<span class=\"marker-label\">' + personObj.name + '</span><br/><div class=\"marker-symbol\"></div>';\n\n\tthis.addEventListener('click', this.markerClickHandler);\n\tthis.unitVector = new THREE.Vector3(x, y, z).normalize();\n\n\tthis._bgX = 0;\n\tTicker.instance.add(this, this._animateBackground);\n}", "function setMarker(map, position, title, text, icon, i) {\n var marker = new google.maps.Marker({\n position: position,\n map: map,\n animation: google.maps.Animation.DROP,\n title: title,\n text: text,\n icon: icon,\n id: i\n });\n return marker;\n}", "function createMarker(point, map) {\n\tvar markerInfoWindow = new google.maps.InfoWindow({\n\t\tcontent: \"Coordinates: (\" + point.lat() +\",\"+ point.lng() +\")\"\n\t});\n\t\n\tvar marker = new google.maps.Marker({\n\t\tposition: point,\n\t\tmap: map\n\t});\n\t\n\tgoogle.maps.event.addListener(marker, 'click', function() {\n\t\tmarkerInfoWindow.open(map, marker);\n\t});\n}", "function createMarker(point, business_name, product_name, product_price, product_category) {\n var html = '<div id=\"content\" style=\"font-family:9px;\"><small>Business Name:<b>' + business_name + '</b></small><br/><small>Product: <b>' + product_name + '</b></small><br /><small>Price(Ksh.): <b>' + product_price + '</b></small><br /><small>Category: <b>' + product_category + '</b></small></div>';\n var marker = new google.maps.Marker({\n map: mapObject,\n position: point\n });\n\n //CREATE INFO WINDOW WHEN MARKER IS CLICKED\n google.maps.event.addListener(marker, 'click', function () {\n infoWindow.setContent(html);\n infoWindow.open(mapObject, marker);\n });\n markers.push(marker);\n}", "function createMarker(location) {\r\n if (location == undefined || markers[location.vehicleId]) {\r\n return;\r\n }\r\n\r\n var icon = {\r\n url: \"https://maps.google.com/mapfiles/kml/shapes/bus.png\",\r\n scaledSize: new google.maps.Size(32,32),\r\n origin: new google.maps.Point(0, 0),\r\n anchor: new google.maps.Point(0, 0),\r\n };\r\n var marker = new google.maps.Marker({\r\n position: new google.maps.LatLng(location.latitude, location.longitude),\r\n map: map,\r\n icon: icon,\r\n });\r\n\r\n (function (marker) {\r\n google.maps.event.addListener(marker, 'click', function () {\r\n infowindow = new google.maps.InfoWindow({\r\n content: \"Bus #\" + location.vehicleId + \" @@ \" + location.lastUpdated + \" UTC\"\r\n });\r\n infowindow.open(map, marker);\r\n });\r\n })(marker)\r\n\r\n markers[location.vehicleId] = marker;\r\n}", "function createMarker(supplyPoint){ // create a marker with a info window\n\n\n var title = getProperty(supplyPoint, oMap.supplyPointSchema.name, 0);\n\n var marker = new google.maps.Marker({\n position: {lat: getProperty(supplyPoint, oMap.supplyPointSchema.lat, 0), lng: getProperty(supplyPoint, oMap.supplyPointSchema.lng, 0) },\n title: title,\n icon: \"http://maps.google.com/mapfiles/kml/pal4/icon57.png\"\n });\n\n google.maps.event.addListener(marker, 'click', function () {\n infowindow.close();\n infowindow.setOptions({maxWidth: 400});\n infowindow.setContent(getInfoBoxString(supplyPoint));\n infowindow.open($$(\"map\")._map, marker);\n\n });\n\n return marker;\n}", "function createMarkers(){\n vm.map.markers = {};\n createLocationSearchMarker();\n for(var i=0; i < vm.items.length; i++){\n var marker = vm.items[i]['center'];\n marker['message'] = vm.items[i]['short_description'];\n marker['icon'] = {\n type: 'awesomeMarker',\n className: vm.items[i]['category'],\n html: String(i + 1)\n\n };\n vm.map.markers[String(vm.items[i]['id'])] = marker;\n }\n }", "function add_marker($marker, map) {\n // var\n var latlng = new google.maps.LatLng($marker.attr('data-lat'), $marker.attr('data-lng')); // create marker\n\n var marker = new google.maps.Marker({\n position: latlng,\n map: map\n }); // add to array\n\n map.markers.push(marker); // if marker contains HTML, add it to an infoWindow\n\n if ($marker.html()) {\n // create info window\n var infowindow = new google.maps.InfoWindow({\n content: $marker.html()\n }); // show info window when marker is clicked\n\n google.maps.event.addListener(marker, 'click', function () {\n infowindow.open(map, marker);\n });\n }\n }", "function setMarker(x,y){\n marker = new google.maps.Marker({\n position: new google.maps.LatLng(x, y),\n map: map,\n icon: 'images/map-marker.png',\n title: 'You are here !'\n });\n\n}", "function createCustomMarker(image) {\n // create holder\n var holder = document.createElement('div');\n holder.className = 'map-marker';\n holder.title = image.title;\n holder.style.position = 'absolute';\n\n // maybe add a link to it?\n if (undefined != image.url) {\n holder.onclick = function() {\n window.location.href = image.url;\n };\n holder.className += ' map-clickable';\n }\n\n // create dot\n var dot = document.createElement('div');\n dot.className = 'dot';\n holder.appendChild(dot);\n\n // create pulse\n var pulse = document.createElement('div');\n pulse.className = 'pulse';\n holder.appendChild(pulse);\n\n // append the marker to the map container\n image.chart.chartDiv.appendChild(holder);\n\n return holder;\n}", "function addMarker(map, powerline, powerpole, overgrowth, oversag, latitude, longitude, comment, url,timeAdded){\n \n // checks to see if comment was entered.\n /*if(comment == null){\n comment = \"\";\n }*/\n var status = createStatus(powerline,powerpole,overgrowth,oversag);\n var justDate = timeAdded.split(\" \");\n var date = justDate[0].split(\"-\");\n\n //console.log(date);\n \n // creates google map location from lat and long\n var location = new google.maps.LatLng(latitude,longitude);\n\n var marker = new google.maps.Marker({\n position: location,\n //animation: google.maps.Animation.DROP,\n map: map,\n //icon: {\n //path: google.maps.SymbolPath.CIRCLE,\n //scale: 5\n //},\n icon: 'http://maps.google.com/mapfiles/ms/icons/' + status + '-dot.png',\n //shape: shape,\n //icon: greenimage,\n locationComment: comment,\n date: justDate[0],\n year: date[0],\n month: date[1],\n day: date[2],\n timeFiltered:false,\n powerline: powerline,\n powerpole: powerpole,\n overgrowth: overgrowth,\n oversag: oversag,\n latitude: latitude,\n longitude: longitude,\n url: url, \n index: 0,\n status: status,\n changed1: 0, \n });\n\n\n google.maps.event.addListener(marker, 'click', function(){\n //document.getElementById('box').innerHTML = marker.index;\n console.log(marker.url);\n pictureChange(marker.url);\n infoPanelChange(marker.powerline, marker.powerpole, marker.overgrowth, marker.oversag, marker.latitude, marker.longitude, marker.locationComment, marker.date)\n if (selected == 0) {originalIcon = marker.getIcon();\n marker.setIcon(blueimage);\n selected = 1;\n selMarker = marker;\n } else {\n //console.log(selMarker);\n selMarker.setIcon(originalIcon); \n originalIcon = marker.getIcon();\n marker.setIcon(blueimage);\n selMarker = marker;\n }\n });\n marker.index = markerArray.length;\n var place = markerArray.push(marker);\n \n}", "function createMarker(m) {\n\t\t\tvar id = m.getAttribute(\"id\");\n\t\t\tvar title = m.getAttribute(\"title\");\n\t\t\tvar location = m.getAttribute(\"location\");\n\t\t\tvar description = m.getAttribute(\"description\");\n\t\t\tvar lat = parseFloat(m.getAttribute(\"lat\"));\n\t\t\tvar lng = parseFloat(m.getAttribute(\"lng\"));\n\t\t\tvar audio = m.getAttribute(\"audio\");\n\t\t\tvar latlng = new GLatLng(lat,lng);\n\t\t\tvar marker = new GMarker(latlng);\n\t\t\tGEvent.addListener(marker,\"click\", function() {\n\t\t\t\tclickFunction(\"\",id);\n\t\t\t});\n\t\t\treturn marker;\n\t\t}", "function marker_add_one(j, i, target, player_colour){\n\tvar half_square = settings.square_width / 2 \n\td3.select(\"svg\")\n\t\t.append(\"circle\")\n\t\t.attr('class', 'marker')\n\t\t.attr('row', j)\n\t\t.attr('square', i)\n\t\t.attr('target', target)\n\t\t.attr(\"cx\", square_get_pos(i) + half_square)\n\t\t.attr(\"cy\", square_get_pos(j) + half_square)\n\t\t.attr(\"r\", settings.radius)\n\t\t.style(\"stroke\", player_colour)\n\t\t.style(\"stroke-width\", settings.stroke_width)\n\t\t.style(\"fill\", player_colour)\n\t\t.on(\"click\", function(){\n\t\t\tconsole.log(this)\n\t\t\tgame_state.selected_marker = this;\n\t\t\tmarker_get_available_moves(this);\n\t\t});\n}", "function createNewMarker (lat, lng, icon) {\n\n var m = map.addMarker({\n lat: lat,\n lng: lng,\n icon: icon\n });\n\n return m;\n}", "function createMarker(point,html) {\n var marker = new GMarker(point);\n GEvent.addListener(marker, \"click\", function() {\n marker.openInfoWindowHtml(html);\n });\n return marker;\n}", "function addMarker(marker) {\n var region = marker[\"Region\"];\n var category = marker[\"Asset.Category\"];\n var projectName = marker[\"Project.Name\"];\n var projectNum = marker[\"Project.Num\"];\n var pos = new google.maps.LatLng(marker[\"Latitude\"], marker[\"Longitude\"]);\n var infeaMultiplierCat = marker['INFEA.Multiplier.Category'];\n var program = marker['Program'];\n var totalEligibleCost = marker['Total.Eligible.Costs'];\n var programContribution = marker['Program.Contribution'];\n var constructionStartDate = marker['Construction.Start.Date'];\n var constructionEndDate = marker['Construction.End.Date'];\n var totalJobsEligible = marker['Total.Jobs.Eligible'];\n var directJobsEligible = marker['Direct.Jobs.Eligible'];\n var totalValueAddedEligible = marker['Total.Value.Added.Eligible'];\n var directValueAddedEligible = marker['Direct.Value.Added.Eligible'];\n var totalCompensationEligible = marker['Total.Compensation.Eligible'];\n var directCompensationEligible = marker['Direct.Compensation.Eligible'];\n var importsContribution = marker['Imports.Contribution'];\n var taxesContribution = marker['Taxes.Contribution'];\n \n var content = \"<h3 class='mrgn-tp-0'>\" + projectName + \" (\" + projectNum + \")</h3>\" +\n \"<dl class=\\\"mrgn-tp-md dl-horizontal\\\">\" +\n \t\t\t\"<dt>Asset Type:</dt> <dd>\"+ infeaMultiplierCat +\"</dd>\" +\n \t\t\t\"<dt>Program:</dt> <dd>\"+ program +\"</dd>\" +\n \t\t\t\"<dt>INFEA Asset Category:</dt> <dd>\"+ category +\"</dd>\" +\n \t\t\t\"<dt>Total Eligible Cost:</dt> <dd>\"+ totalEligibleCost +\"</dd>\" +\n \t\t\t\"<dt>Federal Contribution:</dt> <dd>\"+ programContribution +\"</dd>\" +\n \t\t\t\"<dt>Forecasted Start Date:</dt> <dd>\"+ constructionStartDate +\"</dd>\" +\n \t\t\t\"<dt>Forecasted End Date:</dt> <dd>\"+ constructionEndDate +\"</dd>\" +\n \t\t\t\"<dt>Jobs created:</dt> <dd>\"+ totalJobsEligible +\" (\"+ directJobsEligible +\" direct)</dd>\" +\n \t\t\t\"<dt>Value Added:</dt> <dd>\"+ totalValueAddedEligible +\" (\"+ directValueAddedEligible +\" direct)</dd>\" +\n \t\t\t\"<dt>Employee compensation:</dt> <dd>\"+ totalCompensationEligible +\" (\"+ directCompensationEligible +\" direct)</dd>\" +\n \t\t\t\"<dt>Imports:</dt> <dd>\"+ importsContribution +\"</dd>\" +\n\t\t\t\t\"<dt>Taxes on products:</dt> <dd>\"+ taxesContribution +\"</dd>\" +\n \t\t\t\"</dl>\"\n \n marker1 = new google.maps.Marker({\n projectName: projectName,\n\tprojectNum: projectNum,\n position: pos,\n region: region,\n category: category,\n\tinfeaMultiplierCat: infeaMultiplierCat,\n\tprogram: program,\n\ttotalEligibleCost: totalEligibleCost,\n\tprogramContribution: programContribution,\n\tconstructionStartDate: constructionStartDate,\n\tconstructionEndDate: constructionEndDate,\n\ttotalJobsEligible: totalJobsEligible,\n\tdirectJobsEligible: directJobsEligible,\n\ttotalValueAddedEligible: totalValueAddedEligible,\n\tdirectValueAddedEligible: directValueAddedEligible,\n\ttotalCompensationEligible: totalCompensationEligible,\n\tdirectCompensationEligible: directCompensationEligible,\n\timportsContribution: importsContribution,\n\ttaxesContribution: taxesContribution,\n map: map\n });\n\n gmarkers1.push(marker1);\n\n infowindow = new google.maps.InfoWindow({\n content: ''\n});\n // Marker click listener\n google.maps.event.addListener(marker1, 'click', (function(marker1, content) {\n return function() {\n console.log('Gmarker 1 gets pushed');\n infowindow.setContent(content);\n infowindow.open(map, marker1);\n map.panTo(this.getPosition());\n //map.setZoom(15);\n }\n })(marker1, content));\n}", "function addMarker(e) {\n\n // Position calculations\n const xWidth = hero.width;\n const yHeight = hero.height;\n const xPosition = e.pageX - this.offsetLeft;\n const yPosition = e.pageY - this.offsetTop;\n const x = (xPosition / xWidth) * 100;\n const y = (yPosition / yHeight) * 100;\n\n // Create new marker element\n const newMarker = document.createElement('div');\n\n newMarker.classList.add('note_marker');\n newMarker.style.left = (x - 0.5)+ '%';\n newMarker.style.top = (y - 1) + '%';\n\n // Create the marker content\n const noteContent = document.createElement('div');\n noteContent.classList.add('note_content');\n\n const noteContentInput = document.createElement('textarea');\n //noteContentInput.setAttribute('type', 'text');\n noteContentInput.classList.add('note_input');\n\n // Build the marker\n noteContent.appendChild(noteContentInput);\n newMarker.appendChild(noteContent);\n canvas.appendChild(newMarker);\n\n // Create the marker data object\n const markerData = {\n id: data.length,\n x: x,\n y: y,\n text: noteContentInput.value\n }\n\n // Push marker data to data object\n data.push(markerData);\n\n // Add marker data to local storage\n localStorage.setItem('data', JSON.stringify(data));\n}", "function createMarker(truck) {\n\t\tvar marker = new google.maps.Marker({\n\t\t\tposition: new google.maps.LatLng(truck.Latitude, truck.Longitude),\n\t\t\tmap: map,\n\t\t\ttitle: truck.Applicant\n\t\t});\n\n\t\tgoogle.maps.event.addListener(marker, 'click', function() {\n\t\t\tmarkerClick(marker);\n\t\t});\n\n\t\tmarkers.push(marker);\n\t\t//console.log(markers);\n\t}", "function addMarker(marker) {\n addRow(marker);\n var lat = parseFloat(marker.lat);\n var lng = parseFloat(marker.lng);\n var latlng = new google.maps.LatLng(lat, lng);\n\n var contentInfo = '<p>' + marker.name + '</p>';\n var infoWindow = new google.maps.InfoWindow({\n content: contentInfo\n });\n\n var marker = new google.maps.Marker({\n position: latlng,\n map: map,\n title: 'Click to zoom',\n// icon: '../images/pin-hrc.png'\n });\n\n marker.addListener('click', function () {\n infoWindow.open(map, marker);\n });\n\n markers.push(marker);\n\n}", "appendInto(container){this.startNode=container.appendChild(createMarker());this.endNode=container.appendChild(createMarker())}", "constructor(pos, mark) {\n super();\n this.pos = pos;\n this.mark = mark;\n }", "constructor(pos, mark) {\n super();\n this.pos = pos;\n this.mark = mark;\n }", "function create_marker_object(point,id,type,cu){\n var icon,icon_s;\n var tab =[];\n tab = choose_type_marker(type);\n var markerOptions ={\n position: point,\n map:mapa,\n clickable:true,\n icon: tab[0],\n shadow:tab[1]\n }\n\n marker = new google.maps.Marker(markerOptions);\n marker.set(\"id\",id);\n if(type == \"photo\"){\n marker.set(\"photo\",true);\n }\n if(cu){\n marker.set(\"cu\",true);\n }\n return marker;\n}", "function createPinMarker(json){\n var latlng = [json['lat'],json['lon']];\n // create a new marker because it's the first time we see it\n var marker = L.marker(latlng, {\n icon: L.mapbox.marker.icon({\n 'marker-color': json.color\n })\n });\n return marker;\n}" ]
[ "0.706403", "0.6922555", "0.6829682", "0.67605793", "0.6707079", "0.66788775", "0.6592433", "0.6586964", "0.6577096", "0.6535049", "0.645897", "0.6454014", "0.6452927", "0.644539", "0.6428748", "0.64162165", "0.63716215", "0.6367775", "0.63661844", "0.6362076", "0.6345258", "0.6331433", "0.6329799", "0.6328131", "0.63247323", "0.63241607", "0.6323795", "0.63081896", "0.6284716", "0.62742126", "0.62676036", "0.6241865", "0.62395686", "0.6231036", "0.62109774", "0.6199882", "0.6197043", "0.6186873", "0.6186873", "0.6174496", "0.6166609", "0.6158895", "0.61504185", "0.6129165", "0.6117985", "0.6117985", "0.61055285", "0.609525", "0.6080062", "0.6077499", "0.607691", "0.6065228", "0.6064261", "0.6062357", "0.6052499", "0.6049051", "0.60418946", "0.6021104", "0.6021104", "0.6015337", "0.6013844", "0.60137135", "0.6013563", "0.6006018", "0.6005652", "0.6005652", "0.60036117", "0.5994715", "0.5989999", "0.5981383", "0.5980921", "0.5972758", "0.59676665", "0.5966349", "0.5949501", "0.5943849", "0.594381", "0.5933662", "0.5931558", "0.59260434", "0.592365", "0.5922457", "0.5921625", "0.5919589", "0.5913643", "0.5910147", "0.5905167", "0.5900796", "0.58954144", "0.5892433", "0.58900756", "0.5889828", "0.5887932", "0.5882474", "0.5872027", "0.58674645", "0.58622515", "0.586208", "0.586208", "0.5856015", "0.5851559" ]
0.0
-1
These must be handled carefully, because naively registering a handler for each editor will cause the editors to never be garbage collected.
function forEachCodeMirror(f) { if (!document.getElementsByClassName) { return } var byClass = document.getElementsByClassName("CodeMirror"); for (var i = 0; i < byClass.length; i++) { var cm = byClass[i].CodeMirror; if (cm) { f(cm); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _registerHandlers(editor) {\n $(editor).on(\"keyEvent\", _cursorHandler);\n $(editor.document).one(\"change\", _handler);\n editor.document.addRef();\n }", "getEditorListeners() {\n return {\n focusout: 'onEditorFocusOut',\n focusin: 'onEditorFocusIn',\n start: 'onEditorStart',\n beforecomplete: 'onEditorBeforeComplete',\n complete: 'onEditorComplete',\n cancel: 'onEditorCancel',\n thisObj: this\n };\n }", "getEditorListeners() {\n return {\n focusout: 'onEditorFocusOut',\n focusin: 'onEditorFocusIn',\n start: 'onEditorStart',\n beforecomplete: 'onEditorBeforeComplete',\n complete: 'onEditorComplete',\n cancel: 'onEditorCancel',\n thisObj: this\n };\n }", "function addEditorListener() {\n\t\t$('.editing .edit').on('keyup', function(e) {\n\t\t\tcheckEditPress(e);\n\t\t})\n\n\t}", "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}", "handleTextEvents(editor) {\n editor.getBuffer().onWillSave(() => {\n if (this.shouldFormatOnSave() && this.hasElixirGrammar(editor)) {\n formatter.formatTextEditor(editor);\n }\n });\n }", "initEventListners() {\n this.engine.getSession().selection.on('changeCursor', () => this.updateCursorLabels());\n\n this.engine.getSession().on('change', (e) => {\n // console.log(e);\n\n // Make sure the editor has content before allowing submissions\n this.allowCodeSubmission = this.engine.getValue() !== '';\n this.enableRunButton(this.allowCodeSubmission);\n });\n }", "function wrapEventHandler(externalHandler) {\n return function (instance) {\n externalHandler(editor);\n };\n }", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EditorCleanup() {\n SwitchInsertCharToAnotherEditorOrClose();\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 }", "_initEvents() {\n window.addEventListener(\"submitCommand\", event => this._processInput(event.detail));\n this.input.editableNode.onkeypress = () => {\n if (this.mode == Editor.MODE_INSERT)\n this.modificationSaved = false;\n };\n this.input.editableNode.onkeydown = event => {\n let keycode = event.keyCode;\n if (this.mode != Editor.MODE_INSERT && keycode !== 37 && keycode !== 38 && keycode !== 39 && keycode !== 40) {\n if (keycode !== Editor.KEY_TOGGLE_MODE_COMMAND)\n event.preventDefault();\n }\n }\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}", "_listenSpecsEditorEvents() {\n // listen for save\n this.addEventListener('s-specs-editor.ready', (e) => __awaiter(this, void 0, void 0, function* () {\n // store the specs editor reference\n this._$specsEditor = e.target;\n }));\n // listen for save\n this.addEventListener('s-specs-editor.save', (e) => __awaiter(this, void 0, void 0, function* () {\n this._currentNode.save();\n }));\n // listen for actual updated\n this.addEventListener('s-specs-editor.change', (e) => __awaiter(this, void 0, void 0, function* () {\n // apply the component\n this.applyComponent(e.detail.values);\n }));\n // listen for media change in the specs editor\n this.addEventListener('s-specs-editor.changeMedia', (e) => {\n // change the media internaly\n this._activateMedia(e.detail);\n });\n }", "function vB_AJAX_QuickEditor_Events()\n{\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 registerHandlers()\n {\n component.click(showInput);\n component.click(function(){\n list.children('li').removeClass('mt-selected');\n });\n input.on('change',inputOnchange);\n $(document).on('click','.mt-token-erase', function() {\n $(this).parent().remove();\n });\n input.on('keydown',inputKeydown);\n document.getElementById('mailtoken').addEventListener(\"keydown\", documentKeydown); //or however you are calling your method\n\n }", "registerHandlers() {\n $(document).keydown(event => {\n if (event.ctrlKey && event.keyCode === 13) {\n if (this.state.isTimeout) {\n alertify.error(i18n.errorTooOften);\n return;\n }\n \n const contextExtractor = new ContextExtractor();\n const selection = this.getSelectedText();\n this.selectionContext = contextExtractor.getContextForSelection();\n\n if (selection === \"\") {\n return;\n }\n\n if (selection.length < config.minTypoLength || \n selection.length > config.maxTypoLength) \n {\n alertify.error(i18n.formatString(i18n.errorSelectionLength, \n config.minTypoLength, config.maxTypoLength));\n \n return;\n }\n\n this.typo = selection;\n\n this.disableTypoHighlighting();\n\n // Ctrl-Enter pressed\n this.setState({\n correctionMode: true\n });\n }\n });\n }", "function init_handlers (curr) {\n\t\t\n\t\t/*** Handler for mouse move on content **/\n\t\t curr.on('mousemove', function (ev) {\n\t\t\t handle_mousemove_on_content(ev);\n\t\t });\n\n\t\t /** Handler for mouse click on content **/\n\t\t curr.on('click', function (ev) {\n\t\t handle_mouseclick_on_content(ev);\n\t\t });\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t \n\t\t /** Handler for mouse click on content **/\n\t\t curr.on('mouseleave', function (ev) {\n\t\t handle_mouseleave_from_content(ev);\n\t\t });\n\n\t\t /** Handler for mouse enter on content **/\n\t\t curr.on('mouseenter', function (ev) {\n\t\t \t handle_mouseenter_on_content (ev);\n\t\t });\n\t}", "connectedCallback(){super.connectedCallback();let root=this;document.addEventListener(\"selectionchange\",e=>{root.range=root.getRange()});document.addEventListener(\"select-rich-text-editor-editor\",e=>{root._editorChange(e)});document.addEventListener(\"deselect-rich-text-editor-editor\",e=>{root._editorChange(e)})}", "init(ids) {\n initEditors(ids)\n }", "function init() {\n\n\t\t// Bind the editor elements to variables\n\t\tbindElements();\n\n\t\t// Create event listeners for keyup, mouseup, etc.\n\t\tcreateEventBindings();\n\t}", "function _onEditorConnect(editor) {\n\t\tconsole.log(\"Editor connected\");\n\n\t\t// Called when a potential old editor was disconnected (i.e. multiple instances of Brackets are not supported)\n\t\tvar next = function () {\n\t\t\t_setupEditor(editor);\n\t\t\t_connectDebugger();\n\t\t};\n\n\t\tif (_editor) {\n\t\t\t// Cleanup\n\t\t\tconsole.log(\"Disconnecting previous editor\");\n\t\t\t_editor.on(\"disconnect\", next);\n\t\t\t_editor.disconnect();\n\t\t} else {\n\t\t\tnext();\n\t\t}\n\t}", "function ckeInitEvents(editor) {\n\t\n\teditor.on('blur', ckeBlurEvent);\n\teditor.on('focus', ckeFocusEvent);\n\teditor.on('change', ckeBlurEvent);\n\teditor.on('resize', ckeResizeEvent);\n\teditor.on('fileUploadRequest', ckeUploadEvent, null, null, 4); \n\n\tvar $textarea = $(editor.element.$);\n\tvar $inputfield = $textarea.closest('.Inputfield.InputfieldColumnWidth');\n\t\n\tif($inputfield.length) setTimeout(function() {\n\t\t$inputfield.trigger('heightChanged');\n\t}, 1000);\n}", "init() {\n // Get saved editor settings if any or default values from SettingsHandler\n const initialLanguage = settingsHandler.getEditorLanguageMode();\n const initialContent = settingsHandler.getEditorContent();\n\n this.engine.setTheme('ace/theme/monokai');\n this.engine.$blockScrolling = Infinity;\n this.engine.setShowPrintMargin(false);\n // Define the language mode for syntax highlighting and editor content\n this.engine.getSession().setMode({path:'ace/mode/' + initialLanguage, inline:true});\n this.engine.setValue(initialContent);\n\n this.initEventListners();\n }", "function update_textarea_handlers(){\n\n\t$('.wmd-wrapper').click(function () {\n\t\tif (!$(this).find('textarea').hasClass('expand')){\n\t\t\t$('.wmd-input').removeClass('expand');\n\t\t\t$('.wmd-preview').hide();\n\t\t\t$(this).find('textarea').addClass('expand');\n\t\t\t$(this).find('.wmd-preview').show();\n\t\t}\n\t});\n}", "function register_handlers(handlers) {\n $.each(handlers, function(selector, handler) {\n // register each handler\n self.handler(selector, function() {\n // bind self as an argument for the custom handler\n return handler.apply(this, [self]);\n });\n });\n }", "function initEditor() {\n checkSetup();\n initFirebase();\n initConstants();\n initCanvas();\n initButton();\n initEditorData();\n initEventHandlers();\n resetEditor();\n initGrid();\n initSelectorContent();\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})}}}", "function addTextEditorObserver(editor, files, view) {\n // console.log(arguments);\n var onSelectorUpdate = function onSelectorUpdate(compiledSelectors) {\n // console.dir(compiledSelectors);\n var str = createOutputString(compiledSelectors);\n view.innerHTML = str;\n };\n\n addSelectionListener(editor, files, onSelectorUpdate);\n}", "static createEditors(editors) {\n for (var i = 0, editor; i < editors.length; i++) {\n editor = editors[i];\n var textarea = document.querySelector('textarea[name=\\\"' + editor.name + '\\\"]');\n if (textarea) {\n if(!editor.mode) {\n editor.mode = Preferences.get('editor.defaultMode');\n }\n console.log('Found editor', editor);\n\n var fullscreenImmediately = false;\n // in certain situations we go straight into fullscreen editing!!\n if(editor.name === 'content') {\n let queryParams = decodeURI(window.location.search)\n .substring(1)\n .split('&')\n .map(param => param.split('='))\n .reduce((values, [ key, value ]) => {\n values[ key ] = value\n return values\n }, {});\n if(queryParams['mode']) {\n fullscreenImmediately = true;\n editor.mode = queryParams['mode'];\n }\n }\n\n var e = new Editor(editor.name, editor.language, editor.mode, editor.readOnly, editor.stylesheets);\n if(fullscreenImmediately) {\n e.fullscreenToggle.set(true);\n }\n\n Editor.list.push(e);\n } else {\n console.log('Editor not found');\n console.log(editor);\n }\n }\n }", "function registerEventHandlers(cm) {\n var d = cm.display;\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\n // Older IE's will not fire a second mousedown for a double click\n if (ie && ie_version < 11)\n on(d.scroller, \"dblclick\", operation(cm, function(e) {\n if (signalDOMEvent(cm, e)) return;\n var pos = posFromMouse(cm, e);\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;\n e_preventDefault(e);\n var word = cm.findWordAt(pos);\n extendSelection(cm.doc, word.anchor, word.head);\n }));\n else\n on(d.scroller, \"dblclick\", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });\n // Prevent normal selection in the editor (we handle our own)\n on(d.lineSpace, \"selectstart\", function(e) {\n if (!eventInWidget(d, e)) e_preventDefault(e);\n });\n // Some browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for these browsers.\n if (!captureRightClick) on(d.scroller, \"contextmenu\", function(e) {onContextMenu(cm, e);});\n\n // Sync scrolling between fake scrollbars and real scrollable\n // area, ensure viewport is updated when scrolling.\n on(d.scroller, \"scroll\", function() {\n if (d.scroller.clientHeight) {\n setScrollTop(cm, d.scroller.scrollTop);\n setScrollLeft(cm, d.scroller.scrollLeft, true);\n signal(cm, \"scroll\", cm);\n }\n });\n\n // Listen to wheel events in order to try and update the viewport on time.\n on(d.scroller, \"mousewheel\", function(e){onScrollWheel(cm, e);});\n on(d.scroller, \"DOMMouseScroll\", function(e){onScrollWheel(cm, e);});\n\n // Prevent wrapper from ever scrolling\n on(d.wrapper, \"scroll\", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });\n\n on(d.input, \"keyup\", function(e) { onKeyUp.call(cm, e); });\n on(d.input, \"input\", function() {\n if (ie && ie_version >= 9 && cm.display.inputHasSelection) cm.display.inputHasSelection = null;\n readInput(cm);\n });\n on(d.input, \"keydown\", operation(cm, onKeyDown));\n on(d.input, \"keypress\", operation(cm, onKeyPress));\n on(d.input, \"focus\", bind(onFocus, cm));\n on(d.input, \"blur\", bind(onBlur, cm));\n\n function drag_(e) {\n if (!signalDOMEvent(cm, e)) e_stop(e);\n }\n if (cm.options.dragDrop) {\n on(d.scroller, \"dragstart\", function(e){onDragStart(cm, e);});\n on(d.scroller, \"dragenter\", drag_);\n on(d.scroller, \"dragover\", drag_);\n on(d.scroller, \"drop\", operation(cm, onDrop));\n }\n on(d.scroller, \"paste\", function(e) {\n if (eventInWidget(d, e)) return;\n cm.state.pasteIncoming = true;\n focusInput(cm);\n fastPoll(cm);\n });\n on(d.input, \"paste\", function() {\n // Workaround for webkit bug https://bugs.webkit.org/show_bug.cgi?id=90206\n // Add a char to the end of textarea before paste occur so that\n // selection doesn't span to the end of textarea.\n if (webkit && !cm.state.fakedLastChar && !(new Date - cm.state.lastMiddleDown < 200)) {\n var start = d.input.selectionStart, end = d.input.selectionEnd;\n d.input.value += \"$\";\n // The selection end needs to be set before the start, otherwise there\n // can be an intermediate non-empty selection between the two, which\n // can override the middle-click paste buffer on linux and cause the\n // wrong thing to get pasted.\n d.input.selectionEnd = end;\n d.input.selectionStart = start;\n cm.state.fakedLastChar = true;\n }\n cm.state.pasteIncoming = true;\n fastPoll(cm);\n });\n\n function prepareCopyCut(e) {\n if (cm.somethingSelected()) {\n lastCopied = cm.getSelections();\n if (d.inaccurateSelection) {\n d.prevInput = \"\";\n d.inaccurateSelection = false;\n d.input.value = lastCopied.join(\"\\n\");\n selectInput(d.input);\n }\n } else {\n var text = [], ranges = [];\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n var line = cm.doc.sel.ranges[i].head.line;\n var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\n ranges.push(lineRange);\n text.push(cm.getRange(lineRange.anchor, lineRange.head));\n }\n if (e.type == \"cut\") {\n cm.setSelections(ranges, null, sel_dontScroll);\n } else {\n d.prevInput = \"\";\n d.input.value = text.join(\"\\n\");\n selectInput(d.input);\n }\n lastCopied = text;\n }\n if (e.type == \"cut\") cm.state.cutIncoming = true;\n }\n on(d.input, \"cut\", prepareCopyCut);\n on(d.input, \"copy\", prepareCopyCut);\n\n // Needed to handle Tab key in KHTML\n if (khtml) on(d.sizer, \"mouseup\", function() {\n if (activeElt() == d.input) d.input.blur();\n focusInput(cm);\n });\n }", "function registerEventHandlers(cm) {\n var d = cm.display;\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\n // Older IE's will not fire a second mousedown for a double click\n if (ie && ie_version < 11)\n on(d.scroller, \"dblclick\", operation(cm, function(e) {\n if (signalDOMEvent(cm, e)) return;\n var pos = posFromMouse(cm, e);\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;\n e_preventDefault(e);\n var word = cm.findWordAt(pos);\n extendSelection(cm.doc, word.anchor, word.head);\n }));\n else\n on(d.scroller, \"dblclick\", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });\n // Prevent normal selection in the editor (we handle our own)\n on(d.lineSpace, \"selectstart\", function(e) {\n if (!eventInWidget(d, e)) e_preventDefault(e);\n });\n // Some browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for these browsers.\n if (!captureRightClick) on(d.scroller, \"contextmenu\", function(e) {onContextMenu(cm, e);});\n\n // Sync scrolling between fake scrollbars and real scrollable\n // area, ensure viewport is updated when scrolling.\n on(d.scroller, \"scroll\", function() {\n if (d.scroller.clientHeight) {\n setScrollTop(cm, d.scroller.scrollTop);\n setScrollLeft(cm, d.scroller.scrollLeft, true);\n signal(cm, \"scroll\", cm);\n }\n });\n\n // Listen to wheel events in order to try and update the viewport on time.\n on(d.scroller, \"mousewheel\", function(e){onScrollWheel(cm, e);});\n on(d.scroller, \"DOMMouseScroll\", function(e){onScrollWheel(cm, e);});\n\n // Prevent wrapper from ever scrolling\n on(d.wrapper, \"scroll\", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });\n\n on(d.input, \"keyup\", function(e) { onKeyUp.call(cm, e); });\n on(d.input, \"input\", function() {\n if (ie && ie_version >= 9 && cm.display.inputHasSelection) cm.display.inputHasSelection = null;\n readInput(cm);\n });\n on(d.input, \"keydown\", operation(cm, onKeyDown));\n on(d.input, \"keypress\", operation(cm, onKeyPress));\n on(d.input, \"focus\", bind(onFocus, cm));\n on(d.input, \"blur\", bind(onBlur, cm));\n\n function drag_(e) {\n if (!signalDOMEvent(cm, e)) e_stop(e);\n }\n if (cm.options.dragDrop) {\n on(d.scroller, \"dragstart\", function(e){onDragStart(cm, e);});\n on(d.scroller, \"dragenter\", drag_);\n on(d.scroller, \"dragover\", drag_);\n on(d.scroller, \"drop\", operation(cm, onDrop));\n }\n on(d.scroller, \"paste\", function(e) {\n if (eventInWidget(d, e)) return;\n cm.state.pasteIncoming = true;\n focusInput(cm);\n fastPoll(cm);\n });\n on(d.input, \"paste\", function() {\n // Workaround for webkit bug https://bugs.webkit.org/show_bug.cgi?id=90206\n // Add a char to the end of textarea before paste occur so that\n // selection doesn't span to the end of textarea.\n if (webkit && !cm.state.fakedLastChar && !(new Date - cm.state.lastMiddleDown < 200)) {\n var start = d.input.selectionStart, end = d.input.selectionEnd;\n d.input.value += \"$\";\n // The selection end needs to be set before the start, otherwise there\n // can be an intermediate non-empty selection between the two, which\n // can override the middle-click paste buffer on linux and cause the\n // wrong thing to get pasted.\n d.input.selectionEnd = end;\n d.input.selectionStart = start;\n cm.state.fakedLastChar = true;\n }\n cm.state.pasteIncoming = true;\n fastPoll(cm);\n });\n\n function prepareCopyCut(e) {\n if (cm.somethingSelected()) {\n lastCopied = cm.getSelections();\n if (d.inaccurateSelection) {\n d.prevInput = \"\";\n d.inaccurateSelection = false;\n d.input.value = lastCopied.join(\"\\n\");\n selectInput(d.input);\n }\n } else {\n var text = [], ranges = [];\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n var line = cm.doc.sel.ranges[i].head.line;\n var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\n ranges.push(lineRange);\n text.push(cm.getRange(lineRange.anchor, lineRange.head));\n }\n if (e.type == \"cut\") {\n cm.setSelections(ranges, null, sel_dontScroll);\n } else {\n d.prevInput = \"\";\n d.input.value = text.join(\"\\n\");\n selectInput(d.input);\n }\n lastCopied = text;\n }\n if (e.type == \"cut\") cm.state.cutIncoming = true;\n }\n on(d.input, \"cut\", prepareCopyCut);\n on(d.input, \"copy\", prepareCopyCut);\n\n // Needed to handle Tab key in KHTML\n if (khtml) on(d.sizer, \"mouseup\", function() {\n if (activeElt() == d.input) d.input.blur();\n focusInput(cm);\n });\n }", "function TinyMCE_Engine() {\n\tthis.instances = new Array();\n\tthis.configs = new Array();\n\tthis.currentConfig = 0;\n\tthis.eventHandlers = new Array();\n\tthis.switchClassCache = new Array();\n\n\t// Browser check\n\tthis.isMSIE = IS_IE;\t\t\n\tthis.isGecko = IS_MOZILLA;\t\n\tthis.isSafari = IS_SAFARI;\t\n\tthis.isOpera = IS_OPERA;\n\tthis.isMSIE7 = IS_IE7;\n\tthis.isKonqueror = IS_KONQUEROR;\n\t\n\tthis.settings = new Array();\n\t\n\t// Fake MSIE on Opera and if Opera fakes IE, Gecko or Safari cancel those\n\tif (this.isOpera) {\n\t\tthis.isMSIE = true;\n\t\tthis.isGecko = false;\n\t\tthis.isSafari = false;\n\t\tif (USER_AGENT.match(/opera\\/9\\.50/)) {\n\t\t\tthis.isOpera95 = true;\n\t\t}\n\t}\n\telse if (this.isSafari) {\n\t\tthis.isGecko = true;\n\t\tif (USER_AGENT.match(/version\\/3\\./i) || USER_AGENT.match(/chrome/i)) {\n\t\t\tthis.isSafari3 = true;\t\n\t\t\tthis.isSafari = false;\n\t\t}\n\t}\n\n\t// TinyMCE editor id instance counter\n\tthis.idCounter = 0;\n\t\n\t// flag to detect if simplearea is active\n\tthis.isSimpleTextarea = false;\n\t// TODO: this should be dynamic to be able to create more than one simple area.\n\tthis.simpleAreaID = 'text';\n\tthis.simpleTextarea = null;\n\t\n\t// define elements which should be a tiny-wysiwyg editor\n\tthis.elements = ['text'];\n\t\n\t// define tab ids and active class\n\tthis.codeTabID = \"codeTab\";\n\tthis.editorTabID = \"editorTab\";\n\tthis.tabsActiveClass = \"activeTabMenu\";\n\t\t\n\t//... order in which the toolbarelements should apear:\n\tthis.toolElements = [[\"font\",\"size\",\"separator\",\"b\",\"i\",\"u\",\"s\",\"separator\",\"align\",\"separator\",\"list\",\"separator\",\"color\",\"break\"], \n\t\t\t[\"undo\",\"redo\",\"separator\",\"url\",\"separator\",\"img\",\"separator\",\"quotation\",\"quote\",\"code\"]];//\"copy\",\"cut\",\"paste\",\"separator\",\t\t\n\t\n}", "function registerEventHandlers(cm) {\n var d = cm.display;\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\n // Older IE's will not fire a second mousedown for a double click\n if (ie && ie_version < 11)\n on(d.scroller, \"dblclick\", operation(cm, function(e) {\n if (signalDOMEvent(cm, e)) return;\n var pos = posFromMouse(cm, e);\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;\n e_preventDefault(e);\n var word = findWordAt(cm, pos);\n extendSelection(cm.doc, word.anchor, word.head);\n }));\n else\n on(d.scroller, \"dblclick\", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });\n // Prevent normal selection in the editor (we handle our own)\n on(d.lineSpace, \"selectstart\", function(e) {\n if (!eventInWidget(d, e)) e_preventDefault(e);\n });\n // Some browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for these browsers.\n if (!captureRightClick) on(d.scroller, \"contextmenu\", function(e) {onContextMenu(cm, e);});\n\n // Sync scrolling between fake scrollbars and real scrollable\n // area, ensure viewport is updated when scrolling.\n on(d.scroller, \"scroll\", function() {\n if (d.scroller.clientHeight) {\n setScrollTop(cm, d.scroller.scrollTop);\n setScrollLeft(cm, d.scroller.scrollLeft, true);\n signal(cm, \"scroll\", cm);\n }\n });\n on(d.scrollbarV, \"scroll\", function() {\n if (d.scroller.clientHeight) setScrollTop(cm, d.scrollbarV.scrollTop);\n });\n on(d.scrollbarH, \"scroll\", function() {\n if (d.scroller.clientHeight) setScrollLeft(cm, d.scrollbarH.scrollLeft);\n });\n\n // Listen to wheel events in order to try and update the viewport on time.\n on(d.scroller, \"mousewheel\", function(e){onScrollWheel(cm, e);});\n on(d.scroller, \"DOMMouseScroll\", function(e){onScrollWheel(cm, e);});\n\n // Prevent clicks in the scrollbars from killing focus\n function reFocus() { if (cm.state.focused) setTimeout(bind(focusInput, cm), 0); }\n on(d.scrollbarH, \"mousedown\", reFocus);\n on(d.scrollbarV, \"mousedown\", reFocus);\n // Prevent wrapper from ever scrolling\n on(d.wrapper, \"scroll\", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });\n\n on(d.input, \"keyup\", operation(cm, onKeyUp));\n on(d.input, \"input\", function() {\n if (ie && ie_version >= 9 && cm.display.inputHasSelection) cm.display.inputHasSelection = null;\n fastPoll(cm);\n });\n on(d.input, \"keydown\", operation(cm, onKeyDown));\n on(d.input, \"keypress\", operation(cm, onKeyPress));\n on(d.input, \"focus\", bind(onFocus, cm));\n on(d.input, \"blur\", bind(onBlur, cm));\n\n function drag_(e) {\n if (!signalDOMEvent(cm, e)) e_stop(e);\n }\n if (cm.options.dragDrop) {\n on(d.scroller, \"dragstart\", function(e){onDragStart(cm, e);});\n on(d.scroller, \"dragenter\", drag_);\n on(d.scroller, \"dragover\", drag_);\n on(d.scroller, \"drop\", operation(cm, onDrop));\n }\n on(d.scroller, \"paste\", function(e) {\n if (eventInWidget(d, e)) return;\n cm.state.pasteIncoming = true;\n focusInput(cm);\n fastPoll(cm);\n });\n on(d.input, \"paste\", function() {\n // Workaround for webkit bug https://bugs.webkit.org/show_bug.cgi?id=90206\n // Add a char to the end of textarea before paste occur so that\n // selection doesn't span to the end of textarea.\n if (webkit && !cm.state.fakedLastChar && !(new Date - cm.state.lastMiddleDown < 200)) {\n var start = d.input.selectionStart, end = d.input.selectionEnd;\n d.input.value += \"$\";\n // The selection end needs to be set before the start, otherwise there\n // can be an intermediate non-empty selection between the two, which\n // can override the middle-click paste buffer on linux and cause the\n // wrong thing to get pasted.\n d.input.selectionEnd = end;\n d.input.selectionStart = start;\n cm.state.fakedLastChar = true;\n }\n cm.state.pasteIncoming = true;\n fastPoll(cm);\n });\n\n function prepareCopyCut(e) {\n if (cm.somethingSelected()) {\n if (d.inaccurateSelection) {\n d.prevInput = \"\";\n d.inaccurateSelection = false;\n d.input.value = cm.getSelection();\n selectInput(d.input);\n }\n } else {\n var text = \"\", ranges = [];\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n var line = cm.doc.sel.ranges[i].head.line;\n var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\n ranges.push(lineRange);\n text += cm.getRange(lineRange.anchor, lineRange.head);\n }\n if (e.type == \"cut\") {\n cm.setSelections(ranges, null, sel_dontScroll);\n } else {\n d.prevInput = \"\";\n d.input.value = text;\n selectInput(d.input);\n }\n }\n if (e.type == \"cut\") cm.state.cutIncoming = true;\n }\n on(d.input, \"cut\", prepareCopyCut);\n on(d.input, \"copy\", prepareCopyCut);\n\n // Needed to handle Tab key in KHTML\n if (khtml) on(d.sizer, \"mouseup\", function() {\n if (activeElt() == d.input) d.input.blur();\n focusInput(cm);\n });\n }", "function registerEventHandlers(cm) {\n var d = cm.display;\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\n // Older IE's will not fire a second mousedown for a double click\n if (ie && ie_version < 11)\n on(d.scroller, \"dblclick\", operation(cm, function(e) {\n if (signalDOMEvent(cm, e)) return;\n var pos = posFromMouse(cm, e);\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;\n e_preventDefault(e);\n var word = findWordAt(cm, pos);\n extendSelection(cm.doc, word.anchor, word.head);\n }));\n else\n on(d.scroller, \"dblclick\", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });\n // Prevent normal selection in the editor (we handle our own)\n on(d.lineSpace, \"selectstart\", function(e) {\n if (!eventInWidget(d, e)) e_preventDefault(e);\n });\n // Some browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for these browsers.\n if (!captureRightClick) on(d.scroller, \"contextmenu\", function(e) {onContextMenu(cm, e);});\n\n // Sync scrolling between fake scrollbars and real scrollable\n // area, ensure viewport is updated when scrolling.\n on(d.scroller, \"scroll\", function() {\n if (d.scroller.clientHeight) {\n setScrollTop(cm, d.scroller.scrollTop);\n setScrollLeft(cm, d.scroller.scrollLeft, true);\n signal(cm, \"scroll\", cm);\n }\n });\n on(d.scrollbarV, \"scroll\", function() {\n if (d.scroller.clientHeight) setScrollTop(cm, d.scrollbarV.scrollTop);\n });\n on(d.scrollbarH, \"scroll\", function() {\n if (d.scroller.clientHeight) setScrollLeft(cm, d.scrollbarH.scrollLeft);\n });\n\n // Listen to wheel events in order to try and update the viewport on time.\n on(d.scroller, \"mousewheel\", function(e){onScrollWheel(cm, e);});\n on(d.scroller, \"DOMMouseScroll\", function(e){onScrollWheel(cm, e);});\n\n // Prevent clicks in the scrollbars from killing focus\n function reFocus() { if (cm.state.focused) setTimeout(bind(focusInput, cm), 0); }\n on(d.scrollbarH, \"mousedown\", reFocus);\n on(d.scrollbarV, \"mousedown\", reFocus);\n // Prevent wrapper from ever scrolling\n on(d.wrapper, \"scroll\", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });\n\n on(d.input, \"keyup\", function(e) { onKeyUp.call(cm, e); });\n on(d.input, \"input\", function() {\n if (ie && ie_version >= 9 && cm.display.inputHasSelection) cm.display.inputHasSelection = null;\n fastPoll(cm);\n });\n on(d.input, \"keydown\", operation(cm, onKeyDown));\n on(d.input, \"keypress\", operation(cm, onKeyPress));\n on(d.input, \"focus\", bind(onFocus, cm));\n on(d.input, \"blur\", bind(onBlur, cm));\n\n function drag_(e) {\n if (!signalDOMEvent(cm, e)) e_stop(e);\n }\n if (cm.options.dragDrop) {\n on(d.scroller, \"dragstart\", function(e){onDragStart(cm, e);});\n on(d.scroller, \"dragenter\", drag_);\n on(d.scroller, \"dragover\", drag_);\n on(d.scroller, \"drop\", operation(cm, onDrop));\n }\n on(d.scroller, \"paste\", function(e) {\n if (eventInWidget(d, e)) return;\n cm.state.pasteIncoming = true;\n focusInput(cm);\n fastPoll(cm);\n });\n on(d.input, \"paste\", function() {\n // Workaround for webkit bug https://bugs.webkit.org/show_bug.cgi?id=90206\n // Add a char to the end of textarea before paste occur so that\n // selection doesn't span to the end of textarea.\n if (webkit && !cm.state.fakedLastChar && !(new Date - cm.state.lastMiddleDown < 200)) {\n var start = d.input.selectionStart, end = d.input.selectionEnd;\n d.input.value += \"$\";\n // The selection end needs to be set before the start, otherwise there\n // can be an intermediate non-empty selection between the two, which\n // can override the middle-click paste buffer on linux and cause the\n // wrong thing to get pasted.\n d.input.selectionEnd = end;\n d.input.selectionStart = start;\n cm.state.fakedLastChar = true;\n }\n cm.state.pasteIncoming = true;\n fastPoll(cm);\n });\n\n function prepareCopyCut(e) {\n if (cm.somethingSelected()) {\n lastCopied = cm.getSelections();\n if (d.inaccurateSelection) {\n d.prevInput = \"\";\n d.inaccurateSelection = false;\n d.input.value = lastCopied.join(\"\\n\");\n selectInput(d.input);\n }\n } else {\n var text = [], ranges = [];\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n var line = cm.doc.sel.ranges[i].head.line;\n var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\n ranges.push(lineRange);\n text.push(cm.getRange(lineRange.anchor, lineRange.head));\n }\n if (e.type == \"cut\") {\n cm.setSelections(ranges, null, sel_dontScroll);\n } else {\n d.prevInput = \"\";\n d.input.value = text.join(\"\\n\");\n selectInput(d.input);\n }\n lastCopied = text;\n }\n if (e.type == \"cut\") cm.state.cutIncoming = true;\n }\n on(d.input, \"cut\", prepareCopyCut);\n on(d.input, \"copy\", prepareCopyCut);\n\n // Needed to handle Tab key in KHTML\n if (khtml) on(d.sizer, \"mouseup\", function() {\n if (activeElt() == d.input) d.input.blur();\n focusInput(cm);\n });\n }", "function registerEventHandlers(cm) {\n var d = cm.display;\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\n // Older IE's will not fire a second mousedown for a double click\n if (ie && ie_version < 11)\n on(d.scroller, \"dblclick\", operation(cm, function(e) {\n if (signalDOMEvent(cm, e)) return;\n var pos = posFromMouse(cm, e);\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;\n e_preventDefault(e);\n var word = findWordAt(cm, pos);\n extendSelection(cm.doc, word.anchor, word.head);\n }));\n else\n on(d.scroller, \"dblclick\", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });\n // Prevent normal selection in the editor (we handle our own)\n on(d.lineSpace, \"selectstart\", function(e) {\n if (!eventInWidget(d, e)) e_preventDefault(e);\n });\n // Some browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for these browsers.\n if (!captureRightClick) on(d.scroller, \"contextmenu\", function(e) {onContextMenu(cm, e);});\n\n // Sync scrolling between fake scrollbars and real scrollable\n // area, ensure viewport is updated when scrolling.\n on(d.scroller, \"scroll\", function() {\n if (d.scroller.clientHeight) {\n setScrollTop(cm, d.scroller.scrollTop);\n setScrollLeft(cm, d.scroller.scrollLeft, true);\n signal(cm, \"scroll\", cm);\n }\n });\n on(d.scrollbarV, \"scroll\", function() {\n if (d.scroller.clientHeight) setScrollTop(cm, d.scrollbarV.scrollTop);\n });\n on(d.scrollbarH, \"scroll\", function() {\n if (d.scroller.clientHeight) setScrollLeft(cm, d.scrollbarH.scrollLeft);\n });\n\n // Listen to wheel events in order to try and update the viewport on time.\n on(d.scroller, \"mousewheel\", function(e){onScrollWheel(cm, e);});\n on(d.scroller, \"DOMMouseScroll\", function(e){onScrollWheel(cm, e);});\n\n // Prevent clicks in the scrollbars from killing focus\n function reFocus() { if (cm.state.focused) setTimeout(bind(focusInput, cm), 0); }\n on(d.scrollbarH, \"mousedown\", reFocus);\n on(d.scrollbarV, \"mousedown\", reFocus);\n // Prevent wrapper from ever scrolling\n on(d.wrapper, \"scroll\", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });\n\n on(d.input, \"keyup\", function(e) { onKeyUp.call(cm, e); });\n on(d.input, \"input\", function() {\n if (ie && ie_version >= 9 && cm.display.inputHasSelection) cm.display.inputHasSelection = null;\n fastPoll(cm);\n });\n on(d.input, \"keydown\", operation(cm, onKeyDown));\n on(d.input, \"keypress\", operation(cm, onKeyPress));\n on(d.input, \"focus\", bind(onFocus, cm));\n on(d.input, \"blur\", bind(onBlur, cm));\n\n function drag_(e) {\n if (!signalDOMEvent(cm, e)) e_stop(e);\n }\n if (cm.options.dragDrop) {\n on(d.scroller, \"dragstart\", function(e){onDragStart(cm, e);});\n on(d.scroller, \"dragenter\", drag_);\n on(d.scroller, \"dragover\", drag_);\n on(d.scroller, \"drop\", operation(cm, onDrop));\n }\n on(d.scroller, \"paste\", function(e) {\n if (eventInWidget(d, e)) return;\n cm.state.pasteIncoming = true;\n focusInput(cm);\n fastPoll(cm);\n });\n on(d.input, \"paste\", function() {\n // Workaround for webkit bug https://bugs.webkit.org/show_bug.cgi?id=90206\n // Add a char to the end of textarea before paste occur so that\n // selection doesn't span to the end of textarea.\n if (webkit && !cm.state.fakedLastChar && !(new Date - cm.state.lastMiddleDown < 200)) {\n var start = d.input.selectionStart, end = d.input.selectionEnd;\n d.input.value += \"$\";\n // The selection end needs to be set before the start, otherwise there\n // can be an intermediate non-empty selection between the two, which\n // can override the middle-click paste buffer on linux and cause the\n // wrong thing to get pasted.\n d.input.selectionEnd = end;\n d.input.selectionStart = start;\n cm.state.fakedLastChar = true;\n }\n cm.state.pasteIncoming = true;\n fastPoll(cm);\n });\n\n function prepareCopyCut(e) {\n if (cm.somethingSelected()) {\n lastCopied = cm.getSelections();\n if (d.inaccurateSelection) {\n d.prevInput = \"\";\n d.inaccurateSelection = false;\n d.input.value = lastCopied.join(\"\\n\");\n selectInput(d.input);\n }\n } else {\n var text = [], ranges = [];\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n var line = cm.doc.sel.ranges[i].head.line;\n var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\n ranges.push(lineRange);\n text.push(cm.getRange(lineRange.anchor, lineRange.head));\n }\n if (e.type == \"cut\") {\n cm.setSelections(ranges, null, sel_dontScroll);\n } else {\n d.prevInput = \"\";\n d.input.value = text.join(\"\\n\");\n selectInput(d.input);\n }\n lastCopied = text;\n }\n if (e.type == \"cut\") cm.state.cutIncoming = true;\n }\n on(d.input, \"cut\", prepareCopyCut);\n on(d.input, \"copy\", prepareCopyCut);\n\n // Needed to handle Tab key in KHTML\n if (khtml) on(d.sizer, \"mouseup\", function() {\n if (activeElt() == d.input) d.input.blur();\n focusInput(cm);\n });\n }", "function addToEditors(win) { // 5526\n if (!win._mediumEditors) { // 5527\n // To avoid breaking users who are assuming that the unique id on\n // medium-editor elements will start at 1, inserting a 'null' in the\n // array so the unique-id can always map to the index of the editor instance\n win._mediumEditors = [null]; // 5531\n } // 5532\n // 5533\n // If this already has a unique id, re-use it // 5534\n if (!this.id) { // 5535\n this.id = win._mediumEditors.length; // 5536\n } // 5537\n // 5538\n win._mediumEditors[this.id] = this; // 5539\n } // 5540", "function editorNativeCallbacks(bridge) {\n // listen for cursor and selection position changes\n // editor.selection.on(\"changeCursor\",function() {\n\n // if (preventStateUpdates) {\n // return;\n // }\n \n // if (documentLoadEvent == false) {\n \n // var nativeData = getCursorData();\n\n // if (cursorUpdateTimer != undefined) {\n // window.clearTimeout(cursorUpdateTimer);\n // }\n // cursorUpdateTimer = window.setTimeout(function() {\n // bridge.callHandler(\"changeCursor\",nativeData);\n // }, 100);\n \n // }\n // });\n\n\n // listen for non-programmatic text changes\n editor.on(\"change\", function(changeData) {\n if (editor.curOp && editor.curOp.command.name) {\n // this is a user change\n textChangeEvent(bridge);\n }\n });\n\n editor.on(\"paste\", function() {\n textChangeEvent(bridge);\n });\n\n // window.setInterval(function() {\n // var cursorData = getCursorData();\n // var currentText = editor.getValue();\n\n // var nativeData = {\"text\": currentText, \"cursor\": cursorData};\n\n // bridge.callHandler(\"currentText\", nativeData);\n // },100);\n}", "loadEditors() {\r\n\r\n // Loading content for HTML editor\r\n this.editorHTML = ace.edit('editorHTML')\r\n this.editorHTML.setTheme('ace/theme/sqlserver')\r\n this.editorHTML.session.setMode('ace/mode/html')\r\n let htmlDoc = '<!DOCTYPE html>\\n<html>\\n<head>\\n\\t<meta charset=\"UTF-8\">\\n\\t<title>LWE</title>\\n</head>\\n<body>\\n\\t<div id=\"welcome\">\\n\\t\\t<h1 id=\"title\">Welcome to Live Web Editor</h1>\\n\\t\\t<p>Execute HTML, CSS and JavaScript code in real time quickly and easily</p>\\n\\t\\t<p>Wherever you want, whenever you want</p>\\n\\t</div>\\n</body>\\n</html>'\r\n this.editorHTML.insert(htmlDoc)\r\n this.editorHTML.gotoLine(11,53)\r\n this.editorHTML.setShowPrintMargin(false)\r\n\r\n // Loading content for CSS editor\r\n this.editorCSS = ace.edit('editorCSS')\r\n this.editorCSS.setTheme('ace/theme/sqlserver')\r\n this.editorCSS.session.setMode('ace/mode/css')\r\n let cssDoc = '* {\\n\\tmargin: 0;\\n\\tpadding: 0;\\n}\\n\\n#welcome {\\n\\tfont-family: \"Segoe UI\";\\n\\ttext-align: center;\\n\\tmargin-top: 15%;\\n}\\n\\n#welcome h1 {\\n\\tcolor: #87CEEB;\\n}\\n\\n#welcome p {\\n\\tcolor: #009DA3;\\n}'\r\n this.editorCSS.insert(cssDoc)\r\n this.editorCSS.gotoLine(17,16)\r\n this.editorCSS.setShowPrintMargin(false)\r\n\r\n // Loading content for JS editor\r\n this.editorJS = ace.edit('editorJS')\r\n this.editorJS.setTheme('ace/theme/sqlserver')\r\n this.editorJS.session.setMode('ace/mode/javascript')\r\n let jsDoc = '// Your code here...'\r\n this.editorJS.insert(jsDoc)\r\n this.editorJS.gotoLine(1, 20)\r\n this.editorJS.setShowPrintMargin(false)\r\n \r\n }", "function registerEventHandlers(cm) {\n var d = cm.display;\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\n // Older IE's will not fire a second mousedown for a double click\n if (ie && ie_version < 11)\n on(d.scroller, \"dblclick\", operation(cm, function(e) {\n if (signalDOMEvent(cm, e)) return;\n var pos = posFromMouse(cm, e);\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;\n e_preventDefault(e);\n var word = cm.findWordAt(pos);\n extendSelection(cm.doc, word.anchor, word.head);\n }));\n else\n on(d.scroller, \"dblclick\", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });\n // Prevent normal selection in the editor (we handle our own)\n on(d.lineSpace, \"selectstart\", function(e) {\n if (!eventInWidget(d, e)) e_preventDefault(e);\n });\n // Some browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for these browsers.\n if (!captureRightClick) on(d.scroller, \"contextmenu\", function(e) {onContextMenu(cm, e);});\n\n // Sync scrolling between fake scrollbars and real scrollable\n // area, ensure viewport is updated when scrolling.\n on(d.scroller, \"scroll\", function() {\n if (d.scroller.clientHeight) {\n setScrollTop(cm, d.scroller.scrollTop);\n setScrollLeft(cm, d.scroller.scrollLeft, true);\n signal(cm, \"scroll\", cm);\n }\n });\n on(d.scrollbarV, \"scroll\", function() {\n if (d.scroller.clientHeight) setScrollTop(cm, d.scrollbarV.scrollTop);\n });\n on(d.scrollbarH, \"scroll\", function() {\n if (d.scroller.clientHeight) setScrollLeft(cm, d.scrollbarH.scrollLeft);\n });\n\n // Listen to wheel events in order to try and update the viewport on time.\n on(d.scroller, \"mousewheel\", function(e){onScrollWheel(cm, e);});\n on(d.scroller, \"DOMMouseScroll\", function(e){onScrollWheel(cm, e);});\n\n // Prevent clicks in the scrollbars from killing focus\n function reFocus() { if (cm.state.focused) setTimeout(bind(focusInput, cm), 0); }\n on(d.scrollbarH, \"mousedown\", reFocus);\n on(d.scrollbarV, \"mousedown\", reFocus);\n // Prevent wrapper from ever scrolling\n on(d.wrapper, \"scroll\", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });\n\n on(d.input, \"keyup\", function(e) { onKeyUp.call(cm, e); });\n on(d.input, \"input\", function() {\n if (ie && ie_version >= 9 && cm.display.inputHasSelection) cm.display.inputHasSelection = null;\n fastPoll(cm);\n });\n on(d.input, \"keydown\", operation(cm, onKeyDown));\n on(d.input, \"keypress\", operation(cm, onKeyPress));\n on(d.input, \"focus\", bind(onFocus, cm));\n on(d.input, \"blur\", bind(onBlur, cm));\n\n function drag_(e) {\n if (!signalDOMEvent(cm, e)) e_stop(e);\n }\n if (cm.options.dragDrop) {\n on(d.scroller, \"dragstart\", function(e){onDragStart(cm, e);});\n on(d.scroller, \"dragenter\", drag_);\n on(d.scroller, \"dragover\", drag_);\n on(d.scroller, \"drop\", operation(cm, onDrop));\n }\n on(d.scroller, \"paste\", function(e) {\n if (eventInWidget(d, e)) return;\n cm.state.pasteIncoming = true;\n focusInput(cm);\n fastPoll(cm);\n });\n on(d.input, \"paste\", function() {\n // Workaround for webkit bug https://bugs.webkit.org/show_bug.cgi?id=90206\n // Add a char to the end of textarea before paste occur so that\n // selection doesn't span to the end of textarea.\n if (webkit && !cm.state.fakedLastChar && !(new Date - cm.state.lastMiddleDown < 200)) {\n var start = d.input.selectionStart, end = d.input.selectionEnd;\n d.input.value += \"$\";\n // The selection end needs to be set before the start, otherwise there\n // can be an intermediate non-empty selection between the two, which\n // can override the middle-click paste buffer on linux and cause the\n // wrong thing to get pasted.\n d.input.selectionEnd = end;\n d.input.selectionStart = start;\n cm.state.fakedLastChar = true;\n }\n cm.state.pasteIncoming = true;\n fastPoll(cm);\n });\n\n function prepareCopyCut(e) {\n if (cm.somethingSelected()) {\n lastCopied = cm.getSelections();\n if (d.inaccurateSelection) {\n d.prevInput = \"\";\n d.inaccurateSelection = false;\n d.input.value = lastCopied.join(\"\\n\");\n selectInput(d.input);\n }\n } else {\n var text = [], ranges = [];\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n var line = cm.doc.sel.ranges[i].head.line;\n var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\n ranges.push(lineRange);\n text.push(cm.getRange(lineRange.anchor, lineRange.head));\n }\n if (e.type == \"cut\") {\n cm.setSelections(ranges, null, sel_dontScroll);\n } else {\n d.prevInput = \"\";\n d.input.value = text.join(\"\\n\");\n selectInput(d.input);\n }\n lastCopied = text;\n }\n if (e.type == \"cut\") cm.state.cutIncoming = true;\n }\n on(d.input, \"cut\", prepareCopyCut);\n on(d.input, \"copy\", prepareCopyCut);\n\n // Needed to handle Tab key in KHTML\n if (khtml) on(d.sizer, \"mouseup\", function() {\n if (activeElt() == d.input) d.input.blur();\n focusInput(cm);\n });\n }", "static domEventHandlers(handlers) {\n return ViewPlugin.define(() => ({}), { eventHandlers: handlers });\n }", "function turnOnFSWatcherAndTextHandler() {\n //register a handler to capture changes to files in the editor\n extensionContext.subscriptions.push(vscode.workspace.onDidChangeTextDocument(handleTextEditorChange));\n //register a handler to be called whenever the user saves one or more files\n extensionContext.subscriptions.push(vscode.workspace.onDidSaveTextDocument(handleFileSave));\n //create a file system watcher for all of the files in this workspace\n const fsWatcher = vscode.workspace.createFileSystemWatcher('**/*', false, true, false);\n //handle file/dir creates and deletes (translate these to create, delete, move, rename events) \n extensionContext.subscriptions.push(fsWatcher.onDidCreate(addRecentCreate));\n extensionContext.subscriptions.push(fsWatcher.onDidDelete(addRecentDelete));\n \n //cut/copy/paste overides\n //override the editor.action.clipboardCopyAction with our own\n clipboardCopyDisposable = vscode.commands.registerTextEditorCommand('editor.action.clipboardCopyAction', overriddenClipboardCopyAction); \n //extensionContext.subscriptions.push(clipboardCopyDisposable);\n\n //override the editor.action.clipboardCutAction with our own\n clipboardCutDisposable = vscode.commands.registerTextEditorCommand('editor.action.clipboardCutAction', overriddenClipboardCutAction); \n //extensionContext.subscriptions.push(clipboardCutDisposable);\n\n //override the editor.action.clipboardPasteAction with our own\n clipboardPasteDisposable = vscode.commands.registerTextEditorCommand('editor.action.clipboardPasteAction', overriddenClipboardPasteAction); \n //extensionContext.subscriptions.push(clipboardPasteDisposable);\n\n //indicate that storyteller is active\n isStorytellerCurrentlyActive = true;\n}", "function editor_event(objname,runDelay) {\r\n var config = document.all[objname].config;\r\n var editor_obj = document.all[\"_\" +objname+ \"_editor\"]; // html editor object\r\n if (runDelay == null) { runDelay = 0; }\r\n var editdoc;\r\n var editEvent = editor_obj.contentWindow ? editor_obj.contentWindow.event : event;\r\n\r\n // catch keypress events\r\n if (editEvent && editEvent.keyCode) {\r\n var ord = editEvent.keyCode; // ascii order of key pressed\r\n var ctrlKey = editEvent.ctrlKey;\r\n var altKey = editEvent.altKey;\r\n var shiftKey = editEvent.shiftKey;\r\n\r\n if (ord == 16) { return; } // ignore shift key by itself\r\n if (ord == 17) { return; } // ignore ctrl key by itself\r\n if (ord == 18) { return; } // ignore alt key by itself\r\n\r\n\r\n // cancel ENTER key and insert <BR> instead\r\n if (ord == 13 && editEvent.type == 'keypress') {\r\n editEvent.returnValue = false;\r\n editor_insertHTML(objname, \"<br/><return>\");\r\n return;\r\n }\r\n\r\n if (ctrlKey && (ord == 122 || ord == 90)) { // catch ctrl-z (UNDO)\r\n// TODO: Add our own undo/redo functionality\r\n// editEvent.cancelBubble = true;\r\n return;\r\n }\r\n if ((ctrlKey && (ord == 121 || ord == 89)) ||\r\n ctrlKey && shiftKey && (ord == 122 || ord == 90)) { // catch ctrl-y, ctrl-shift-z (REDO)\r\n// TODO: Add our own undo/redo functionality\r\n return;\r\n }\r\n }\r\n\r\n // setup timer for delayed updates (some events take time to complete)\r\n if (runDelay > 0) { return setTimeout(function(){ editor_event(objname); }, runDelay); }\r\n\r\n // don't execute more than 3 times a second (eg: too soon after last execution)\r\n if (this.tooSoon == 1 && runDelay >= 0) { this.queue = 1; return; } // queue all but urgent events\r\n this.tooSoon = 1;\r\n setTimeout(function(){\r\n this.tooSoon = 0;\r\n if (this.queue) { editor_event(objname,-1); };\r\n this.queue = 0;\r\n }, 333); // 1/3 second\r\n\r\n\r\n editor_updateOutput(objname);\r\n editor_updateToolbar(objname);\r\n\r\n}", "function remove_eventhandlers(curr) {\n\t\n\t\t curr.off('mousemove', function (ev) {\n\t\t\t handle_mousemove_on_content(ev);\n\t\t });\n\n\t\t curr.off('click', function (ev) {\n\t\t handle_mouseclick_on_content(ev);\n\t\t });\t\n\t\n\t\t curr.off('mouseleave', function (ev) {\n\t\t handle_mouseleave_from_content(ev);\n\t\t });\n\t\t\n\t\t curr.off('mouseenter', function (ev) {\n\t\t \thandle_mouseenter_on_content (ev);\n\t\t });\n\t}", "function PrepareDefaultEventHandlers() {\r\n $(\":text\").focus(textboxHighlight).blur(textboxRemoveHighlight);\r\n $(\":password\").focus(textboxHighlight).blur(textboxRemoveHighlight);\r\n $(\"textarea\").focus(textboxHighlight).blur(textboxRemoveHighlight);\r\n }", "_initEvent() {\n this.cm.getWrapperElement().addEventListener('click', () => {\n this.eventManager.emit('click', {\n source: 'markdown'\n });\n });\n\n this.cm.on('beforeChange', (cm, ev) => {\n if (ev.origin === 'paste') {\n this.eventManager.emit('pasteBefore', {\n source: 'markdown',\n data: ev\n });\n }\n });\n\n this.cm.on('change', (cm, cmEvent) => {\n this._refreshCodeMirrorMarks(cmEvent);\n this._emitMarkdownEditorChangeEvent(cmEvent);\n });\n\n this.cm.on('focus', () => {\n this.eventManager.emit('focus', {\n source: 'markdown'\n });\n });\n\n this.cm.on('blur', () => {\n this.eventManager.emit('blur', {\n source: 'markdown'\n });\n });\n\n this.cm.on('scroll', (cm, eventData) => {\n this.eventManager.emit('scroll', {\n source: 'markdown',\n data: eventData\n });\n });\n\n this.cm.on('keydown', (cm, keyboardEvent) => {\n this.eventManager.emit('keydown', {\n source: 'markdown',\n data: keyboardEvent\n });\n\n this.eventManager.emit('keyMap', {\n source: 'markdown',\n keyMap: keyMapper.convert(keyboardEvent),\n data: keyboardEvent\n });\n });\n\n this.cm.on('keyup', (cm, keyboardEvent) => {\n this.eventManager.emit('keyup', {\n source: 'markdown',\n data: keyboardEvent\n });\n });\n\n this.cm.on('copy', (cm, ev) => {\n this.eventManager.emit('copy', {\n source: 'markdown',\n data: ev\n });\n });\n\n this.cm.on('cut', (cm, ev) => {\n this.eventManager.emit('cut', {\n source: 'markdown',\n data: ev\n });\n });\n\n this.cm.on('paste', (cm, clipboardEvent) => {\n this.eventManager.emit('paste', {\n source: 'markdown',\n data: clipboardEvent\n });\n });\n\n this.cm.on('drop', (cm, eventData) => {\n eventData.preventDefault();\n\n this.eventManager.emit('drop', {\n source: 'markdown',\n data: eventData\n });\n });\n\n this.cm.on('cursorActivity', () => this._onChangeCursorActivity());\n }", "function registerEventHandlers(cm) {\r\n var d = cm.display;\r\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\r\n // Older IE's will not fire a second mousedown for a double click\r\n if (ie && ie_version < 11)\r\n on(d.scroller, \"dblclick\", operation(cm, function(e) {\r\n if (signalDOMEvent(cm, e)) return;\r\n var pos = posFromMouse(cm, e);\r\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;\r\n e_preventDefault(e);\r\n var word = findWordAt(cm, pos);\r\n extendSelection(cm.doc, word.anchor, word.head);\r\n }));\r\n else\r\n on(d.scroller, \"dblclick\", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });\r\n // Prevent normal selection in the editor (we handle our own)\r\n on(d.lineSpace, \"selectstart\", function(e) {\r\n if (!eventInWidget(d, e)) e_preventDefault(e);\r\n });\r\n // Some browsers fire contextmenu *after* opening the menu, at\r\n // which point we can't mess with it anymore. Context menu is\r\n // handled in onMouseDown for these browsers.\r\n if (!captureRightClick) on(d.scroller, \"contextmenu\", function(e) {onContextMenu(cm, e);});\r\n\r\n // Sync scrolling between fake scrollbars and real scrollable\r\n // area, ensure viewport is updated when scrolling.\r\n on(d.scroller, \"scroll\", function() {\r\n if (d.scroller.clientHeight) {\r\n setScrollTop(cm, d.scroller.scrollTop);\r\n setScrollLeft(cm, d.scroller.scrollLeft, true);\r\n signal(cm, \"scroll\", cm);\r\n }\r\n });\r\n on(d.scrollbarV, \"scroll\", function() {\r\n if (d.scroller.clientHeight) setScrollTop(cm, d.scrollbarV.scrollTop);\r\n });\r\n on(d.scrollbarH, \"scroll\", function() {\r\n if (d.scroller.clientHeight) setScrollLeft(cm, d.scrollbarH.scrollLeft);\r\n });\r\n\r\n // Listen to wheel events in order to try and update the viewport on time.\r\n on(d.scroller, \"mousewheel\", function(e){onScrollWheel(cm, e);});\r\n on(d.scroller, \"DOMMouseScroll\", function(e){onScrollWheel(cm, e);});\r\n\r\n // Prevent clicks in the scrollbars from killing focus\r\n function reFocus() { if (cm.state.focused) setTimeout(bind(focusInput, cm), 0); }\r\n on(d.scrollbarH, \"mousedown\", reFocus);\r\n on(d.scrollbarV, \"mousedown\", reFocus);\r\n // Prevent wrapper from ever scrolling\r\n on(d.wrapper, \"scroll\", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });\r\n\r\n on(d.input, \"keyup\", function(e) { onKeyUp.call(cm, e); });\r\n on(d.input, \"input\", function() {\r\n if (ie && ie_version >= 9 && cm.display.inputHasSelection) cm.display.inputHasSelection = null;\r\n fastPoll(cm);\r\n });\r\n on(d.input, \"keydown\", operation(cm, onKeyDown));\r\n on(d.input, \"keypress\", operation(cm, onKeyPress));\r\n on(d.input, \"focus\", bind(onFocus, cm));\r\n on(d.input, \"blur\", bind(onBlur, cm));\r\n\r\n function drag_(e) {\r\n if (!signalDOMEvent(cm, e)) e_stop(e);\r\n }\r\n if (cm.options.dragDrop) {\r\n on(d.scroller, \"dragstart\", function(e){onDragStart(cm, e);});\r\n on(d.scroller, \"dragenter\", drag_);\r\n on(d.scroller, \"dragover\", drag_);\r\n on(d.scroller, \"drop\", operation(cm, onDrop));\r\n }\r\n on(d.scroller, \"paste\", function(e) {\r\n if (eventInWidget(d, e)) return;\r\n cm.state.pasteIncoming = true;\r\n focusInput(cm);\r\n fastPoll(cm);\r\n });\r\n on(d.input, \"paste\", function() {\r\n // Workaround for webkit bug https://bugs.webkit.org/show_bug.cgi?id=90206\r\n // Add a char to the end of textarea before paste occur so that\r\n // selection doesn't span to the end of textarea.\r\n if (webkit && !cm.state.fakedLastChar && !(new Date - cm.state.lastMiddleDown < 200)) {\r\n var start = d.input.selectionStart, end = d.input.selectionEnd;\r\n d.input.value += \"$\";\r\n // The selection end needs to be set before the start, otherwise there\r\n // can be an intermediate non-empty selection between the two, which\r\n // can override the middle-click paste buffer on linux and cause the\r\n // wrong thing to get pasted.\r\n d.input.selectionEnd = end;\r\n d.input.selectionStart = start;\r\n cm.state.fakedLastChar = true;\r\n }\r\n cm.state.pasteIncoming = true;\r\n fastPoll(cm);\r\n });\r\n\r\n function prepareCopyCut(e) {\r\n if (cm.somethingSelected()) {\r\n lastCopied = cm.getSelections();\r\n if (d.inaccurateSelection) {\r\n d.prevInput = \"\";\r\n d.inaccurateSelection = false;\r\n d.input.value = lastCopied.join(\"\\n\");\r\n selectInput(d.input);\r\n }\r\n } else {\r\n var text = [], ranges = [];\r\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\r\n var line = cm.doc.sel.ranges[i].head.line;\r\n var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\r\n ranges.push(lineRange);\r\n text.push(cm.getRange(lineRange.anchor, lineRange.head));\r\n }\r\n if (e.type == \"cut\") {\r\n cm.setSelections(ranges, null, sel_dontScroll);\r\n } else {\r\n d.prevInput = \"\";\r\n d.input.value = text.join(\"\\n\");\r\n selectInput(d.input);\r\n }\r\n lastCopied = text;\r\n }\r\n if (e.type == \"cut\") cm.state.cutIncoming = true;\r\n }\r\n on(d.input, \"cut\", prepareCopyCut);\r\n on(d.input, \"copy\", prepareCopyCut);\r\n\r\n // Needed to handle Tab key in KHTML\r\n if (khtml) on(d.sizer, \"mouseup\", function() {\r\n if (activeElt() == d.input) d.input.blur();\r\n focusInput(cm);\r\n });\r\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}", "addContentChangeHandler() {\n\t\tfunction snapshotDiff(self) {\n\t\t\tvar newText = self.editor.getValue();\n\t\t\tvar timestamp = new Date().getTime();\n\n\t\t\tif (self.curText != newText) {\n\t\t\t\t/*\n\t\t\t\tThe two key function calls here are diff_main followed by diff_toDelta\n\t\t\t\tEach 'd' field is in the following format:\n\t\t\t\thttp://downloads.jahia.com/downloads/jahia/jahia6.6.1/jahia-root-6.6.1.0-aggregate-javadoc/name/fraser/neil/plaintext/DiffMatchPatch.html#diff_toDelta(java.util.LinkedList)\n\t\t\t\tCrush the diff into an encoded string which describes the operations\n\t\t\t\trequired to transform text1 into text2. E.g. =3\\t-2\\t+ing -> Keep 3\n\t\t\t\tchars, delete 2 chars, insert 'ing'. Operations are tab-separated.\n\t\t\t\tInserted text is escaped using %xx notation.\n\t\t\t\t*/\n\t\t\t\tvar delta = {\n\t\t\t\t\tt: timestamp,\n\t\t\t\t\td: self.dmp.diff_toDelta(self.dmp.diff_main(self.curText, newText))\n\t\t\t\t};\n\t\t\t\tself.sendCodeEditSaveRequest(delta);\n\n\t\t\t\t// self.menuClickID is set when any testcase link is clicked\n\t\t\t\tif (self.menuClickID.checkpoint > -1 && self.menuClickID.testcase > -1) {\n\t\t\t\t\tself.handleRunRequest(RUN_TEST_COMMAND, self.menuClickID.checkpoint, self.menuClickID.testcase);\n\t\t\t\t}\n\t\t\t\tself.curText = newText;\n\t\t \t}\n\t\t}\n\n\t\tthis.editor.on('change', (e) => {\n\t\t\t// Remove the syntax error squiggly lines\n\t\t\tthis.removeMarkersInEditorSelection();\n\n\t\t\t// Remove syntax error gutter highlights\n\t\t\tthis.removeErrorGutterHighlights();\n\n\t\t\t// Remove comment gutter highlights\n\t\t\tthis.removeCommentGutterHighlights();\n\n\t\t\t// Debouncing and auto saving\n\t\t\tif (this.DEBOUNCE_MS > 0) {\n\t\t\t\t$.doTimeout('editorChange', this.DEBOUNCE_MS, () => { snapshotDiff(this); });\n\t\t\t} else {\n\t\t\t\tsnapshotDiff(this);\n\t\t\t}\n\t\t});\n\t}", "async _onReady() {\n // Make the editor \"complex.\" This \"fluffs\" out the DOM and makes the\n // salient controller objects.\n this._editorComplex =\n new EditorComplex(this._sessionKey, this._window, this._editorNode);\n\n await this._editorComplex.whenReady();\n this._recoverySetup();\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 }", "async _onReady() {\n // Make the editor \"complex.\" This \"fluffs\" out the DOM and makes the\n // salient controller objects.\n this._editorComplex =\n new EditorComplex(this._sessionInfo, this._window, this._editorNode);\n\n await this._editorComplex.whenReady();\n this._recoverySetup();\n }", "function handleEditorUpdate() {\n if (updateTimerRef) {\n clearTimeout(updateTimerRef);\n }\n updateTimerRef = setTimeout(refreshRenderContent, timeBeforeEditorUpdate);\n}", "_registerHandlers(target, becameInvalid, becameValid) {\n this.on('becameInvalid', target, becameInvalid);\n this.on('becameValid', target, becameValid);\n }", "function updateQuillEditorListeners() {\n _.each(document.querySelectorAll('.slide-edit-lock'), function (el) {\n el.addEventListener('click', enableQuillEditor, false);\n });\n}", "function initEditors(ids) {\n initializeIntersectionObserver()\n\n ids.forEach((id) => {\n const editorId = `tinymce_${id}`\n const textarea = document.getElementById(editorId)\n\n if (textarea) {\n tinymceIntersectionObserver.observe(textarea)\n } else {\n console.warn(`Could not initialize TinyMCE for textarea#${editorId}!`)\n }\n })\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 }", "load()\n {\n this.replaceTextArea();\n this.createCustomButtons();\n if (this.config.CKEditor.editorData !== undefined) {\n this.oEditor.setData(this.config.CKEditor.editorData);\n }\n if (this.config.RichFilemanager !== undefined) {\n this.editor.on('dialogDefinition', (event) => {this.connectRichFilemanager(event);});\n }\n }", "function attachHandlers () {\n // Custom color input field handler\n $('.custom-color').on('keyup change', function(e) {\n var colorHex = e.target.value,\n colorGex = /^([A-Fa-f0-9]{6})$/;\n\n if (colorGex.test(colorHex)) {\n $(this).siblings('.color-preview').css('background-color', ('#' + colorHex));\n clonedColors[$(this).data('target')] = '#' + colorHex;\n reRenderPreview(clonedColors);\n }\n });\n\n // Toggle link to show or hide customization options\n $('#customization-toggle').on('click', function() {\n $('.customization').toggle();\n $(previewContainer).toggle();\n\n var $this = $(this),\n isVisible = $('.customization').is(':visible'),\n statusTextNode = $this.children('.customization-status'),\n customColorField = $('.custom-color'),\n colorPreview = $('.color-preview');\n\n statusTextNode.text(isVisible ? 'Hide' : 'Show');\n\n initialize();\n reRenderPreview(colors);\n });\n\n // Handler on preset color theme click\n $('.theme').on('mousedown', function(e) {\n $('.custom-color').val(e.target.dataset.color.substr(1));\n $('.custom-color').trigger('change');\n });\n }", "disconnectedCallback(){super.disconnectedCallback();let root=this;document.removeEventListener(\"selectionchange\",e=>{root.range=root.getRange()});document.removeEventListener(\"select-rich-text-editor-editor\",e=>{root._editorChange(e)});document.removeEventListener(\"deselect-rich-text-editor-editor\",e=>{root._editorChange(e)})}", "updateEditor() {\n if (typeof this.engine !== 'undefined') {\n this.engine.process(this.editor.toJSON());\n }\n }", "function attachWorkflowEditorEvents()\n {\n //Bind Save event\n $(\"#perc-wf-save\").off(\"click\").on(\"click\", function(evt)\n {\n saveNewWorkflow();\n });\n\n //Bind Cancel event\n $(\"#perc-wf-cancel, #perc-wf-update-cancel\").off(\"click\").on(\"click\", function(evt)\n {\n cancel();\n });\n\n //Bind Edit event\n\t\t\t$(\"#perc-wf-edit\").off(\"keydown\").on(\"keydown\", function(eventHandler)\n {\n if(eventHandler.code == \"Enter\" || eventHandler.code == \"Space\"){\n\t\t\t\tdocument.activeElement.click();\n\t\t\t}\n });\n $(\"#perc-wf-edit\").off(\"click\").on(\"click\", function(evt)\n {\n editWorkflow(evt);\n });\n\n //Bind Update event\n $(\"#perc-wf-update-save\").off(\"click\").on(\"click\", function(evt)\n {\n updateWorkflow();\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 }", "function onEditorChange(editor, objSettings){\r\n\t\t\r\n\t\tvar objInput = editor.getElement();\r\n\t\tobjInput = jQuery(objInput);\r\n\t\tobjSettings.triggerKeyupEvent(objInput);\r\n\t}", "constructChangeListeners() {\n // TODO it would be best to remove the event listeners after they are fired\n // and then re-instantiate them after a new recipe loads\n\n // Listener for the editor itself\n this.qEditor.on('text-change', () => {\n this.edited = true\n })\n\n // Listener for the tagInput add and remove events\n // FIXME it does not appear that the .offs are working for these\n this.tagInput.on('add', () => {\n this.edited = true\n })\n\n this.tagInput.on('remove', () => {\n this.edited = true\n })\n\n // Listener for title change\n const titleDOM = document.getElementById('title')\n titleDOM.addEventListener('input', () => {this.edited=true})\n\n // Listener for make-soon button\n const makeSoon = document.getElementById('make-soon-box')\n makeSoon.addEventListener('change', (evt) => {\n const checked = evt.srcElement.checked\n this.edited = true\n if(checked) {\n this.makeSoon = true\n } else {\n this.makeSoon = false\n }\n })\n\n // Listener for Tried 'n' True button\n const tried = document.getElementById('tried-box')\n tried.addEventListener('change', (evt) => {\n const checked = evt.srcElement.checked\n this.edited = true\n if(checked) {\n this.triedNTrue = true\n } else {\n this.triedNTrue = false\n }\n })\n }", "function MozmillHandlers() {\n\n}", "function makeEditor(_ref) {var editorPluginsToRun = _ref.editorPluginsToRun;var\n\t Editor = function (_React$Component) {_inherits(Editor, _React$Component);\n\n\t function Editor(props, context) {_classCallCheck(this, Editor);var _this = _possibleConstructorReturn(this, (Editor.__proto__ || Object.getPrototypeOf(Editor)).call(this,\n\t props, context));_initialiseProps.call(_this);\n\t if (props.value) {\n\t _this.yaml = props.value;\n\t }\n\t _this.state = {\n\t editor: null,\n\t value: props.value || \"\" };\n\n\n\t // see https://gist.github.com/Restuta/e400a555ba24daa396cc\n\t _this.onClick = _this.onClick.bind(_this);return _this;\n\t }_createClass(Editor, [{ key: \"componentWillMount\", value: function componentWillMount()\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t {\n\t // add user agent info to document\n\t // allows our custom Editor styling for IE10 to take effect\n\t var doc = document.documentElement;\n\t doc.setAttribute(\"data-useragent\", navigator.userAgent);\n\t } }, { key: \"componentDidMount\", value: function componentDidMount()\n\n\t {\n\t // eslint-disable-next-line react/no-did-mount-set-state\n\t this.setState({ width: this.getWidth() });\n\t document.addEventListener(\"click\", this.onClick);\n\n\t if (this.props.markers) {\n\t this.updateMarkerAnnotations({ markers: this.props.markers }, { force: true });\n\t }\n\t } }, { key: \"componentWillReceiveProps\", value: function componentWillReceiveProps(\n\n\t nextProps) {var _this2 = this;var\n\t state = this.state;\n\t var hasChanged = function hasChanged(k) {return !(0, _eq2.default)(nextProps[k], _this2.props[k]);};\n\t var wasEmptyBefore = function wasEmptyBefore(k) {return nextProps[k] && (!_this2.props[k] || (0, _isEmpty2.default)(_this2.props[k]));};\n\n\t this.updateErrorAnnotations(nextProps);\n\t this.setReadOnlyOptions(nextProps);\n\t this.updateMarkerAnnotations(nextProps);\n\n\t if (state.editor && nextProps.goToLine && hasChanged(\"goToLine\")) {\n\t state.editor.gotoLine(nextProps.goToLine.line);\n\t }\n\n\t this.setState({\n\t shouldClearUndoStack: hasChanged(\"specId\") || wasEmptyBefore(\"value\") });\n\n\n\t } }, { key: \"shouldComponentUpdate\", value: function shouldComponentUpdate(\n\n\n\n\t nextProps) {\n\t var oriYaml = this.yaml;\n\t this.yaml = nextProps.value;\n\n\t return oriYaml !== nextProps.value;\n\t } }, { key: \"render\", value: function render()\n\n\t {var\n\t readOnly = this.props.readOnly;\n\t var value = this.yaml;\n\n\t return (\n\t _react2.default.createElement(_reactAce2.default, {\n\t value: value,\n\t mode: \"yaml\",\n\t theme: \"tomorrow_night_eighties\",\n\t onLoad: this.onLoad,\n\t onChange: this.onChange,\n\t name: \"ace-editor\",\n\t width: \"100%\",\n\t height: \"100%\",\n\t tabSize: 2,\n\t fontSize: 14,\n\t readOnly: readOnly,\n\t useSoftTabs: \"true\",\n\t wrapEnabled: true,\n\t editorProps: {\n\t \"display_indent_guides\": true,\n\t folding: \"markbeginandend\" },\n\n\t setOptions: {\n\t cursorStyle: \"smooth\",\n\t wrapBehavioursEnabled: true } }));\n\n\n\n\t } }, { key: \"componentDidUpdate\", value: function componentDidUpdate()\n\n\t {var _state =\n\t this.state,shouldClearUndoStack = _state.shouldClearUndoStack,editor = _state.editor;\n\n\t if (shouldClearUndoStack) {\n\t setTimeout(function () {\n\t editor.getSession().getUndoManager().reset();\n\t }, 100);\n\t }\n\n\t } }, { key: \"componentWillUnmount\", value: function componentWillUnmount()\n\n\t {\n\t document.removeEventListener(\"click\", this.onClick);\n\t } }]);return Editor;}(_react2.default.Component);var _initialiseProps = function _initialiseProps() {var _this3 = this;this.onChange = function (value) {// Set the value in state, now - so that we don't have lag\n\t _this3.setState({ value: value }); // Send it upstream\n\t _this3.props.onChange(value);};this.onLoad = function (editor) {var props = _this3.props,state = _this3.state;var AST = props.AST,specObject = props.specObject;var langTools = _brace2.default.acequire(\"ace/ext/language_tools\");state.editor = editor; // TODO: get editor out of state\n\t editor.getSession().setUseWrapMode(true);var session = editor.getSession();session.on(\"changeScrollLeft\", function (xPos) {// eslint-disable-line no-unused-vars\n\t session.setScrollLeft(0);});(0, _hook2.default)(editor, props, editorPluginsToRun || [], { langTools: langTools, AST: AST, specObject: specObject });editor.setHighlightActiveLine(false);editor.setHighlightActiveLine(true);};this.onResize = function () {var editor = _this3.state.editor;if (editor) {var session = editor.getSession();editor.resize();var wrapLimit = session.getWrapLimit();editor.setPrintMarginColumn(wrapLimit);}};this.onClick = function () {// onClick is deferred by 40ms, to give element resizes time to settle.\n\t setTimeout(function () {if (_this3.getWidth() !== _this3.state.width) {_this3.onResize();_this3.setState({ width: _this3.getWidth() });}}, 40);};this.getWidth = function () {var el = document.getElementById(\"editor-wrapper\");return el ? el.getBoundingClientRect().width : null;};this.updateErrorAnnotations = function (nextProps) {if (_this3.state.editor && nextProps.errors) {var editorAnnotations = nextProps.errors.toJS().map(function (err) {// Create annotation objects that ACE can use\n\t return { row: err.line - 1, column: 0, type: err.level, text: err.message };});_this3.state.editor.getSession().setAnnotations(editorAnnotations);}};this.setReadOnlyOptions = function (nextProps) {var state = _this3.state;if (nextProps.readOnly === true && state.editor) {state.editor.setOptions({ readOnly: true, highlightActiveLine: false, highlightGutterLine: false });} else if (state.editor) {state.editor.setOptions({ readOnly: false, highlightActiveLine: true, highlightGutterLine: true });}};this.updateMarkerAnnotations = function (nextProps) {var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},force = _ref2.force;var state = _this3.state;var onMarkerLineUpdate = nextProps.onMarkerLineUpdate;var size = function size(obj) {return Object.keys(obj).length;}; // FIXME: this is a hacky solution.\n\t // we should find a way to wait until the spec has been loaded into ACE.\n\t if (force === true || _this3.props.specId !== nextProps.specId || size(_this3.props.markers) !== size(nextProps.markers)) {setTimeout(_markerPlacer.placeMarkerDecorations.bind(null, { editor: state.editor, markers: nextProps.markers, onMarkerLineUpdate: onMarkerLineUpdate }), 300);}};this.yaml = this.yaml || \"\";};Editor.propTypes = { specId: _react.PropTypes.string, value: _react.PropTypes.string, onChange: _react.PropTypes.func,\n\t onMarkerLineUpdate: _react.PropTypes.func,\n\n\t readOnly: _react.PropTypes.bool,\n\n\t markers: _react.PropTypes.object,\n\t goToLine: _react.PropTypes.object,\n\t specObject: _react.PropTypes.object.isRequired,\n\n\t AST: _react.PropTypes.object.isRequired,\n\n\t errors: _reactImmutableProptypes2.default.list };\n\n\n\t Editor.defaultProps = {\n\t value: \"\",\n\t specId: \"--unknown--\",\n\t onChange: NOOP,\n\t onMarkerLineUpdate: NOOP,\n\t markers: {},\n\t readOnly: false,\n\t goToLine: {},\n\t errors: (0, _immutable.fromJS)([]) };\n\n\n\t return Editor;\n\t}", "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 }", "_events() {\n \tthis._addKeyHandler();\n \tthis._addClickHandler();\n }", "function BaseEditor() { }", "function BaseEditor() { }", "function initEditor()\r\n{\r\n\t// Insert tab in the code box\r\n\t$('[name=\"data\"]').off('keydown').on('keydown', function (e)\r\n\t{\r\n\t\tif (e.keyCode == 9)\r\n\t\t{\r\n\t\t\tvar myValue = \"\\t\";\r\n\t\t\tvar startPos = this.selectionStart;\r\n\t\t\tvar endPos = this.selectionEnd;\r\n\t\t\tvar scrollTop = this.scrollTop;\r\n\r\n\t\t\tthis.value = this.value.substring(0, startPos) + myValue + this.value.substring(endPos,this.value.length);\r\n\t\t\tthis.focus();\r\n\t\t\tthis.selectionStart = startPos + myValue.length;\r\n\t\t\tthis.selectionEnd = startPos + myValue.length;\r\n\t\t\tthis.scrollTop = scrollTop;\r\n\r\n\t\t\te.preventDefault();\r\n\t\t}\r\n\t});\r\n\r\n\t// Tick the private checkbox if password is entered\r\n\t$('[name=\"password\"]').off('keyup').on('keyup', function()\r\n\t{\r\n\t\t$('[name=\"private\"]').attr('checked', $(this).val().length > 0);\r\n\t});\r\n}", "static createEditor(params) {\r\n\t\tDOM.createEditor(params);\r\n\t\tInit.editor = Getter.getEditor();\r\n\t\t\r\n\t\tswitch (mode) {\r\n\t\tcase 'balloon':\r\n\t\t\t/*create popup toolbar in balloon mode*/\r\n\t\t\tInit.createToolbar('swe-toolbar-pu', 'swe-none');\r\n\t\t\tInit.setShowingPopupToolbarEvents();\r\n\t\t\t/*set selectionEnd timer value*/\r\n\t\t\tInit.selectionEndTimer = null;\r\n\t\t\tbreak;\r\n\t\tcase 'classic':\r\n\t\tdefault:\r\n\t\t\t/*create fixed toolbar in balloon mode*/\r\n\t\t\tInit.createToolbar('swe-toolbar', params.sticky ? 'swe-toolbar-sticky' : null);\r\n\t\t\tDOM.createBottomPanel();\r\n\t\t\tInit.setEventListener(Init.editor, 'input', Init.setCountersValue);\r\n\t\t\tInit.setCountersValue();\r\n\t\t}\r\n\t\t/*highlight editors images on click*/\r\n\t\tInit.setEventListener(Init.editor, 'mousedown', Images.selectImageOnClick);\r\n\t\tInit.setEventListener(document, 'mousedown', Images.removeImageFrameOnOutsideClick);\t\t\r\n\t\t/*set textarea value on input*/\r\n\t\tInit.setEventListener(Init.editor, 'input', Init.setTextAreaValue);\r\n\t\t/*highlight buttons of toolbar that have the same style as selection*/\r\n\t\tInit.setEventListener(document, 'selectionchange', Init.highlightTheButtons);\r\n\t}", "function addListeners()\n\t{\n\t\t// Show page action so users can change settings\n\t\tchrome.runtime.sendMessage({request: \"showPageAction\"});\n\n\t\t// Add to editable divs, textareas, inputs\n\t\t$(document).on(EVENT_NAME_KEYPRESS,\n\t\t\t'div[contenteditable=true],textarea,input', keyPressHandler);\n\t\t$(document).on(EVENT_NAME_KEYUP,\n\t\t\t'div[contenteditable=true],textarea,input', keyUpHandler);\n\n\t\t// Attach to future iframes\n\t\t$(document).on(EVENT_NAME_LOAD, 'iframe', function(e) {\n\t\t\t$(this).contents().on(EVENT_NAME_KEYPRESS,\n\t\t\t\t'div[contenteditable=true],textarea,input', keyPressHandler);\n\t\t\t$(this).contents().on(EVENT_NAME_KEYUP,\n\t\t\t\t'div[contenteditable=true],textarea,input', keyUpHandler);\n\t\t});\n\n\t\t// Attach to existing iframes as well - this needs to be at the end\n\t\t// because sometimes this breaks depending on cross-domain policy\n\t\t$(document).find('iframe').each(function(index) {\n\t\t\t$(this).contents().on(EVENT_NAME_KEYPRESS,\n\t\t\t\t'div[contenteditable=true],textarea,input', keyPressHandler);\n\t\t\t$(this).contents().on(EVENT_NAME_KEYUP,\n\t\t\t\t'div[contenteditable=true],textarea,input', keyUpHandler);\n\t\t});\n\t}", "connectRichFilemanager(event)\n {\n var editor = event.editor;\n var dialogDefinition = event.data.definition;\n var dialogName = event.data.name;\n var cleanUpFuncRef = this.editor.tools.addFunction(function () {\n let oIFrame = document.getElementById('fm-iframeCKE');\n if (oIFrame) {\n oIFrame.remove();\n }\n document.body.style.overflowY = 'scroll';\n });\n \n var tabCount = dialogDefinition.contents.length;\n for (var i = 0; i < tabCount; i++) {\n var dialogTab = dialogDefinition.contents[i];\n if (!(dialogTab && typeof dialogTab.get === 'function')) {\n continue;\n }\n \n var browseButton = dialogTab.get('browse');\n if (browseButton !== null) {\n browseButton.hidden = false;\n var params = \n '?CKEditorFuncNum=' + this.editor.instances[event.editor.name]._.filebrowserFn +\n '&CKEditorCleanUpFuncNum=' + cleanUpFuncRef +\n '&langCode=' + this.config.RichFilemanager.language +\n '&CKEditor=' + event.editor.name;\n \n if (dialogName == 'link') {\n params += '&expandedFolder=' + this.config.RichFilemanager.expandFolder.browseLinkURL;\n } else if (dialogTab.id == 'info') {\n params += '&expandedFolder=' + this.config.RichFilemanager.expandFolder.browseImageURL;\n } else {\n params += '&expandedFolder=' + this.config.RichFilemanager.expandFolder.browseImageLinkURL;\n }\n browseButton.filebrowser.rfm_path = this.config.RichFilemanager.Path + params;\n browseButton.onClick = function (dialog) {\n editor._.filebrowserSe = this;\n \n let oIFrame = document.createElement('iframe');\n oIFrame.id = 'fm-iframeCKE';\n oIFrame.className = 'fm-modal';\n oIFrame.src = dialog.sender.filebrowser.rfm_path;\n document.body.append(oIFrame);\n document.body.style.overflowY = 'hidden';\n }\n }\n }\n }", "function\n setEditorMode( bEnable )\n {\n document.body[ bEnable? 'addEventListener': 'removeEventListener']( 'click',clickInEditMode,true );\n document.body[ bEnable? 'addEventListener': 'removeEventListener']( 'input',inputInEditMode,true );\n document.body[ bEnable? 'addEventListener': 'removeEventListener']( 'blur' , blurInEditMode,true );\n bEnable || document.body.querySelectorAll('*[contentEditable]').forEach( el=> el.removeAttribute('contentEditable'));\n }", "function quickCodeHandler(e) {\n\t var target = e.target,\n\t highlighterDiv = findParentElement(target, '.syntaxhighlighter'),\n\t container = findParentElement(target, '.container'),\n\t textarea = document.createElement('textarea'),\n\t highlighter;\n\n\t if (!container || !highlighterDiv || findElement(container, 'textarea')) return;\n\n\t highlighter = getHighlighterById(highlighterDiv.id);\n\n\t // add source class name\n\t addClass(highlighterDiv, 'source');\n\n\t // Have to go over each line and grab it's text, can't just do it on the\n\t // container because Firefox loses all \\n where as Webkit doesn't.\n\t var lines = container.childNodes,\n\t code = [];\n\n\t for (var i = 0, l = lines.length; i < l; i++) {\n\t code.push(lines[i].innerText || lines[i].textContent);\n\t } // using \\r instead of \\r or \\r\\n makes this work equally well on IE, FF and Webkit\n\t code = code.join('\\r');\n\n\t // For Webkit browsers, replace nbsp with a breaking space\n\t code = code.replace(/\\u00a0/g, \" \");\n\n\t // inject <textarea/> tag\n\t textarea.appendChild(document.createTextNode(code));\n\t container.appendChild(textarea);\n\n\t // preselect all text\n\t textarea.focus();\n\t textarea.select();\n\n\t // set up handler for lost focus\n\t attachEvent(textarea, 'blur', function (e) {\n\t textarea.parentNode.removeChild(textarea);\n\t removeClass(highlighterDiv, 'source');\n\t });\n\t }", "function handleBindEventHandlers(){\n handleAddBookmark();\n handleFilterRating();\n handleDeleteBookmark();\n handleAddForm();\n handleDescExpand();\n handleCloseButton();\n }", "customeCodeEditEvent() {\n this.menuHandler(MenuChoices.null);\n }", "function BestInPlaceEditor(e) {\n 'use strict';\n this.element = e;\n this.initOptions();\n this.bindForm();\n this.initPlaceHolder();\n jQuery(this.activator).bind('click', {editor: this}, this.clickHandler);\n}", "function BestInPlaceEditor(e) {\n 'use strict';\n this.element = e;\n this.initOptions();\n this.bindForm();\n this.initPlaceHolder();\n jQuery(this.activator).bind('click', {editor: this}, this.clickHandler);\n}", "function addToEditors(win) {\n\t if (!win._mediumEditors) {\n\t // To avoid breaking users who are assuming that the unique id on\n\t // medium-editor elements will start at 1, inserting a 'null' in the\n\t // array so the unique-id can always map to the index of the editor instance\n\t win._mediumEditors = [null];\n\t }\n\n\t // If this already has a unique id, re-use it\n\t if (!this.id) {\n\t this.id = win._mediumEditors.length;\n\t }\n\n\t win._mediumEditors[this.id] = this;\n\t }" ]
[ "0.7412128", "0.6621844", "0.6621844", "0.6262634", "0.6257714", "0.607542", "0.6045522", "0.60446435", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.5921831", "0.58822435", "0.5855776", "0.58507174", "0.58342123", "0.5821316", "0.58143663", "0.58074176", "0.57911897", "0.5784581", "0.57678455", "0.5766449", "0.57622826", "0.5739991", "0.5724587", "0.57212824", "0.57201177", "0.5718631", "0.57144845", "0.57108676", "0.56975335", "0.56874955", "0.56824404", "0.56824404", "0.56732845", "0.5667469", "0.5667469", "0.5667469", "0.5651327", "0.5651023", "0.56491417", "0.5647821", "0.56457156", "0.5645161", "0.5635571", "0.5630949", "0.56083876", "0.5606112", "0.5592833", "0.5576856", "0.557564", "0.5566266", "0.5565353", "0.5553392", "0.55399", "0.5539251", "0.5511093", "0.5508463", "0.54988265", "0.5498448", "0.5497374", "0.5493513", "0.54899323", "0.54646486", "0.5457944", "0.5448664", "0.54422545", "0.54334956", "0.5421036", "0.5418867", "0.54070467", "0.54067695", "0.54067695", "0.54032874", "0.54017025", "0.5393179", "0.53924155", "0.5389941", "0.53865755", "0.5378808", "0.5377512", "0.5372959", "0.5372959", "0.536429" ]
0.0
-1
Called when the window resizes
function onResize(cm) { var d = cm.display; // Might be a text scaling operation, clear size caches. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; d.scrollbarsClipped = false; cm.setSize(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onWindowResize() {\n updateSizes();\n }", "function windowResized() {\n resize();\n redraw();\n}", "onWindowResize() {\n\t\tthis.windowHeight = this.getWindowHeight();\n\t\tthis.updatePosition();\n\t}", "function onWindowResize() {\n\n\t\t\t}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight, false);\n init();\n}", "function windowResized() {\n\n getWrapperWidth();\n resizeCanvas(wrapperWide, wrapperWide);\n\n widthVar = (width - 40) / 100;\n drawArea = (width - 40);\n\n switchBox();\n}", "function windowResized () {\n\tresizeCanvas(windowWidth, windowHeight);\n }", "function onWindowResize(event) {\n\n layout();\n\n }", "onResize () {}", "function windowResized() {\n resizeCanvas(windowWidth/4, windowHeight);\n renderNoteMap();\n}", "function windowResized() {\r\n canvas_resize();\r\n set_origin();\r\n set_speed();\r\n bars[it].display();\r\n}", "function windowResized() {\n repositionCanvas();\n}", "function windowResized() {\n\tresizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n\tresizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(width, height);\n}", "function windowResized() {\n\tresizeCanvas(windowWidth, windowHeight);\n\tLogo.resize();\n}", "function windowResized() {\n resizeCanvas(canvasX, canvasY);\n}", "function windowResized () {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized () {\n resizeCanvas(windowWidth, windowHeight);\n resize=1;\n}", "function windowResized() {\n\tresizeCanvas(innerWidth, innerHeight);\n}", "function windowResized() {\n setup();\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\r\n resizeCanvas(windowWidth, windowHeight);\r\n}", "function windowResized() {\r\n resizeCanvas(windowWidth, windowHeight);\r\n}", "function windowResized() {\n resizeCanvas(canvasWidth, canvasHeight);\n}", "function windowResized() {\n // We can use the resizeCanvas() function to resize our canvas to the new window dimensions\n resizeCanvas(windowWidth,windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n scaleMaximums();\n}", "function windowResized() {\r\n resizeCanvas(windowWidth, windowHeight, false);\r\n setupArray();\r\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight, false);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight, false);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight, false);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight, false);\n}", "function onWindowResize() {\n\tonAggregateResize();\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n addModelButton.position(windowWidth - 150, 30);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight)\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight)\n}", "function windowResized() {\r\n resizeCanvas(windowWidth, windowHeight, false);\r\n}", "function windowResized() {\r\n resizeCanvas(windowWidth, windowHeight)\r\n}", "function windowResized() {\n resizeCanvas(canvasContainer.clientWidth, canvasContainer.clientHeight);\n}", "function windowResized() {\n // retrieve the new client width\n clientWidth = Math.max(200, window.innerWidth - 200);\n aspRatio = 1;\n clientHeight = clientWidth * aspRatio;\n \n // resize the canvas and plot, reposition the GUI \n resizeCanvas(clientWidth, clientHeight);\n examplePlot.GPLOT.setOuterDim(clientWidth, clientHeight);\n examplePlot.GPLOT.setPos(0, 0);\n gui.prototype.setPosition(clientWidth, examplePlot.GPLOT.mar[2]);\n}", "function resized() {\r\n\tclearInterval(renderer);\r\n\tmain();\r\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight - 50);\n}", "function edgtfOnWindowResize() {\n }", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n draw();\n}", "_onResize() {\n this.refresh();\n }", "function windowResized() {\n console.log('resized');\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n\twindowW = window.innerWidth;\n\twindowH = window.innerHeight;\n resizeCanvas(window.innerWidth, window.innerHeight);\n}", "function onResize() {\n\t\tvar TITLE_BAR_HEIGHT = 35;\t// Height of the title bar\n\t\tvar CONTENT_WIDTH = 100;\t// Aspect ratio width of content (minus the titlebar)\n\t\tvar CONTENT_HEIGHT = 100;\t// Aspect ratio height of content (minus the titlebar)\n\t\tvar NB_PADDING = 20;\t\t// The white space padding between the HTML and the widget border\n\t\tvar BORDER_PADDING = 0;\t\t// Any border around the HTML\n\n\t\t// Timeout wrapper is needed to prevent the function from triggering another resize immediately\n\t\tsetTimeout(function() {\n\t\t\tvar ratio = elements.body.width() / CONTENT_WIDTH;\n\t\t\tvar actualHeight = ratio * CONTENT_HEIGHT + TITLE_BAR_HEIGHT;\n\t\t\t// Turn off undomanager so this 'seamless' resize doesn't get recorded\n\t\t\tNB.undomanager.setAutoRecord(false);\n\t\t\tNB.getHostObject().height = actualHeight + NB_PADDING + BORDER_PADDING;\n\t\t\tNB.undomanager.setAutoRecord(true);\n\t\t}, 10);\n\t}", "onResize() {\n if (!this.isActivated) {\n return;\n }\n\n this.refresh();\n }", "function windowResized(){\n canvas.resize(windowWidth, windowHeight - canvasadjust);\n}", "function windowResized(){\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized(){\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(innerWidth, innerHeight);\n}", "_onResize () {\n }", "function resizeEvents(){\r\n\r\n}", "function onResize(){\n\t// Update new dimensions\n\tvar width = $(window).width();\n\tvar height = $(window).height();\n\t\n\t// Dispatch a resize event to all the elements\n\tdispatch.resize(width, height);\n\t\n\t// If a region was selected, updates also each chart\n//\tif(regionSelected.name)\n//\t\tdispatch.regionChange();\n\t\n\t//TODO: completare\n}", "function onResize() {\n\t\t\tsetWidths();\n\t\t\trepositionStickyHead();\n\t\t\trepositionStickyCol();\n\t\t}", "function handleResize() {\n // Set window width/height to state\n setWindowSize({\n width: window.innerWidth,\n height: window.innerHeight,\n });\n\n }", "function windowResized()\n{\n zinjs.info.width = $(window).width();\n zinjs.info.height = $(window).height();\n if (zinjs.info.zoomArea) {\n zinjs.info.zoomArea.zoomIn();\n }\n}", "function sizeChanged() {\n for (var id in windowObjects) {\n windowObjects[id].sizeChanged();\n }\n //alert(\"resize\");\n }", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}//end windowResized", "function handleResize() {\n // Set window width/height to state\n setWindowSize({\n width: window.outerWidth,\n height: window.outerHeight,\n });\n }", "function qodeOnWindowResize() {\n qodeSelfHostedVideoSize();\n }", "function handleResize() {\n // Set window width/height to state\n setWindowSize({\n width: window.innerWidth,\n height: window.innerHeight,\n });\n }", "function onWindowResize() {\n deleteStatusOverlays();\n drawStatusOverlays();\n }" ]
[ "0.8751041", "0.8488573", "0.84693223", "0.8312482", "0.79967594", "0.79899037", "0.79610854", "0.79416203", "0.7917026", "0.7901147", "0.78813344", "0.78804415", "0.7867091", "0.7867091", "0.78272027", "0.7821096", "0.78160036", "0.7803246", "0.77958447", "0.7787981", "0.7787281", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.77819735", "0.7767639", "0.7767639", "0.77539957", "0.7747306", "0.7736236", "0.77302545", "0.7711599", "0.7711599", "0.7711599", "0.7711599", "0.769667", "0.7681033", "0.7681033", "0.7681033", "0.7681033", "0.7681033", "0.7681033", "0.7681033", "0.7681033", "0.7681033", "0.7681033", "0.76798296", "0.7677096", "0.7677096", "0.76675886", "0.7646047", "0.7625523", "0.7623656", "0.76070744", "0.760576", "0.7604562", "0.7602982", "0.75852174", "0.75578433", "0.7542027", "0.75369954", "0.7534835", "0.75222707", "0.75221044", "0.75221044", "0.7520673", "0.7514403", "0.7460449", "0.74527127", "0.74460477", "0.7442973", "0.7435272", "0.74281526", "0.74187976", "0.74145526", "0.74101293", "0.7407887", "0.7398876" ]
0.0
-1
This is a kludge to keep keymaps mostly working as raw objects (backwards compatibility) while at the same time support features like normalization and multistroke key bindings. It compiles a new normalized keymap, and then updates the old object to reflect this.
function normalizeKeyMap(keymap) { var copy = {}; for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) { var value = keymap[keyname]; if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue } if (value == "...") { delete keymap[keyname]; continue } var keys = map(keyname.split(" "), normalizeKeyName); for (var i = 0; i < keys.length; i++) { var val = (void 0), name = (void 0); if (i == keys.length - 1) { name = keys.join(" "); val = value; } else { name = keys.slice(0, i + 1).join(" "); val = "..."; } var prev = copy[name]; if (!prev) { copy[name] = val; } else if (prev != val) { throw new Error("Inconsistent bindings for " + name) } } delete keymap[keyname]; } } for (var prop in copy) { keymap[prop] = copy[prop]; } return keymap }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normalizeKeyMap(keymap) {\n\t\t var copy = {};\n\t\t for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n\t\t var value = keymap[keyname];\n\t\t if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n\t\t if (value == \"...\") { delete keymap[keyname]; continue }\n\n\t\t var keys = map(keyname.split(\" \"), normalizeKeyName);\n\t\t for (var i = 0; i < keys.length; i++) {\n\t\t var val = (void 0), name = (void 0);\n\t\t if (i == keys.length - 1) {\n\t\t name = keys.join(\" \");\n\t\t val = value;\n\t\t } else {\n\t\t name = keys.slice(0, i + 1).join(\" \");\n\t\t val = \"...\";\n\t\t }\n\t\t var prev = copy[name];\n\t\t if (!prev) { copy[name] = val; }\n\t\t else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n\t\t }\n\t\t delete keymap[keyname];\n\t\t } }\n\t\t for (var prop in copy) { keymap[prop] = copy[prop]; }\n\t\t return keymap\n\t\t }", "function normalizeKeyMap(keymap) {\r\n var copy = {};\r\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\r\n var value = keymap[keyname];\r\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\r\n if (value == \"...\") { delete keymap[keyname]; continue }\r\n\r\n var keys = map(keyname.split(\" \"), normalizeKeyName);\r\n for (var i = 0; i < keys.length; i++) {\r\n var val = (void 0), name = (void 0);\r\n if (i == keys.length - 1) {\r\n name = keys.join(\" \");\r\n val = value;\r\n } else {\r\n name = keys.slice(0, i + 1).join(\" \");\r\n val = \"...\";\r\n }\r\n var prev = copy[name];\r\n if (!prev) { copy[name] = val; }\r\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\r\n }\r\n delete keymap[keyname];\r\n } }\r\n for (var prop in copy) { keymap[prop] = copy[prop]; }\r\n return keymap\r\n}", "function normalizeKeyMap(keymap) {\n var copy = {}\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname]\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName)\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0)\n if (i == keys.length - 1) {\n name = keys.join(\" \")\n val = value\n } else {\n name = keys.slice(0, i + 1).join(\" \")\n val = \"...\"\n }\n var prev = copy[name]\n if (!prev) { copy[name] = val }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname]\n } }\n for (var prop in copy) { keymap[prop] = copy[prop] }\n return keymap\n}", "function normalizeKeyMap(keymap) {\n var copy = {}\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname]\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName)\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0)\n if (i == keys.length - 1) {\n name = keys.join(\" \")\n val = value\n } else {\n name = keys.slice(0, i + 1).join(\" \")\n val = \"...\"\n }\n var prev = copy[name]\n if (!prev) { copy[name] = val }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname]\n } }\n for (var prop in copy) { keymap[prop] = copy[prop] }\n return keymap\n}", "function normalizeKeyMap(keymap) {\n var copy = {};\n\n for (var keyname in keymap) {\n if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) {\n continue;\n }\n\n if (value == \"...\") {\n delete keymap[keyname];\n continue;\n }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n\n for (var i = 0; i < keys.length; i++) {\n var val = void 0,\n name = void 0;\n\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n\n var prev = copy[name];\n\n if (!prev) {\n copy[name] = val;\n } else if (prev != val) {\n throw new Error(\"Inconsistent bindings for \" + name);\n }\n }\n\n delete keymap[keyname];\n }\n }\n\n for (var prop in copy) {\n keymap[prop] = copy[prop];\n }\n\n return keymap;\n }", "function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n}", "function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n}", "function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n}", "function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n}", "function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n}", "function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n}", "function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n}", "function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n}", "function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n}", "function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n}", "function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n}", "configureKeyboardBindings() {\n if (this.keycharm !== undefined) {\n this.keycharm.destroy();\n }\n\n if (this.options.keyboard.enabled === true) {\n if (this.options.keyboard.bindToWindow === true) {\n this.keycharm = keycharm({ container: window, preventDefault: true });\n } else {\n this.keycharm = keycharm({\n container: this.canvas.frame,\n preventDefault: true,\n });\n }\n\n this.keycharm.reset();\n\n if (this.activated === true) {\n this.keycharm.bind(\n \"up\",\n () => {\n this.bindToRedraw(\"_moveUp\");\n },\n \"keydown\"\n );\n this.keycharm.bind(\n \"down\",\n () => {\n this.bindToRedraw(\"_moveDown\");\n },\n \"keydown\"\n );\n this.keycharm.bind(\n \"left\",\n () => {\n this.bindToRedraw(\"_moveLeft\");\n },\n \"keydown\"\n );\n this.keycharm.bind(\n \"right\",\n () => {\n this.bindToRedraw(\"_moveRight\");\n },\n \"keydown\"\n );\n this.keycharm.bind(\n \"=\",\n () => {\n this.bindToRedraw(\"_zoomIn\");\n },\n \"keydown\"\n );\n this.keycharm.bind(\n \"num+\",\n () => {\n this.bindToRedraw(\"_zoomIn\");\n },\n \"keydown\"\n );\n this.keycharm.bind(\n \"num-\",\n () => {\n this.bindToRedraw(\"_zoomOut\");\n },\n \"keydown\"\n );\n this.keycharm.bind(\n \"-\",\n () => {\n this.bindToRedraw(\"_zoomOut\");\n },\n \"keydown\"\n );\n this.keycharm.bind(\n \"[\",\n () => {\n this.bindToRedraw(\"_zoomOut\");\n },\n \"keydown\"\n );\n this.keycharm.bind(\n \"]\",\n () => {\n this.bindToRedraw(\"_zoomIn\");\n },\n \"keydown\"\n );\n this.keycharm.bind(\n \"pageup\",\n () => {\n this.bindToRedraw(\"_zoomIn\");\n },\n \"keydown\"\n );\n this.keycharm.bind(\n \"pagedown\",\n () => {\n this.bindToRedraw(\"_zoomOut\");\n },\n \"keydown\"\n );\n\n this.keycharm.bind(\n \"up\",\n () => {\n this.unbindFromRedraw(\"_moveUp\");\n },\n \"keyup\"\n );\n this.keycharm.bind(\n \"down\",\n () => {\n this.unbindFromRedraw(\"_moveDown\");\n },\n \"keyup\"\n );\n this.keycharm.bind(\n \"left\",\n () => {\n this.unbindFromRedraw(\"_moveLeft\");\n },\n \"keyup\"\n );\n this.keycharm.bind(\n \"right\",\n () => {\n this.unbindFromRedraw(\"_moveRight\");\n },\n \"keyup\"\n );\n this.keycharm.bind(\n \"=\",\n () => {\n this.unbindFromRedraw(\"_zoomIn\");\n },\n \"keyup\"\n );\n this.keycharm.bind(\n \"num+\",\n () => {\n this.unbindFromRedraw(\"_zoomIn\");\n },\n \"keyup\"\n );\n this.keycharm.bind(\n \"num-\",\n () => {\n this.unbindFromRedraw(\"_zoomOut\");\n },\n \"keyup\"\n );\n this.keycharm.bind(\n \"-\",\n () => {\n this.unbindFromRedraw(\"_zoomOut\");\n },\n \"keyup\"\n );\n this.keycharm.bind(\n \"[\",\n () => {\n this.unbindFromRedraw(\"_zoomOut\");\n },\n \"keyup\"\n );\n this.keycharm.bind(\n \"]\",\n () => {\n this.unbindFromRedraw(\"_zoomIn\");\n },\n \"keyup\"\n );\n this.keycharm.bind(\n \"pageup\",\n () => {\n this.unbindFromRedraw(\"_zoomIn\");\n },\n \"keyup\"\n );\n this.keycharm.bind(\n \"pagedown\",\n () => {\n this.unbindFromRedraw(\"_zoomOut\");\n },\n \"keyup\"\n );\n }\n }\n }", "function bindKey(strRaw) {\n // split and trim, remove empty strings\n var processed = [];\n var sp = strRaw.split(\" \");\n for (i = 0; i < sp.length; i++) {\n sp[i] = sp[i].trim();\n if (i <= 1) sp[i] = sp[i].toUpperCase();\n if (sp[i] != \"\") {\n processed.push(sp[i]);\n }\n }\n\n var pKey = new Object();\n pKey.keyCode = processed[0].charCodeAt(0);\n pKey.command = processed[1];\n processed.splice(0, 2);\n pKey.arguments = processed;\n parsedKeyBinding.push(pKey);\n}", "function createNormalModeKeyboardShortcuts(_) {\n var normalModeKeyboardShortcuts = [['enter', 'edit mode', switchToEditMode],\n // [ 'shift+enter', 'run cell, select below', runCellAndSelectBelow ]\n // [ 'ctrl+enter', 'run cell', runCell ]\n // [ 'alt+enter', 'run cell, insert below', runCellAndInsertBelow ]\n ['y', 'to code', convertCellToCode], ['m', 'to markdown', convertCellToMarkdown], ['r', 'to raw', convertCellToRaw], ['1', 'to heading 1', convertCellToHeading(_, 1)], ['2', 'to heading 2', convertCellToHeading(_, 2)], ['3', 'to heading 3', convertCellToHeading(_, 3)], ['4', 'to heading 4', convertCellToHeading(_, 4)], ['5', 'to heading 5', convertCellToHeading(_, 5)], ['6', 'to heading 6', convertCellToHeading(_, 6)], ['up', 'select previous cell', selectPreviousCell], ['down', 'select next cell', selectNextCell], ['k', 'select previous cell', selectPreviousCell], ['j', 'select next cell', selectNextCell], ['ctrl+k', 'move cell up', moveCellUp], ['ctrl+j', 'move cell down', moveCellDown], ['a', 'insert cell above', insertNewCellAbove], ['b', 'insert cell below', insertNewCellBelow], ['x', 'cut cell', cutCell], ['c', 'copy cell', copyCell], ['shift+v', 'paste cell above', pasteCellAbove], ['v', 'paste cell below', pasteCellBelow], ['z', 'undo last delete', undoLastDelete], ['d d', 'delete cell (press twice)', deleteCell], ['shift+m', 'merge cell below', mergeCellBelow], ['s', 'save notebook', saveNotebook],\n // [ 'mod+s', 'save notebook', saveNotebook ]\n // [ 'l', 'toggle line numbers' ]\n ['o', 'toggle output', toggleOutput$1],\n // [ 'shift+o', 'toggle output scrolling' ]\n ['h', 'keyboard shortcuts', displayKeyboardShortcuts]];\n\n if (_.onSparklingWater) {\n normalModeKeyboardShortcuts.push(['q', 'to Scala', convertCellToScala]);\n }\n\n return normalModeKeyboardShortcuts;\n }", "update () {\n if (!this.initialized) { return }\n\n if (this.pendingUpdateOperation != null) { clearImmediate(this.pendingUpdateOperation) }\n\n return this.pendingUpdateOperation = setImmediate(() => {\n let binding\n const unsetKeystrokes = new Set()\n for (binding of Array.from(this.keymapManager.getKeyBindings())) {\n if (binding.command === 'unset!') {\n unsetKeystrokes.add(binding.keystrokes)\n }\n }\n\n const keystrokesByCommand = {}\n for (binding of Array.from(this.keymapManager.getKeyBindings())) {\n if (!this.includeSelector(binding.selector)) { continue }\n if (unsetKeystrokes.has(binding.keystrokes)) { continue }\n if (binding.keystrokes.includes(' ')) { continue }\n if ((process.platform === 'darwin') && /^alt-(shift-)?.$/.test(binding.keystrokes)) { continue }\n if ((process.platform === 'win32') && /^ctrl-alt-(shift-)?.$/.test(binding.keystrokes)) { continue }\n if (keystrokesByCommand[binding.command] == null) { keystrokesByCommand[binding.command] = [] }\n keystrokesByCommand[binding.command].unshift(binding.keystrokes)\n }\n\n return this.sendToBrowserProcess(this.template, keystrokesByCommand)\n })\n }", "function remapKeys(obj, keymap) {\n ret = {}\n for (var k in obj) {\n if (keymap[k]) ret[keymap[k]] = obj[k]\n }\n return ret\n}", "function updateStylingMap(tView, tNode, lView, renderer, oldKeyValueArray, newKeyValueArray, isClassBased, bindingIndex) {\n if (oldKeyValueArray === NO_CHANGE) {\n // On first execution the oldKeyValueArray is NO_CHANGE => treat it as empty KeyValueArray.\n oldKeyValueArray = EMPTY_ARRAY$3;\n }\n\n var oldIndex = 0;\n var newIndex = 0;\n var oldKey = 0 < oldKeyValueArray.length ? oldKeyValueArray[0] : null;\n var newKey = 0 < newKeyValueArray.length ? newKeyValueArray[0] : null;\n\n while (oldKey !== null || newKey !== null) {\n ngDevMode && assertLessThan(oldIndex, 999, 'Are we stuck in infinite loop?');\n ngDevMode && assertLessThan(newIndex, 999, 'Are we stuck in infinite loop?');\n var oldValue = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex + 1] : undefined;\n var newValue = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex + 1] : undefined;\n var setKey = null;\n var setValue = undefined;\n\n if (oldKey === newKey) {\n // UPDATE: Keys are equal => new value is overwriting old value.\n oldIndex += 2;\n newIndex += 2;\n\n if (oldValue !== newValue) {\n setKey = newKey;\n setValue = newValue;\n }\n } else if (newKey === null || oldKey !== null && oldKey < newKey) {\n // DELETE: oldKey key is missing or we did not find the oldKey in the newValue\n // (because the keyValueArray is sorted and `newKey` is found later alphabetically).\n // `\"background\" < \"color\"` so we need to delete `\"background\"` because it is not found in the\n // new array.\n oldIndex += 2;\n setKey = oldKey;\n } else {\n // CREATE: newKey's is earlier alphabetically than oldKey's (or no oldKey) => we have new key.\n // `\"color\" > \"background\"` so we need to add `color` because it is in new array but not in\n // old array.\n ngDevMode && assertDefined(newKey, 'Expecting to have a valid key');\n newIndex += 2;\n setKey = newKey;\n setValue = newValue;\n }\n\n if (setKey !== null) {\n updateStyling(tView, tNode, lView, renderer, setKey, setValue, isClassBased, bindingIndex);\n }\n\n oldKey = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex] : null;\n newKey = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex] : null;\n }\n}", "function dataNormalize(){\n var name,key,\n item,\n itemKeys;\n\n for( name in data.insertItems ){\n item = data.insertItems[name];\n itemKeys = item.keys;\n\n item.useCtrlKey = $.inArray('CTRL',itemKeys) < 0 ? false : true;\n item.useShiftKey = $.inArray('SHIFT',itemKeys) < 0 ? false : true;\n item.useAltKey = $.inArray('ALT',itemKeys) < 0 ? false : true;\n\n for(var i=0; i<itemKeys.length; i++){\n key = itemKeys[i];\n if(key==='CTRL' || key==='SHIFT' || key==='ALT') continue;\n item.useCharaKey = key;\n break;\n }\n }\n }", "function updateStylingMap(tView, tNode, lView, renderer, oldKeyValueArray, newKeyValueArray, isClassBased, bindingIndex) {\n if (oldKeyValueArray === NO_CHANGE) {\n // On first execution the oldKeyValueArray is NO_CHANGE => treat it as empty KeyValueArray.\n oldKeyValueArray = EMPTY_ARRAY$3;\n }\n let oldIndex = 0;\n let newIndex = 0;\n let oldKey = 0 < oldKeyValueArray.length ? oldKeyValueArray[0] : null;\n let newKey = 0 < newKeyValueArray.length ? newKeyValueArray[0] : null;\n while (oldKey !== null || newKey !== null) {\n ngDevMode && assertLessThan(oldIndex, 999, 'Are we stuck in infinite loop?');\n ngDevMode && assertLessThan(newIndex, 999, 'Are we stuck in infinite loop?');\n const oldValue = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex + 1] : undefined;\n const newValue = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex + 1] : undefined;\n let setKey = null;\n let setValue = undefined;\n if (oldKey === newKey) {\n // UPDATE: Keys are equal => new value is overwriting old value.\n oldIndex += 2;\n newIndex += 2;\n if (oldValue !== newValue) {\n setKey = newKey;\n setValue = newValue;\n }\n }\n else if (newKey === null || oldKey !== null && oldKey < newKey) {\n // DELETE: oldKey key is missing or we did not find the oldKey in the newValue\n // (because the keyValueArray is sorted and `newKey` is found later alphabetically).\n // `\"background\" < \"color\"` so we need to delete `\"background\"` because it is not found in the\n // new array.\n oldIndex += 2;\n setKey = oldKey;\n }\n else {\n // CREATE: newKey's is earlier alphabetically than oldKey's (or no oldKey) => we have new key.\n // `\"color\" > \"background\"` so we need to add `color` because it is in new array but not in\n // old array.\n ngDevMode && assertDefined(newKey, 'Expecting to have a valid key');\n newIndex += 2;\n setKey = newKey;\n setValue = newValue;\n }\n if (setKey !== null) {\n updateStyling(tView, tNode, lView, renderer, setKey, setValue, isClassBased, bindingIndex);\n }\n oldKey = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex] : null;\n newKey = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex] : null;\n }\n}", "function updateStylingMap(tView, tNode, lView, renderer, oldKeyValueArray, newKeyValueArray, isClassBased, bindingIndex) {\n if (oldKeyValueArray === NO_CHANGE) {\n // On first execution the oldKeyValueArray is NO_CHANGE => treat it as empty KeyValueArray.\n oldKeyValueArray = EMPTY_ARRAY;\n }\n let oldIndex = 0;\n let newIndex = 0;\n let oldKey = 0 < oldKeyValueArray.length ? oldKeyValueArray[0] : null;\n let newKey = 0 < newKeyValueArray.length ? newKeyValueArray[0] : null;\n while (oldKey !== null || newKey !== null) {\n ngDevMode && assertLessThan(oldIndex, 999, 'Are we stuck in infinite loop?');\n ngDevMode && assertLessThan(newIndex, 999, 'Are we stuck in infinite loop?');\n const oldValue = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex + 1] : undefined;\n const newValue = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex + 1] : undefined;\n let setKey = null;\n let setValue = undefined;\n if (oldKey === newKey) {\n // UPDATE: Keys are equal => new value is overwriting old value.\n oldIndex += 2;\n newIndex += 2;\n if (oldValue !== newValue) {\n setKey = newKey;\n setValue = newValue;\n }\n }\n else if (newKey === null || oldKey !== null && oldKey < newKey) {\n // DELETE: oldKey key is missing or we did not find the oldKey in the newValue\n // (because the keyValueArray is sorted and `newKey` is found later alphabetically).\n // `\"background\" < \"color\"` so we need to delete `\"background\"` because it is not found in the\n // new array.\n oldIndex += 2;\n setKey = oldKey;\n }\n else {\n // CREATE: newKey's is earlier alphabetically than oldKey's (or no oldKey) => we have new key.\n // `\"color\" > \"background\"` so we need to add `color` because it is in new array but not in\n // old array.\n ngDevMode && assertDefined(newKey, 'Expecting to have a valid key');\n newIndex += 2;\n setKey = newKey;\n setValue = newValue;\n }\n if (setKey !== null) {\n updateStyling(tView, tNode, lView, renderer, setKey, setValue, isClassBased, bindingIndex);\n }\n oldKey = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex] : null;\n newKey = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex] : null;\n }\n}", "function updateStylingMap(tView, tNode, lView, renderer, oldKeyValueArray, newKeyValueArray, isClassBased, bindingIndex) {\n if (oldKeyValueArray === NO_CHANGE) {\n // On first execution the oldKeyValueArray is NO_CHANGE => treat it as empty KeyValueArray.\n oldKeyValueArray = EMPTY_ARRAY;\n }\n let oldIndex = 0;\n let newIndex = 0;\n let oldKey = 0 < oldKeyValueArray.length ? oldKeyValueArray[0] : null;\n let newKey = 0 < newKeyValueArray.length ? newKeyValueArray[0] : null;\n while (oldKey !== null || newKey !== null) {\n ngDevMode && assertLessThan(oldIndex, 999, 'Are we stuck in infinite loop?');\n ngDevMode && assertLessThan(newIndex, 999, 'Are we stuck in infinite loop?');\n const oldValue = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex + 1] : undefined;\n const newValue = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex + 1] : undefined;\n let setKey = null;\n let setValue = undefined;\n if (oldKey === newKey) {\n // UPDATE: Keys are equal => new value is overwriting old value.\n oldIndex += 2;\n newIndex += 2;\n if (oldValue !== newValue) {\n setKey = newKey;\n setValue = newValue;\n }\n }\n else if (newKey === null || oldKey !== null && oldKey < newKey) {\n // DELETE: oldKey key is missing or we did not find the oldKey in the newValue\n // (because the keyValueArray is sorted and `newKey` is found later alphabetically).\n // `\"background\" < \"color\"` so we need to delete `\"background\"` because it is not found in the\n // new array.\n oldIndex += 2;\n setKey = oldKey;\n }\n else {\n // CREATE: newKey's is earlier alphabetically than oldKey's (or no oldKey) => we have new key.\n // `\"color\" > \"background\"` so we need to add `color` because it is in new array but not in\n // old array.\n ngDevMode && assertDefined(newKey, 'Expecting to have a valid key');\n newIndex += 2;\n setKey = newKey;\n setValue = newValue;\n }\n if (setKey !== null) {\n updateStyling(tView, tNode, lView, renderer, setKey, setValue, isClassBased, bindingIndex);\n }\n oldKey = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex] : null;\n newKey = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex] : null;\n }\n}", "function updateStylingMap(tView, tNode, lView, renderer, oldKeyValueArray, newKeyValueArray, isClassBased, bindingIndex) {\n if (oldKeyValueArray === NO_CHANGE) {\n // On first execution the oldKeyValueArray is NO_CHANGE => treat it as empty KeyValueArray.\n oldKeyValueArray = EMPTY_ARRAY;\n }\n let oldIndex = 0;\n let newIndex = 0;\n let oldKey = 0 < oldKeyValueArray.length ? oldKeyValueArray[0] : null;\n let newKey = 0 < newKeyValueArray.length ? newKeyValueArray[0] : null;\n while (oldKey !== null || newKey !== null) {\n ngDevMode && assertLessThan(oldIndex, 999, 'Are we stuck in infinite loop?');\n ngDevMode && assertLessThan(newIndex, 999, 'Are we stuck in infinite loop?');\n const oldValue = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex + 1] : undefined;\n const newValue = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex + 1] : undefined;\n let setKey = null;\n let setValue = undefined;\n if (oldKey === newKey) {\n // UPDATE: Keys are equal => new value is overwriting old value.\n oldIndex += 2;\n newIndex += 2;\n if (oldValue !== newValue) {\n setKey = newKey;\n setValue = newValue;\n }\n }\n else if (newKey === null || oldKey !== null && oldKey < newKey) {\n // DELETE: oldKey key is missing or we did not find the oldKey in the newValue\n // (because the keyValueArray is sorted and `newKey` is found later alphabetically).\n // `\"background\" < \"color\"` so we need to delete `\"background\"` because it is not found in the\n // new array.\n oldIndex += 2;\n setKey = oldKey;\n }\n else {\n // CREATE: newKey's is earlier alphabetically than oldKey's (or no oldKey) => we have new key.\n // `\"color\" > \"background\"` so we need to add `color` because it is in new array but not in\n // old array.\n ngDevMode && assertDefined(newKey, 'Expecting to have a valid key');\n newIndex += 2;\n setKey = newKey;\n setValue = newValue;\n }\n if (setKey !== null) {\n updateStyling(tView, tNode, lView, renderer, setKey, setValue, isClassBased, bindingIndex);\n }\n oldKey = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex] : null;\n newKey = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex] : null;\n }\n}", "function updateStylingMap(tView, tNode, lView, renderer, oldKeyValueArray, newKeyValueArray, isClassBased, bindingIndex) {\n if (oldKeyValueArray === NO_CHANGE) {\n // On first execution the oldKeyValueArray is NO_CHANGE => treat it as empty KeyValueArray.\n oldKeyValueArray = EMPTY_ARRAY;\n }\n let oldIndex = 0;\n let newIndex = 0;\n let oldKey = 0 < oldKeyValueArray.length ? oldKeyValueArray[0] : null;\n let newKey = 0 < newKeyValueArray.length ? newKeyValueArray[0] : null;\n while (oldKey !== null || newKey !== null) {\n ngDevMode && assertLessThan(oldIndex, 999, 'Are we stuck in infinite loop?');\n ngDevMode && assertLessThan(newIndex, 999, 'Are we stuck in infinite loop?');\n const oldValue = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex + 1] : undefined;\n const newValue = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex + 1] : undefined;\n let setKey = null;\n let setValue = undefined;\n if (oldKey === newKey) {\n // UPDATE: Keys are equal => new value is overwriting old value.\n oldIndex += 2;\n newIndex += 2;\n if (oldValue !== newValue) {\n setKey = newKey;\n setValue = newValue;\n }\n }\n else if (newKey === null || oldKey !== null && oldKey < newKey) {\n // DELETE: oldKey key is missing or we did not find the oldKey in the newValue\n // (because the keyValueArray is sorted and `newKey` is found later alphabetically).\n // `\"background\" < \"color\"` so we need to delete `\"background\"` because it is not found in the\n // new array.\n oldIndex += 2;\n setKey = oldKey;\n }\n else {\n // CREATE: newKey's is earlier alphabetically than oldKey's (or no oldKey) => we have new key.\n // `\"color\" > \"background\"` so we need to add `color` because it is in new array but not in\n // old array.\n ngDevMode && assertDefined(newKey, 'Expecting to have a valid key');\n newIndex += 2;\n setKey = newKey;\n setValue = newValue;\n }\n if (setKey !== null) {\n updateStyling(tView, tNode, lView, renderer, setKey, setValue, isClassBased, bindingIndex);\n }\n oldKey = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex] : null;\n newKey = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex] : null;\n }\n}", "function updateStylingMap(tView, tNode, lView, renderer, oldKeyValueArray, newKeyValueArray, isClassBased, bindingIndex) {\n if (oldKeyValueArray === NO_CHANGE) {\n // On first execution the oldKeyValueArray is NO_CHANGE => treat it as empty KeyValueArray.\n oldKeyValueArray = EMPTY_ARRAY;\n }\n let oldIndex = 0;\n let newIndex = 0;\n let oldKey = 0 < oldKeyValueArray.length ? oldKeyValueArray[0] : null;\n let newKey = 0 < newKeyValueArray.length ? newKeyValueArray[0] : null;\n while (oldKey !== null || newKey !== null) {\n ngDevMode && assertLessThan(oldIndex, 999, 'Are we stuck in infinite loop?');\n ngDevMode && assertLessThan(newIndex, 999, 'Are we stuck in infinite loop?');\n const oldValue = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex + 1] : undefined;\n const newValue = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex + 1] : undefined;\n let setKey = null;\n let setValue = undefined;\n if (oldKey === newKey) {\n // UPDATE: Keys are equal => new value is overwriting old value.\n oldIndex += 2;\n newIndex += 2;\n if (oldValue !== newValue) {\n setKey = newKey;\n setValue = newValue;\n }\n }\n else if (newKey === null || oldKey !== null && oldKey < newKey) {\n // DELETE: oldKey key is missing or we did not find the oldKey in the newValue\n // (because the keyValueArray is sorted and `newKey` is found later alphabetically).\n // `\"background\" < \"color\"` so we need to delete `\"background\"` because it is not found in the\n // new array.\n oldIndex += 2;\n setKey = oldKey;\n }\n else {\n // CREATE: newKey's is earlier alphabetically than oldKey's (or no oldKey) => we have new key.\n // `\"color\" > \"background\"` so we need to add `color` because it is in new array but not in\n // old array.\n ngDevMode && assertDefined(newKey, 'Expecting to have a valid key');\n newIndex += 2;\n setKey = newKey;\n setValue = newValue;\n }\n if (setKey !== null) {\n updateStyling(tView, tNode, lView, renderer, setKey, setValue, isClassBased, bindingIndex);\n }\n oldKey = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex] : null;\n newKey = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex] : null;\n }\n}", "function updateStylingMap(tView, tNode, lView, renderer, oldKeyValueArray, newKeyValueArray, isClassBased, bindingIndex) {\n if (oldKeyValueArray === NO_CHANGE) {\n // On first execution the oldKeyValueArray is NO_CHANGE => treat it as empty KeyValueArray.\n oldKeyValueArray = EMPTY_ARRAY$3;\n }\n\n var oldIndex = 0;\n var newIndex = 0;\n var oldKey = 0 < oldKeyValueArray.length ? oldKeyValueArray[0] : null;\n var newKey = 0 < newKeyValueArray.length ? newKeyValueArray[0] : null;\n\n while (oldKey !== null || newKey !== null) {\n ngDevMode && assertLessThan(oldIndex, 999, 'Are we stuck in infinite loop?');\n ngDevMode && assertLessThan(newIndex, 999, 'Are we stuck in infinite loop?');\n var oldValue = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex + 1] : undefined;\n var newValue = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex + 1] : undefined;\n var setKey = null;\n var setValue = undefined;\n\n if (oldKey === newKey) {\n // UPDATE: Keys are equal => new value is overwriting old value.\n oldIndex += 2;\n newIndex += 2;\n\n if (oldValue !== newValue) {\n setKey = newKey;\n setValue = newValue;\n }\n } else if (newKey === null || oldKey !== null && oldKey < newKey) {\n // DELETE: oldKey key is missing or we did not find the oldKey in the newValue\n // (because the keyValueArray is sorted and `newKey` is found later alphabetically).\n // `\"background\" < \"color\"` so we need to delete `\"background\"` because it is not found in the\n // new array.\n oldIndex += 2;\n setKey = oldKey;\n } else {\n // CREATE: newKey's is earlier alphabetically than oldKey's (or no oldKey) => we have new key.\n // `\"color\" > \"background\"` so we need to add `color` because it is in new array but not in\n // old array.\n ngDevMode && assertDefined(newKey, 'Expecting to have a valid key');\n newIndex += 2;\n setKey = newKey;\n setValue = newValue;\n }\n\n if (setKey !== null) {\n updateStyling(tView, tNode, lView, renderer, setKey, setValue, isClassBased, bindingIndex);\n }\n\n oldKey = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex] : null;\n newKey = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex] : null;\n }\n }", "function realign() {\n var keyboard = $('keyboard');\n var params = new AlignmentOptions();\n var layout = keyboard.layout;\n var keysets =\n keyboard.querySelectorAll('kb-keyset[id^=' + layout + ']').array();\n for (var i = 0; i<keysets.length ; i++) {\n realignKeyset(keysets[i], params);\n }\n keyboard.stale = false;\n exports.recordKeysets();\n }", "function patchStylingMapIntoContext(context, directiveIndex, playerBuilderIndex, ctxStart, ctxEnd, props, values, cacheValue, entryIsClassBased) {\n var dirty = false;\n var cacheIndex = 1 /* ValuesStartPosition */ +\n directiveIndex * 4 /* Size */;\n // the cachedValues array is the registry of all multi style values (map values). Each\n // value is stored (cached) each time is updated.\n var cachedValues = context[entryIsClassBased ? 6 /* CachedMultiClasses */ : 7 /* CachedMultiStyles */];\n // this is the index in which this directive has ownership access to write to this\n // value (anything before is owned by a previous directive that is more important)\n var ownershipValuesStartIndex = cachedValues[cacheIndex + 1 /* PositionStartOffset */];\n var existingCachedValue = cachedValues[cacheIndex + 2 /* ValueOffset */];\n var existingCachedValueCount = cachedValues[cacheIndex + 3 /* ValueCountOffset */];\n var existingCachedValueIsDirty = cachedValues[cacheIndex + 0 /* DirtyFlagOffset */] === 1;\n // A shape change means the provided map value has either removed or added new properties\n // compared to what were in the last time. If a shape change occurs then it means that all\n // follow-up multi-styling entries are obsolete and will be examined again when CD runs\n // them. If a shape change has not occurred then there is no reason to check any other\n // directive values if their identity has not changed. If a previous directive set this\n // value as dirty (because its own shape changed) then this means that the object has been\n // offset to a different area in the context. Because its value has been offset then it\n // can't write to a region that it wrote to before (which may have been apart of another\n // directive) and therefore its shape changes too.\n var valuesEntryShapeChange = existingCachedValueIsDirty || ((!existingCachedValue && cacheValue) ? true : false);\n var totalUniqueValues = 0;\n var totalNewAllocatedSlots = 0;\n // this is a trick to avoid building {key:value} map where all the values\n // are `true` (this happens when a className string is provided instead of a\n // map as an input value to this styling algorithm)\n var applyAllProps = values === true;\n // STEP 1:\n // loop through the earlier directives and figure out if any properties here will be placed\n // in their area (this happens when the value is null because the earlier directive erased it).\n var ctxIndex = ctxStart;\n var totalRemainingProperties = props.length;\n while (ctxIndex < ownershipValuesStartIndex) {\n var currentProp = getProp(context, ctxIndex);\n if (totalRemainingProperties) {\n for (var i = 0; i < props.length; i++) {\n var mapProp = props[i];\n var normalizedProp = mapProp ? (entryIsClassBased ? mapProp : hyphenate(mapProp)) : null;\n if (normalizedProp && currentProp === normalizedProp) {\n var currentValue = getValue(context, ctxIndex);\n var currentDirectiveIndex = getDirectiveIndexFromEntry(context, ctxIndex);\n var value = applyAllProps ? true : values[normalizedProp];\n var currentFlag = getPointers(context, ctxIndex);\n if (hasValueChanged(currentFlag, currentValue, value) &&\n allowValueChange(currentValue, value, currentDirectiveIndex, directiveIndex)) {\n setValue(context, ctxIndex, value);\n setPlayerBuilderIndex(context, ctxIndex, playerBuilderIndex, directiveIndex);\n if (hasInitialValueChanged(context, currentFlag, value)) {\n setDirty(context, ctxIndex, true);\n dirty = true;\n }\n }\n props[i] = null;\n totalRemainingProperties--;\n break;\n }\n }\n }\n ctxIndex += 4 /* Size */;\n }\n // STEP 2:\n // apply the left over properties to the context in the correct order.\n if (totalRemainingProperties) {\n var sanitizer = entryIsClassBased ? null : getStyleSanitizer(context, directiveIndex);\n propertiesLoop: for (var i = 0; i < props.length; i++) {\n var mapProp = props[i];\n if (!mapProp) {\n // this is an early exit in case a value was already encountered above in the\n // previous loop (which means that the property was applied or rejected)\n continue;\n }\n var value = applyAllProps ? true : values[mapProp];\n var normalizedProp = entryIsClassBased ? mapProp : hyphenate(mapProp);\n var isInsideOwnershipArea = ctxIndex >= ownershipValuesStartIndex;\n for (var j = ctxIndex; j < ctxEnd; j += 4 /* Size */) {\n var distantCtxProp = getProp(context, j);\n if (distantCtxProp === normalizedProp) {\n var distantCtxDirectiveIndex = getDirectiveIndexFromEntry(context, j);\n var distantCtxPlayerBuilderIndex = getPlayerBuilderIndex(context, j);\n var distantCtxValue = getValue(context, j);\n var distantCtxFlag = getPointers(context, j);\n if (allowValueChange(distantCtxValue, value, distantCtxDirectiveIndex, directiveIndex)) {\n // even if the entry isn't updated (by value or directiveIndex) then\n // it should still be moved over to the correct spot in the array so\n // the iteration loop is tighter.\n if (isInsideOwnershipArea) {\n swapMultiContextEntries(context, ctxIndex, j);\n totalUniqueValues++;\n }\n if (hasValueChanged(distantCtxFlag, distantCtxValue, value)) {\n if (value === null || value === undefined && value !== distantCtxValue) {\n valuesEntryShapeChange = true;\n }\n setValue(context, ctxIndex, value);\n // SKIP IF INITIAL CHECK\n // If the former `value` is `null` then it means that an initial value\n // could be being rendered on screen. If that is the case then there is\n // no point in updating the value in case it matches. In other words if the\n // new value is the exact same as the previously rendered value (which\n // happens to be the initial value) then do nothing.\n if (distantCtxValue !== null ||\n hasInitialValueChanged(context, distantCtxFlag, value)) {\n setDirty(context, ctxIndex, true);\n dirty = true;\n }\n }\n if (distantCtxDirectiveIndex !== directiveIndex ||\n playerBuilderIndex !== distantCtxPlayerBuilderIndex) {\n setPlayerBuilderIndex(context, ctxIndex, playerBuilderIndex, directiveIndex);\n }\n }\n ctxIndex += 4 /* Size */;\n continue propertiesLoop;\n }\n }\n // fallback case ... value not found at all in the context\n if (value != null) {\n valuesEntryShapeChange = true;\n totalUniqueValues++;\n var flag = prepareInitialFlag(context, normalizedProp, entryIsClassBased, sanitizer) |\n 1 /* Dirty */;\n var insertionIndex = isInsideOwnershipArea ?\n ctxIndex :\n (ownershipValuesStartIndex + totalNewAllocatedSlots * 4 /* Size */);\n insertNewMultiProperty(context, insertionIndex, entryIsClassBased, normalizedProp, flag, value, directiveIndex, playerBuilderIndex);\n totalNewAllocatedSlots++;\n ctxEnd += 4 /* Size */;\n ctxIndex += 4 /* Size */;\n dirty = true;\n }\n }\n }\n // STEP 3:\n // Remove (nullify) any existing entries in the context that were not apart of the\n // map input value that was passed into this algorithm for this directive.\n while (ctxIndex < ctxEnd) {\n valuesEntryShapeChange = true; // some values are missing\n var ctxValue = getValue(context, ctxIndex);\n var ctxFlag = getPointers(context, ctxIndex);\n var ctxDirective = getDirectiveIndexFromEntry(context, ctxIndex);\n if (ctxValue != null) {\n valuesEntryShapeChange = true;\n }\n if (hasValueChanged(ctxFlag, ctxValue, null)) {\n setValue(context, ctxIndex, null);\n // only if the initial value is falsy then\n if (hasInitialValueChanged(context, ctxFlag, ctxValue)) {\n setDirty(context, ctxIndex, true);\n dirty = true;\n }\n setPlayerBuilderIndex(context, ctxIndex, playerBuilderIndex, directiveIndex);\n }\n ctxIndex += 4 /* Size */;\n }\n // Because the object shape has changed, this means that all follow-up directives will need to\n // reapply their values into the object. For this to happen, the cached array needs to be updated\n // with dirty flags so that follow-up calls to `updateStylingMap` will reapply their styling code.\n // the reapplication of styling code within the context will reshape it and update the offset\n // values (also follow-up directives can write new values in case earlier directives set anything\n // to null due to removals or falsy values).\n valuesEntryShapeChange = valuesEntryShapeChange || existingCachedValueCount !== totalUniqueValues;\n updateCachedMapValue(context, directiveIndex, entryIsClassBased, cacheValue, ownershipValuesStartIndex, ctxEnd, totalUniqueValues, valuesEntryShapeChange);\n if (dirty) {\n setContextDirty(context, true);\n }\n return totalNewAllocatedSlots;\n}", "function standardizeKey (key) {\n switch (key) {\n case \"A\":\n key = \"a\";\n break;\n case \"C\":\n key = \"c\";\n break;\n case \"Backspace\":\n key = \"bs\";\n break;\n case \"Enter\":\n key = \"=\";\n break;\n case \"=\":\n key = \"+\";\n break;\n case \"x\":\n key = \"*\";\n break;\n }\n return key;\n}", "function bindCommand(options)\n{\n KeyMap.clear();\n\n $.each($.extend(true, {}, options.default_key_bind, options.key_bind), function(map, bind) {\n $.each(bind, function(key, command) {\n KeyMap[map](key, command);\n });\n });\n}", "function realignAll() {\n var keyboard = $('keyboard');\n var layoutParams = {};\n\n var idToLayout = function(id) {\n var parts = id.split('-');\n parts.pop();\n return parts.join('-');\n }\n\n var keysets = keyboard.querySelectorAll('kb-keyset').array();\n for (var i=0; i< keysets.length; i++) {\n var keyset = keysets[i];\n var layout = idToLayout(keyset.id);\n // Caches the layouts size parameters since all keysets in the same layout\n // will have the same specs.\n if (!(layout in layoutParams))\n layoutParams[layout] = new AlignmentOptions(keyset);\n realignKeyset(keyset, layoutParams[layout]);\n }\n exports.recordKeysets();\n }", "function createWithObjectKeys(portableTextFeatures, keyGenerator) {\n return function withKeys(editor) {\n const { apply, normalizeNode } = editor;\n editor.apply = operation => {\n if (operation.type === 'split_node') {\n operation.properties = Object.assign(Object.assign({}, operation.properties), { _key: keyGenerator() });\n }\n if (operation.type === 'insert_node') {\n // Must be given a new key or adding/removing marks while typing gets in trouble (duped keys)!\n operation.node = Object.assign(Object.assign({}, operation.node), { _key: keyGenerator() });\n }\n apply(operation);\n };\n editor.normalizeNode = entry => {\n const [node, path] = entry;\n if (slate_1.Element.isElement(node) && node._type === portableTextFeatures.types.block.name) {\n // Set key on block itself\n if (!node._key) {\n slate_1.Transforms.setNodes(editor, { _key: keyGenerator() }, { at: path });\n }\n // Set keys on it's children\n for (const [child, childPath] of slate_1.Node.children(editor, path)) {\n if (!child._key) {\n slate_1.Transforms.setNodes(editor, { _key: keyGenerator() }, { at: childPath });\n return;\n }\n }\n }\n // Do the original `normalizeNode` to enforce other constraints.\n normalizeNode(entry);\n };\n return editor;\n };\n}", "_preprocessUpdateExpression(expression) {\n return {\n nodeIndex: expression.nodeIndex,\n bindingIndex: expression.bindingIndex,\n sourceSpan: expression.sourceSpan,\n context: expression.context,\n value: convertPropertyBindingBuiltins({\n createLiteralArrayConverter: (argCount) => this._createLiteralArrayConverter(expression.sourceSpan, argCount),\n createLiteralMapConverter: (keys) => this._createLiteralMapConverter(expression.sourceSpan, keys),\n createPipeConverter: (name, argCount) => this._createPipeConverter(expression, name, argCount)\n }, expression.value)\n };\n }", "_preprocessUpdateExpression(expression) {\n return {\n nodeIndex: expression.nodeIndex,\n bindingIndex: expression.bindingIndex,\n sourceSpan: expression.sourceSpan,\n context: expression.context,\n value: convertPropertyBindingBuiltins({\n createLiteralArrayConverter: (argCount) => this._createLiteralArrayConverter(expression.sourceSpan, argCount),\n createLiteralMapConverter: (keys) => this._createLiteralMapConverter(expression.sourceSpan, keys),\n createPipeConverter: (name, argCount) => this._createPipeConverter(expression, name, argCount)\n }, expression.value)\n };\n }", "_preprocessUpdateExpression(expression) {\n return {\n nodeIndex: expression.nodeIndex,\n bindingIndex: expression.bindingIndex,\n sourceSpan: expression.sourceSpan,\n context: expression.context,\n value: convertPropertyBindingBuiltins({\n createLiteralArrayConverter: (argCount) => this._createLiteralArrayConverter(expression.sourceSpan, argCount),\n createLiteralMapConverter: (keys) => this._createLiteralMapConverter(expression.sourceSpan, keys),\n createPipeConverter: (name, argCount) => this._createPipeConverter(expression, name, argCount)\n }, expression.value)\n };\n }", "_preprocessUpdateExpression(expression) {\n return {\n nodeIndex: expression.nodeIndex,\n bindingIndex: expression.bindingIndex,\n sourceSpan: expression.sourceSpan,\n context: expression.context,\n value: convertPropertyBindingBuiltins({\n createLiteralArrayConverter: (argCount) => this._createLiteralArrayConverter(expression.sourceSpan, argCount),\n createLiteralMapConverter: (keys) => this._createLiteralMapConverter(expression.sourceSpan, keys),\n createPipeConverter: (name, argCount) => this._createPipeConverter(expression, name, argCount)\n }, expression.value)\n };\n }", "function updateStylingMap(context,classesInput,stylesInput,directiveRef){stylesInput=stylesInput||null;var directiveIndex=getDirectiveIndexFromRegistry(context,directiveRef||null);var element=context[5/* ElementPosition */];var classesPlayerBuilder=classesInput instanceof BoundPlayerFactory?new ClassAndStylePlayerBuilder(classesInput,element,1/* Class */):null;var stylesPlayerBuilder=stylesInput instanceof BoundPlayerFactory?new ClassAndStylePlayerBuilder(stylesInput,element,2/* Style */):null;var classesValue=classesPlayerBuilder?classesInput.value:classesInput;var stylesValue=stylesPlayerBuilder?stylesInput['value']:stylesInput;// early exit (this is what's done to avoid using ctx.bind() to cache the value)\nvar ignoreAllClassUpdates=limitToSingleClasses(context)||classesValue===NO_CHANGE||classesValue===context[6/* CachedClassValueOrInitialClassString */];var ignoreAllStyleUpdates=stylesValue===NO_CHANGE||stylesValue===context[7/* CachedStyleValue */];if(ignoreAllClassUpdates&&ignoreAllStyleUpdates)return;context[6/* CachedClassValueOrInitialClassString */]=classesValue;context[7/* CachedStyleValue */]=stylesValue;var classNames=EMPTY_ARRAY;var applyAllClasses=false;var playerBuildersAreDirty=false;var classesPlayerBuilderIndex=classesPlayerBuilder?1/* ClassMapPlayerBuilderPosition */:0;if(hasPlayerBuilderChanged(context,classesPlayerBuilder,1/* ClassMapPlayerBuilderPosition */)){setPlayerBuilder(context,classesPlayerBuilder,1/* ClassMapPlayerBuilderPosition */);playerBuildersAreDirty=true;}var stylesPlayerBuilderIndex=stylesPlayerBuilder?3/* StyleMapPlayerBuilderPosition */:0;if(hasPlayerBuilderChanged(context,stylesPlayerBuilder,3/* StyleMapPlayerBuilderPosition */)){setPlayerBuilder(context,stylesPlayerBuilder,3/* StyleMapPlayerBuilderPosition */);playerBuildersAreDirty=true;}// each time a string-based value pops up then it shouldn't require a deep\n// check of what's changed.\nif(!ignoreAllClassUpdates){if(typeof classesValue=='string'){classNames=classesValue.split(/\\s+/);// this boolean is used to avoid having to create a key/value map of `true` values\n// since a classname string implies that all those classes are added\napplyAllClasses=true;}else{classNames=classesValue?Object.keys(classesValue):EMPTY_ARRAY;}}var classes=classesValue||EMPTY_OBJ;var styleProps=stylesValue?Object.keys(stylesValue):EMPTY_ARRAY;var styles=stylesValue||EMPTY_OBJ;var classesStartIndex=styleProps.length;var multiStartIndex=getMultiStartIndex(context);var dirty=false;var ctxIndex=multiStartIndex;var propIndex=0;var propLimit=styleProps.length+classNames.length;// the main loop here will try and figure out how the shape of the provided\n// styles differ with respect to the context. Later if the context/styles/classes\n// are off-balance then they will be dealt in another loop after this one\nwhile(ctxIndex<context.length&&propIndex<propLimit){var isClassBased=propIndex>=classesStartIndex;var processValue=!isClassBased&&!ignoreAllStyleUpdates||isClassBased&&!ignoreAllClassUpdates;// when there is a cache-hit for a string-based class then we should\n// avoid doing any work diffing any of the changes\nif(processValue){var adjustedPropIndex=isClassBased?propIndex-classesStartIndex:propIndex;var newProp=isClassBased?classNames[adjustedPropIndex]:styleProps[adjustedPropIndex];var newValue=isClassBased?applyAllClasses?true:classes[newProp]:styles[newProp];var playerBuilderIndex=isClassBased?classesPlayerBuilderIndex:stylesPlayerBuilderIndex;var prop=getProp(context,ctxIndex);if(prop===newProp){var value=getValue(context,ctxIndex);var flag=getPointers(context,ctxIndex);setPlayerBuilderIndex(context,ctxIndex,playerBuilderIndex,directiveIndex);if(hasValueChanged(flag,value,newValue)){setValue(context,ctxIndex,newValue);playerBuildersAreDirty=playerBuildersAreDirty||!!playerBuilderIndex;var initialValue=getInitialValue(context,flag);// SKIP IF INITIAL CHECK\n// If the former `value` is `null` then it means that an initial value\n// could be being rendered on screen. If that is the case then there is\n// no point in updating the value incase it matches. In other words if the\n// new value is the exact same as the previously rendered value (which\n// happens to be the initial value) then do nothing.\nif(value!=null||hasValueChanged(flag,initialValue,newValue)){setDirty(context,ctxIndex,true);dirty=true;}}}else{var indexOfEntry=findEntryPositionByProp(context,newProp,ctxIndex);if(indexOfEntry>0){// it was found at a later point ... just swap the values\nvar valueToCompare=getValue(context,indexOfEntry);var flagToCompare=getPointers(context,indexOfEntry);swapMultiContextEntries(context,ctxIndex,indexOfEntry);if(hasValueChanged(flagToCompare,valueToCompare,newValue)){var initialValue=getInitialValue(context,flagToCompare);setValue(context,ctxIndex,newValue);// same if statement logic as above (look for SKIP IF INITIAL CHECK).\nif(valueToCompare!=null||hasValueChanged(flagToCompare,initialValue,newValue)){setDirty(context,ctxIndex,true);playerBuildersAreDirty=playerBuildersAreDirty||!!playerBuilderIndex;dirty=true;}}}else{// we only care to do this if the insertion is in the middle\nvar newFlag=prepareInitialFlag(context,newProp,isClassBased,getStyleSanitizer(context,directiveIndex));playerBuildersAreDirty=playerBuildersAreDirty||!!playerBuilderIndex;insertNewMultiProperty(context,ctxIndex,isClassBased,newProp,newFlag,newValue,directiveIndex,playerBuilderIndex);dirty=true;}}}ctxIndex+=4/* Size */;propIndex++;}// this means that there are left-over values in the context that\n// were not included in the provided styles/classes and in this\n// case the goal is to \"remove\" them from the context (by nullifying)\nwhile(ctxIndex<context.length){var flag=getPointers(context,ctxIndex);var isClassBased=(flag&2/* Class */)===2/* Class */;var processValue=!isClassBased&&!ignoreAllStyleUpdates||isClassBased&&!ignoreAllClassUpdates;if(processValue){var value=getValue(context,ctxIndex);var doRemoveValue=valueExists(value,isClassBased);if(doRemoveValue){setDirty(context,ctxIndex,true);setValue(context,ctxIndex,null);// we keep the player factory the same so that the `nulled` value can\n// be instructed into the player because removing a style and/or a class\n// is a valid animation player instruction.\nvar playerBuilderIndex=isClassBased?classesPlayerBuilderIndex:stylesPlayerBuilderIndex;setPlayerBuilderIndex(context,ctxIndex,playerBuilderIndex,directiveIndex);dirty=true;}}ctxIndex+=4/* Size */;}// this means that there are left-over properties in the context that\n// were not detected in the context during the loop above. In that\n// case we want to add the new entries into the list\nvar sanitizer=getStyleSanitizer(context,directiveIndex);while(propIndex<propLimit){var isClassBased=propIndex>=classesStartIndex;var processValue=!isClassBased&&!ignoreAllStyleUpdates||isClassBased&&!ignoreAllClassUpdates;if(processValue){var adjustedPropIndex=isClassBased?propIndex-classesStartIndex:propIndex;var prop=isClassBased?classNames[adjustedPropIndex]:styleProps[adjustedPropIndex];var value=isClassBased?applyAllClasses?true:classes[prop]:styles[prop];var flag=prepareInitialFlag(context,prop,isClassBased,sanitizer)|1/* Dirty */;var playerBuilderIndex=isClassBased?classesPlayerBuilderIndex:stylesPlayerBuilderIndex;var ctxIndex_1=context.length;context.push(flag,prop,value,0);setPlayerBuilderIndex(context,ctxIndex_1,playerBuilderIndex,directiveIndex);dirty=true;}propIndex++;}if(dirty){setContextDirty(context,true);setDirectiveDirty(context,directiveIndex,true);}if(playerBuildersAreDirty){setContextPlayersDirty(context,true);}}", "function normalizePromptContext(promptContext) {\n const normalizedPromptContext = {};\n\n for (const key in promptContext) {\n if (promptContext.hasOwnProperty(key)) {\n const snakeKey = key.replace(\n /[A-Z]/g,\n (match) => `_${match.toLowerCase()}`\n );\n normalizedPromptContext[snakeKey] = promptContext[key];\n }\n }\n\n return normalizedPromptContext;\n}", "componentWillMount() {\n var updateKeymap = function(keymap, name) {\n this.setState({\n \"keymap\": keymap,\n \"cmd\": new InfoCmd(\"Loaded \" + name)\n });\n\n if (this.bindings != undefined) {\n this.bindings.unbindAll();\n }\n this.bindings = new Bindings(keymap, this.handleKeyString.bind(this), this.handleKeyTemplate.bind(this));\n this.bindings.bindAll();\n\n // Clear everything on ctrl+x\n Mousetrap.bind(\"ctrl+x\", this.clearComment.bind(this));\n // TODO: maybe allow ctrl-z undo to work inside the input field\n // since you need to click out of any Template data prompt before\n // undo will take effect\n Mousetrap.bind(\"ctrl+z\", this.undoOrAbort.bind(this));\n\n }.bind(this);\n\n reqwest({\n url: 'assets/default.json',\n type: 'json',\n contentType: 'application/json',\n }).then(function(resp) {\n console.log(\"resp\", resp);\n updateKeymap(resp, \"default keymap\");\n });\n }", "function finalAbstractionFix(absOrig) {\n var result = {};\n\n for (var abs_key in absOrig) {\n curr_abs_commands = []\n for (var i = 0; i < absOrig[abs_key].length; i++) {\n curr_command = { 'expression': absOrig[abs_key][i]['command'][0], 'type': absOrig[abs_key][i]['command'][1] };\n if (absOrig[abs_key][i]['arguments'] !== undefined && absOrig[abs_key][i]['arguments'] !== null) {\n curr_arguments = { 'expression': absOrig[abs_key][i]['arguments'][0], 'type': absOrig[abs_key][i]['arguments'][1] };\n curr_abs_commands.push({ 'command': curr_command, 'arguments': curr_arguments });\n }\n else {\n curr_abs_commands.push({ 'command': curr_command });\n }\n }\n result[abs_key] = curr_abs_commands;\n }\n return result;\n}", "function KeyBindings(){\n\t/***** KEY BINDING VARIABLES (defaults set here) *****/\n\tthis.up1 = 119;\t\t\t// 'w'\n\tthis.up2 = 87;\t\t\t// 'W'\n\tthis.up3 = 38;\t\t\t// up arrow\n\tthis.up4 = -1;\t\t\t// unbound\n\t\n\tthis.down1 = 115;\t\t// 's'\n\tthis.down2 = 83;\t\t// 'S'\n\tthis.down3 = 40;\t\t// down arrow\n\tthis.down4 = -1;\t\t// unbound\n\t\n\tthis.left1 = 97;\t\t// 'a'\n\tthis.left2 = 65;\t\t// 'A'\n\tthis.left3 = 37;\t\t// left arrow\n\tthis.left4 = -1;\t\t// unbound\n\t\n\tthis.right1 = 100;\t\t// 'd'\n\tthis.right2 = 68;\t\t// 'D'\n\tthis.right3 = 39;\t\t// right arrow\n\tthis.right4 = -1;\t\t// unbound\n\t\n\tthis.shoot1 = 32;\t\t// space\n\tthis.shoot2 = -1;\t\t// unbound\n\tthis.shoot3 = -1;\t\t// unbound\n\tthis.shoot4 = -1;\t\t// unbound\n\t\n\tthis.pause1 = 27;\t\t// escape\n\tthis.pause2 = -1;\t\t// unbound\n\tthis.pause3 = -1;\t\t// unbound\n\tthis.pause4 = -1;\t\t// unbound\n\t\n\tthis.healthBars1 = 9;\t// tab\n\tthis.healthBars2 = -1;\t// unbound\n\tthis.healthBars3 = -1;\t// unbound\n\tthis.healthBars4 = -1;\t// unbound\n\t\n\tthis.timerBars1 = 9;\t// tab\n\tthis.timerBars2 = -1;\t// unbound\n\tthis.timerBars3 = -1;\t// unbound\n\tthis.timerBars4 = -1;\t// unbound\n\t\n\t\n\t// bind all functions (uses settings to access user database if the user\n\t//\tis logged in to load the user's custom keybindings. Otherwise, it keeps\n\t//\tthe default bindings.\n\tthis.bind = function(settingsObject){\n\t\t// if not logged in, return\n\t\tif(!settingsObject.loggedIn)\n\t\t\treturn;\n\t}\n\t\n\n\t/***** KEYBINDINGS CHECK FUNCTIONS *****/\n\t// returns TRUE if the key binding matches the given key code\n\tthis.upBinding = function(keyCode){ // UP movement\n\t\treturn keyCode == this.up1 || keyCode == this.up2 ||\n\t\t\t keyCode == this.up3 || keyCode == this.up4;\n\t}\n\tthis.downBinding = function(keyCode){ // DOWN movement\n\t\treturn keyCode == this.down1 || keyCode == this.down2 ||\n\t\t\t keyCode == this.down3 || keyCode == this.down4;\n\t}\n\tthis.leftBinding = function(keyCode){ // LEFT movement\n\t\treturn keyCode == this.left1 || keyCode == this.left2 ||\n\t\t\t keyCode == this.left3 || keyCode == this.left4;\n\t}\n\tthis.rightBinding = function(keyCode){ // RIGHT movement\n\t\treturn keyCode == this.right1 || keyCode == this.right2 ||\n\t\t\t keyCode == this.right3 || keyCode == this.right4;\n\t}\n\tthis.shootBinding = function(keyCode){ // SHOOT action\n\t\treturn keyCode == this.shoot1 || keyCode == this.shoot2 ||\n\t\t\t keyCode == this.shoot3 || keyCode == this.shoot4;\n\t}\n\tthis.pauseBinding = function(keyCode){ // PAUSE toggle\n\t\treturn keyCode == this.pause1 || keyCode == this.pause2 ||\n\t\t\t keyCode == this.pause3 || keyCode == this.pause4;\n\t}\n\tthis.healthBarToggleBinding = function(keyCode){ // HEALTH BAR toggle\n\t\treturn keyCode == this.healthBars1 || keyCode == this.healthBars2 ||\n\t\t\t keyCode == this.healthBars3 || keyCode == this.healthBars4;\n\t}\n\tthis.timerBarToggleBinding = function(keyCode){ // TIMER BAR toggle\n\t\treturn keyCode == this.timerBars1 || keyCode == this.timerBars2 ||\n\t\t\t keyCode == this.timerBars3 || keyCode == this.timerBars4;\n\t}\n}", "function normalizeKey(evt) {\n var key = evt.key; // If the event already has a normalized key, return it\n\n if (normalizedKeys.has(key)) {\n return key;\n } // tslint:disable-next-line:deprecation\n\n\n var mappedKey = mappedKeyCodes.get(evt.keyCode);\n\n if (mappedKey) {\n return mappedKey;\n }\n\n return KEY.UNKNOWN;\n}", "bindKeyHandlers() {\n const tank = this.tank;\n\n Object.keys(GameView.MOVES).forEach((k) => {\n const moves = GameView.MOVES[k];\n\n key(k, () => { \n this.gun.pos = [tank.pos[0] + moves[0], tank.pos[1]];\n tank.pos = [tank.pos[0] + moves[0], tank.pos[1]];\n });\n });\n\n key(\"space\", () => { tank.fireBullets() });\n }", "function keyTyped() {\n switch (key) {\n //row: 0 **************************\n case '\\-':\n dKey = '\\[';\n break;\n case '\\=':\n dKey = '\\]';\n break;\n\n //row: 1 **************************\n case 'q':\n dKey = '\\'';\n break;\n case 'w':\n dKey = '\\,';\n break;\n case 'e':\n dKey = '\\.';\n break;\n case 'r':\n dKey = 'p';\n break;\n case 't':\n dKey = 'y';\n break;\n case 'y':\n dKey = 'f';\n break;\n case 'u':\n dKey = 'g';\n break;\n case 'i':\n dKey = 'c';\n break;\n case 'o':\n dKey = 'r';\n break;\n case 'p':\n dKey = 'l';\n break;\n case '\\[':\n dKey = '/';\n break;\n case '\\]':\n dKey = '=';\n break;\n\n //row: 2 ************************************\n case 'a':\n dKey = 'a';\n break;\n case 's':\n dKey = 'o';\n break;\n case 'd':\n dKey = 'e';\n break;\n case 'f':\n dKey = 'u';\n break;\n case 'g':\n dKey = 'i';\n break;\n case 'h':\n dKey = 'd';\n break;\n case 'j':\n dKey = 'h';\n break;\n case 'k':\n dKey = 't';\n break;\n case 'l':\n dKey = 'n';\n break;\n case '\\;':\n dKey = 's';\n break;\n case '\\'':\n dKey = '\\-';\n break;\n case '\\\"': //above shift-case\n dKey = '\\-';\n break;\n\n //row: 3 ****************************************\n case 'z':\n dKey = '\\;';\n break;\n case 'x':\n dKey = 'q';\n break;\n case 'c':\n dKey = 'j';\n break;\n case 'v':\n dKey = 'k';\n break;\n case 'b':\n dKey = 'x';\n break;\n case 'n':\n dKey = 'b';\n break;\n case 'm':\n dKey = 'm';\n break;\n case '\\,':\n dKey = 'w';\n break;\n case '\\.':\n dKey = 'v';\n break;\n case '\\/':\n dKey = 'z';\n break;\n default:\n dKey = key;\n break;\n }\n return false;\n}", "_compileMapping() {\n const { axes, buttons } = this._compiledMapping;\n const axesIndexes = MAPS_INDEXES.axes;\n const buttonsIndexes = MAPS_INDEXES.buttons;\n\n // Clear existing\n axes.length = 0;\n buttons.length = 0;\n\n // Add axes\n const axesMap = this.map.axes;\n if (axesMap) {\n this.map.axes.forEach((axis, i) => {\n axes[axesIndexes[axis]] = () => this.pad.axes[i] || 0;\n });\n }\n\n // Fill empty indexes for axes\n for (let i = 0, l = axes.length; i < l; i++) {\n if (!axes[i]) {\n axes[i] = () => 0;\n }\n }\n\n // Add basic buttons\n const buttonsMap = this.map.buttons;\n if (buttonsMap) {\n buttonsMap.forEach((button, i) => {\n buttons[buttonsIndexes[button]] = () => this._buttons[i] || dummyButton;\n });\n }\n\n // Add synthesized buttons\n const synthesizedButtonsMap = this.map.synthesizedButtons;\n if (synthesizedButtonsMap) {\n Object.entries(synthesizedButtonsMap).forEach((button) => {\n const { axis, max, min } = button[1];\n buttons[buttonsIndexes[button[0]]] = () => new GamePadButton(\n Math.abs(math.clamp(this._axes[axis] ?? 0, min, max)),\n Math.abs(math.clamp(this._previousAxes[axis] ?? 0, min, max))\n );\n });\n }\n\n // Fill empty indexes for buttons\n for (let i = 0, l = buttons.length; i < l; i++) {\n if (!buttons[i]) {\n buttons[i] = () => dummyButton;\n }\n }\n }", "function keycharm(options) {\n var preventDefault = options && options.preventDefault || false;\n var container = options && options.container || window;\n var _exportFunctions = {};\n var _bound = {\n keydown: {},\n keyup: {}\n };\n var _keys = {};\n var i; // a - z\n\n for (i = 97; i <= 122; i++) {\n _keys[String.fromCharCode(i)] = {\n code: 65 + (i - 97),\n shift: false\n };\n } // A - Z\n\n\n for (i = 65; i <= 90; i++) {\n _keys[String.fromCharCode(i)] = {\n code: i,\n shift: true\n };\n } // 0 - 9\n\n\n for (i = 0; i <= 9; i++) {\n _keys['' + i] = {\n code: 48 + i,\n shift: false\n };\n } // F1 - F12\n\n\n for (i = 1; i <= 12; i++) {\n _keys['F' + i] = {\n code: 111 + i,\n shift: false\n };\n } // num0 - num9\n\n\n for (i = 0; i <= 9; i++) {\n _keys['num' + i] = {\n code: 96 + i,\n shift: false\n };\n } // numpad misc\n\n\n _keys['num*'] = {\n code: 106,\n shift: false\n };\n _keys['num+'] = {\n code: 107,\n shift: false\n };\n _keys['num-'] = {\n code: 109,\n shift: false\n };\n _keys['num/'] = {\n code: 111,\n shift: false\n };\n _keys['num.'] = {\n code: 110,\n shift: false\n }; // arrows\n\n _keys['left'] = {\n code: 37,\n shift: false\n };\n _keys['up'] = {\n code: 38,\n shift: false\n };\n _keys['right'] = {\n code: 39,\n shift: false\n };\n _keys['down'] = {\n code: 40,\n shift: false\n }; // extra keys\n\n _keys['space'] = {\n code: 32,\n shift: false\n };\n _keys['enter'] = {\n code: 13,\n shift: false\n };\n _keys['shift'] = {\n code: 16,\n shift: undefined\n };\n _keys['esc'] = {\n code: 27,\n shift: false\n };\n _keys['backspace'] = {\n code: 8,\n shift: false\n };\n _keys['tab'] = {\n code: 9,\n shift: false\n };\n _keys['ctrl'] = {\n code: 17,\n shift: false\n };\n _keys['alt'] = {\n code: 18,\n shift: false\n };\n _keys['delete'] = {\n code: 46,\n shift: false\n };\n _keys['pageup'] = {\n code: 33,\n shift: false\n };\n _keys['pagedown'] = {\n code: 34,\n shift: false\n }; // symbols\n\n _keys['='] = {\n code: 187,\n shift: false\n };\n _keys['-'] = {\n code: 189,\n shift: false\n };\n _keys[']'] = {\n code: 221,\n shift: false\n };\n _keys['['] = {\n code: 219,\n shift: false\n };\n\n var down = function (event) {\n handleEvent(event, 'keydown');\n };\n\n var up = function (event) {\n handleEvent(event, 'keyup');\n }; // handle the actualy bound key with the event\n\n\n var handleEvent = function (event, type) {\n if (_bound[type][event.keyCode] !== undefined) {\n var bound = _bound[type][event.keyCode];\n\n for (var i = 0; i < bound.length; i++) {\n if (bound[i].shift === undefined) {\n bound[i].fn(event);\n } else if (bound[i].shift == true && event.shiftKey == true) {\n bound[i].fn(event);\n } else if (bound[i].shift == false && event.shiftKey == false) {\n bound[i].fn(event);\n }\n }\n\n if (preventDefault == true) {\n event.preventDefault();\n }\n }\n }; // bind a key to a callback\n\n\n _exportFunctions.bind = function (key, callback, type) {\n if (type === undefined) {\n type = 'keydown';\n }\n\n if (_keys[key] === undefined) {\n throw new Error(\"unsupported key: \" + key);\n }\n\n if (_bound[type][_keys[key].code] === undefined) {\n _bound[type][_keys[key].code] = [];\n }\n\n _bound[type][_keys[key].code].push({\n fn: callback,\n shift: _keys[key].shift\n });\n }; // bind all keys to a call back (demo purposes)\n\n\n _exportFunctions.bindAll = function (callback, type) {\n if (type === undefined) {\n type = 'keydown';\n }\n\n for (var key in _keys) {\n if (_keys.hasOwnProperty(key)) {\n _exportFunctions.bind(key, callback, type);\n }\n }\n }; // get the key label from an event\n\n\n _exportFunctions.getKey = function (event) {\n for (var key in _keys) {\n if (_keys.hasOwnProperty(key)) {\n if (event.shiftKey == true && _keys[key].shift == true && event.keyCode == _keys[key].code) {\n return key;\n } else if (event.shiftKey == false && _keys[key].shift == false && event.keyCode == _keys[key].code) {\n return key;\n } else if (event.keyCode == _keys[key].code && key == 'shift') {\n return key;\n }\n }\n }\n\n return \"unknown key, currently not supported\";\n }; // unbind either a specific callback from a key or all of them (by leaving callback undefined)\n\n\n _exportFunctions.unbind = function (key, callback, type) {\n if (type === undefined) {\n type = 'keydown';\n }\n\n if (_keys[key] === undefined) {\n throw new Error(\"unsupported key: \" + key);\n }\n\n if (callback !== undefined) {\n var newBindings = [];\n var bound = _bound[type][_keys[key].code];\n\n if (bound !== undefined) {\n for (var i = 0; i < bound.length; i++) {\n if (!(bound[i].fn == callback && bound[i].shift == _keys[key].shift)) {\n newBindings.push(_bound[type][_keys[key].code][i]);\n }\n }\n }\n\n _bound[type][_keys[key].code] = newBindings;\n } else {\n _bound[type][_keys[key].code] = [];\n }\n }; // reset all bound variables.\n\n\n _exportFunctions.reset = function () {\n _bound = {\n keydown: {},\n keyup: {}\n };\n }; // unbind all listeners and reset all variables.\n\n\n _exportFunctions.destroy = function () {\n _bound = {\n keydown: {},\n keyup: {}\n };\n container.removeEventListener('keydown', down, true);\n container.removeEventListener('keyup', up, true);\n }; // create listeners.\n\n\n container.addEventListener('keydown', down, true);\n container.addEventListener('keyup', up, true); // return the public functions.\n\n return _exportFunctions;\n}", "initKeyCodes() {\n let keyCode;\n const keyCodes = {};\n\n for (let name in this.config) {\n if (name in keyCodeMap) {\n // special cases ('ctrl', 'shift', etc)\n keyCode = keyCodeMap[name];\n } else {\n // letters and numbers\n keyCode = name.toUpperCase().charCodeAt();\n }\n\n keyCodes[keyCode] = this.config[name];\n }\n\n this.keyCodes = keyCodes;\n }", "function updateActiveState() {\n const active = tableEditor.cursorIsInTable();\n if (active) {\n editor.setOption(\"extraKeys\", keyMap);\n }\n else {\n editor.setOption(\"extraKeys\", null);\n tableEditor.resetSmartCursor();\n }\n }", "function updateActiveState() {\n const active = tableEditor.cursorIsInTable();\n if (active) {\n editor.setOption(\"extraKeys\", keyMap);\n }\n else {\n editor.setOption(\"extraKeys\", null);\n tableEditor.resetSmartCursor();\n }\n }", "function changeKeys (src, dest) {\n for (var i in src) {\n if (typeof src[i] === 'object') {\n dest[escapedSingleQuotes + i +\n escapedSingleQuotes] = {};\n changeKeys(src[i], dest[escapedSingleQuotes + i +\n escapedSingleQuotes]);\n } else {\n dest[escapedSingleQuotes + i +\n escapedSingleQuotes] = src[i];\n }\n }\n return dest;\n }", "function _keyPathNormalize(kp) {\n return new String(kp).replace(/\\[([^\\[\\]]+)\\]/g, function(m, k) {\n return '.' + k.replace(/^[\"']|[\"']$/g, '')\n })\n}", "function KeyMap(unicode, encodingRoman, encoding, attached)\n{\n this.unicode = unicode;\n this.encodingRoman = encodingRoman;\n this.encoding = encoding;\n if (!attached)\n attached = false;\n this.attached = attached;\n}", "function _keyPathNormalize(kp) {\n\t return String(kp).replace(/\\[([^\\[\\]]+)\\]/g, function(m, k) {\n\t return '.' + k.replace(/^[\"']|[\"']$/g, '')\n\t })\n\t}", "function keyCleanup(oldKey, newKey, obj) {\n\tdelete Object.assign(obj, {\n\t\t[newKey]: obj[oldKey]\n\t})[oldKey];\n}", "function userKeyMap (settings) {\r\n var keyMapCopy = Object.assign({}, defaultKeyMap)\r\n if (settings) {\r\n // override the default keymap by the user defined ones\r\n Object.keys(keyMapCopy).forEach(function (key) {\r\n if (settings[key]) {\r\n keyMapCopy[key] = settings[key]\r\n }\r\n })\r\n }\r\n return keyMapCopy\r\n}", "function wrapApplyOnBindings(bindings)\n\t{\n\t\tbindings.apply = function(key)\n\t\t{\n\t\t\tfor (var index in bindings)\n\t\t\t{\n\t\t\t\tif (index !== 'apply' && typeof bindings[index].apply === 'function')\n\t\t\t\t{\n\t\t\t\t\tif (key) bindings[index].key === key && bindings[index].apply();\n\t\t\t\t\telse bindings[index].apply();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn bindings;\n\t}", "function normalizeKey(evt) {\n var key = evt.key;\n // If the event already has a normalized key, return it\n if (normalizedKeys.has(key)) {\n return key;\n }\n // tslint:disable-next-line:deprecation\n var mappedKey = mappedKeyCodes.get(evt.keyCode);\n if (mappedKey) {\n return mappedKey;\n }\n return KEY.UNKNOWN;\n }", "function replaceKeys(object) {\n Object.keys(object).forEach(function(key) {\n var newKey = key.replace(/\\s+/g, '').toLowerCase();\n if (object[key] && typeof object[key] === 'object') {\n replaceKeys(object[key]);\n }\n if (key !== newKey) {\n object[newKey] = object[key];\n delete object[key];\n }\n });\n}", "resetKeys(){\n for (let key of Object.keys(this.keyAssignment)) {\n // set property pressed to false for each key\n this.keyAssignment[key][2] = false;\n }\n }", "function normalizeKey(evt) {\n var key = evt.key;\n // If the event already has a normalized key, return it\n if (normalizedKeys.has(key)) {\n return key;\n }\n // tslint:disable-next-line:deprecation\n var mappedKey = mappedKeyCodes.get(evt.keyCode);\n if (mappedKey) {\n return mappedKey;\n }\n return exports.KEY.UNKNOWN;\n}", "function getDefaultKeyBinding(e) {\n switch (e.keyCode) {\n case 66:\n // B\n return hasCommandModifier(e) ? 'bold' : null;\n case 68:\n // D\n return isCtrlKeyCommand(e) ? 'delete' : null;\n case 72:\n // H\n return isCtrlKeyCommand(e) ? 'backspace' : null;\n case 73:\n // I\n return hasCommandModifier(e) ? 'italic' : null;\n case 74:\n // J\n return hasCommandModifier(e) ? 'code' : null;\n case 75:\n // K\n return !isWindows && isCtrlKeyCommand(e) ? 'secondary-cut' : null;\n case 77:\n // M\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 79:\n // O\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 84:\n // T\n return isOSX && isCtrlKeyCommand(e) ? 'transpose-characters' : null;\n case 85:\n // U\n return hasCommandModifier(e) ? 'underline' : null;\n case 87:\n // W\n return isOSX && isCtrlKeyCommand(e) ? 'backspace-word' : null;\n case 89:\n // Y\n if (isCtrlKeyCommand(e)) {\n return isWindows ? 'redo' : 'secondary-paste';\n }\n return null;\n case 90:\n // Z\n return getZCommand(e) || null;\n case Keys.RETURN:\n return 'split-block';\n case Keys.DELETE:\n return getDeleteCommand(e);\n case Keys.BACKSPACE:\n return getBackspaceCommand(e);\n // LEFT/RIGHT handlers serve as a workaround for a Firefox bug.\n case Keys.LEFT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-start-of-block' : null;\n case Keys.RIGHT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-end-of-block' : null;\n default:\n return null;\n }\n}", "function getDefaultKeyBinding(e) {\n switch (e.keyCode) {\n case 66:\n // B\n return hasCommandModifier(e) ? 'bold' : null;\n case 68:\n // D\n return isCtrlKeyCommand(e) ? 'delete' : null;\n case 72:\n // H\n return isCtrlKeyCommand(e) ? 'backspace' : null;\n case 73:\n // I\n return hasCommandModifier(e) ? 'italic' : null;\n case 74:\n // J\n return hasCommandModifier(e) ? 'code' : null;\n case 75:\n // K\n return !isWindows && isCtrlKeyCommand(e) ? 'secondary-cut' : null;\n case 77:\n // M\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 79:\n // O\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 84:\n // T\n return isOSX && isCtrlKeyCommand(e) ? 'transpose-characters' : null;\n case 85:\n // U\n return hasCommandModifier(e) ? 'underline' : null;\n case 87:\n // W\n return isOSX && isCtrlKeyCommand(e) ? 'backspace-word' : null;\n case 89:\n // Y\n if (isCtrlKeyCommand(e)) {\n return isWindows ? 'redo' : 'secondary-paste';\n }\n return null;\n case 90:\n // Z\n return getZCommand(e) || null;\n case Keys.RETURN:\n return 'split-block';\n case Keys.DELETE:\n return getDeleteCommand(e);\n case Keys.BACKSPACE:\n return getBackspaceCommand(e);\n // LEFT/RIGHT handlers serve as a workaround for a Firefox bug.\n case Keys.LEFT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-start-of-block' : null;\n case Keys.RIGHT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-end-of-block' : null;\n default:\n return null;\n }\n}", "function getDefaultKeyBinding(e) {\n switch (e.keyCode) {\n case 66:\n // B\n return hasCommandModifier(e) ? 'bold' : null;\n case 68:\n // D\n return isCtrlKeyCommand(e) ? 'delete' : null;\n case 72:\n // H\n return isCtrlKeyCommand(e) ? 'backspace' : null;\n case 73:\n // I\n return hasCommandModifier(e) ? 'italic' : null;\n case 74:\n // J\n return hasCommandModifier(e) ? 'code' : null;\n case 75:\n // K\n return !isWindows && isCtrlKeyCommand(e) ? 'secondary-cut' : null;\n case 77:\n // M\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 79:\n // O\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 84:\n // T\n return isOSX && isCtrlKeyCommand(e) ? 'transpose-characters' : null;\n case 85:\n // U\n return hasCommandModifier(e) ? 'underline' : null;\n case 87:\n // W\n return isOSX && isCtrlKeyCommand(e) ? 'backspace-word' : null;\n case 89:\n // Y\n if (isCtrlKeyCommand(e)) {\n return isWindows ? 'redo' : 'secondary-paste';\n }\n return null;\n case 90:\n // Z\n return getZCommand(e) || null;\n case Keys.RETURN:\n return 'split-block';\n case Keys.DELETE:\n return getDeleteCommand(e);\n case Keys.BACKSPACE:\n return getBackspaceCommand(e);\n // LEFT/RIGHT handlers serve as a workaround for a Firefox bug.\n case Keys.LEFT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-start-of-block' : null;\n case Keys.RIGHT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-end-of-block' : null;\n default:\n return null;\n }\n}", "function getDefaultKeyBinding(e) {\n switch (e.keyCode) {\n case 66:\n // B\n return hasCommandModifier(e) ? 'bold' : null;\n case 68:\n // D\n return isCtrlKeyCommand(e) ? 'delete' : null;\n case 72:\n // H\n return isCtrlKeyCommand(e) ? 'backspace' : null;\n case 73:\n // I\n return hasCommandModifier(e) ? 'italic' : null;\n case 74:\n // J\n return hasCommandModifier(e) ? 'code' : null;\n case 75:\n // K\n return !isWindows && isCtrlKeyCommand(e) ? 'secondary-cut' : null;\n case 77:\n // M\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 79:\n // O\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 84:\n // T\n return isOSX && isCtrlKeyCommand(e) ? 'transpose-characters' : null;\n case 85:\n // U\n return hasCommandModifier(e) ? 'underline' : null;\n case 87:\n // W\n return isOSX && isCtrlKeyCommand(e) ? 'backspace-word' : null;\n case 89:\n // Y\n if (isCtrlKeyCommand(e)) {\n return isWindows ? 'redo' : 'secondary-paste';\n }\n return null;\n case 90:\n // Z\n return getZCommand(e) || null;\n case Keys.RETURN:\n return 'split-block';\n case Keys.DELETE:\n return getDeleteCommand(e);\n case Keys.BACKSPACE:\n return getBackspaceCommand(e);\n // LEFT/RIGHT handlers serve as a workaround for a Firefox bug.\n case Keys.LEFT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-start-of-block' : null;\n case Keys.RIGHT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-end-of-block' : null;\n default:\n return null;\n }\n}", "function getDefaultKeyBinding(e) {\n switch (e.keyCode) {\n case 66:\n // B\n return hasCommandModifier(e) ? 'bold' : null;\n case 68:\n // D\n return isCtrlKeyCommand(e) ? 'delete' : null;\n case 72:\n // H\n return isCtrlKeyCommand(e) ? 'backspace' : null;\n case 73:\n // I\n return hasCommandModifier(e) ? 'italic' : null;\n case 74:\n // J\n return hasCommandModifier(e) ? 'code' : null;\n case 75:\n // K\n return !isWindows && isCtrlKeyCommand(e) ? 'secondary-cut' : null;\n case 77:\n // M\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 79:\n // O\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 84:\n // T\n return isOSX && isCtrlKeyCommand(e) ? 'transpose-characters' : null;\n case 85:\n // U\n return hasCommandModifier(e) ? 'underline' : null;\n case 87:\n // W\n return isOSX && isCtrlKeyCommand(e) ? 'backspace-word' : null;\n case 89:\n // Y\n if (isCtrlKeyCommand(e)) {\n return isWindows ? 'redo' : 'secondary-paste';\n }\n return null;\n case 90:\n // Z\n return getZCommand(e) || null;\n case Keys.RETURN:\n return 'split-block';\n case Keys.DELETE:\n return getDeleteCommand(e);\n case Keys.BACKSPACE:\n return getBackspaceCommand(e);\n // LEFT/RIGHT handlers serve as a workaround for a Firefox bug.\n case Keys.LEFT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-start-of-block' : null;\n case Keys.RIGHT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-end-of-block' : null;\n default:\n return null;\n }\n}", "function getDefaultKeyBinding(e) {\n switch (e.keyCode) {\n case 66:\n // B\n return hasCommandModifier(e) ? 'bold' : null;\n case 68:\n // D\n return isCtrlKeyCommand(e) ? 'delete' : null;\n case 72:\n // H\n return isCtrlKeyCommand(e) ? 'backspace' : null;\n case 73:\n // I\n return hasCommandModifier(e) ? 'italic' : null;\n case 74:\n // J\n return hasCommandModifier(e) ? 'code' : null;\n case 75:\n // K\n return !isWindows && isCtrlKeyCommand(e) ? 'secondary-cut' : null;\n case 77:\n // M\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 79:\n // O\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 84:\n // T\n return isOSX && isCtrlKeyCommand(e) ? 'transpose-characters' : null;\n case 85:\n // U\n return hasCommandModifier(e) ? 'underline' : null;\n case 87:\n // W\n return isOSX && isCtrlKeyCommand(e) ? 'backspace-word' : null;\n case 89:\n // Y\n if (isCtrlKeyCommand(e)) {\n return isWindows ? 'redo' : 'secondary-paste';\n }\n return null;\n case 90:\n // Z\n return getZCommand(e) || null;\n case Keys.RETURN:\n return 'split-block';\n case Keys.DELETE:\n return getDeleteCommand(e);\n case Keys.BACKSPACE:\n return getBackspaceCommand(e);\n // LEFT/RIGHT handlers serve as a workaround for a Firefox bug.\n case Keys.LEFT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-start-of-block' : null;\n case Keys.RIGHT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-end-of-block' : null;\n default:\n return null;\n }\n}", "function getDefaultKeyBinding(e) {\n switch (e.keyCode) {\n case 66:\n // B\n return hasCommandModifier(e) ? 'bold' : null;\n case 68:\n // D\n return isCtrlKeyCommand(e) ? 'delete' : null;\n case 72:\n // H\n return isCtrlKeyCommand(e) ? 'backspace' : null;\n case 73:\n // I\n return hasCommandModifier(e) ? 'italic' : null;\n case 74:\n // J\n return hasCommandModifier(e) ? 'code' : null;\n case 75:\n // K\n return !isWindows && isCtrlKeyCommand(e) ? 'secondary-cut' : null;\n case 77:\n // M\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 79:\n // O\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 84:\n // T\n return isOSX && isCtrlKeyCommand(e) ? 'transpose-characters' : null;\n case 85:\n // U\n return hasCommandModifier(e) ? 'underline' : null;\n case 87:\n // W\n return isOSX && isCtrlKeyCommand(e) ? 'backspace-word' : null;\n case 89:\n // Y\n if (isCtrlKeyCommand(e)) {\n return isWindows ? 'redo' : 'secondary-paste';\n }\n return null;\n case 90:\n // Z\n return getZCommand(e) || null;\n case Keys.RETURN:\n return 'split-block';\n case Keys.DELETE:\n return getDeleteCommand(e);\n case Keys.BACKSPACE:\n return getBackspaceCommand(e);\n // LEFT/RIGHT handlers serve as a workaround for a Firefox bug.\n case Keys.LEFT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-start-of-block' : null;\n case Keys.RIGHT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-end-of-block' : null;\n default:\n return null;\n }\n}", "function getDefaultKeyBinding(e) {\n switch (e.keyCode) {\n case 66:\n // B\n return hasCommandModifier(e) ? 'bold' : null;\n case 68:\n // D\n return isCtrlKeyCommand(e) ? 'delete' : null;\n case 72:\n // H\n return isCtrlKeyCommand(e) ? 'backspace' : null;\n case 73:\n // I\n return hasCommandModifier(e) ? 'italic' : null;\n case 74:\n // J\n return hasCommandModifier(e) ? 'code' : null;\n case 75:\n // K\n return !isWindows && isCtrlKeyCommand(e) ? 'secondary-cut' : null;\n case 77:\n // M\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 79:\n // O\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 84:\n // T\n return isOSX && isCtrlKeyCommand(e) ? 'transpose-characters' : null;\n case 85:\n // U\n return hasCommandModifier(e) ? 'underline' : null;\n case 87:\n // W\n return isOSX && isCtrlKeyCommand(e) ? 'backspace-word' : null;\n case 89:\n // Y\n if (isCtrlKeyCommand(e)) {\n return isWindows ? 'redo' : 'secondary-paste';\n }\n return null;\n case 90:\n // Z\n return getZCommand(e) || null;\n case Keys.RETURN:\n return 'split-block';\n case Keys.DELETE:\n return getDeleteCommand(e);\n case Keys.BACKSPACE:\n return getBackspaceCommand(e);\n // LEFT/RIGHT handlers serve as a workaround for a Firefox bug.\n case Keys.LEFT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-start-of-block' : null;\n case Keys.RIGHT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-end-of-block' : null;\n default:\n return null;\n }\n}", "function getDefaultKeyBinding(e) {\n switch (e.keyCode) {\n case 66:\n // B\n return hasCommandModifier(e) ? 'bold' : null;\n case 68:\n // D\n return isCtrlKeyCommand(e) ? 'delete' : null;\n case 72:\n // H\n return isCtrlKeyCommand(e) ? 'backspace' : null;\n case 73:\n // I\n return hasCommandModifier(e) ? 'italic' : null;\n case 74:\n // J\n return hasCommandModifier(e) ? 'code' : null;\n case 75:\n // K\n return !isWindows && isCtrlKeyCommand(e) ? 'secondary-cut' : null;\n case 77:\n // M\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 79:\n // O\n return isCtrlKeyCommand(e) ? 'split-block' : null;\n case 84:\n // T\n return isOSX && isCtrlKeyCommand(e) ? 'transpose-characters' : null;\n case 85:\n // U\n return hasCommandModifier(e) ? 'underline' : null;\n case 87:\n // W\n return isOSX && isCtrlKeyCommand(e) ? 'backspace-word' : null;\n case 89:\n // Y\n if (isCtrlKeyCommand(e)) {\n return isWindows ? 'redo' : 'secondary-paste';\n }\n return null;\n case 90:\n // Z\n return getZCommand(e) || null;\n case Keys.RETURN:\n return 'split-block';\n case Keys.DELETE:\n return getDeleteCommand(e);\n case Keys.BACKSPACE:\n return getBackspaceCommand(e);\n // LEFT/RIGHT handlers serve as a workaround for a Firefox bug.\n case Keys.LEFT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-start-of-block' : null;\n case Keys.RIGHT:\n return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-end-of-block' : null;\n default:\n return null;\n }\n}", "function fixShortcut(e){return e=isMac?e.replace(\"Ctrl\",\"Cmd\"):e.replace(\"Cmd\",\"Ctrl\")}", "function swapKeySet(newKeys) {\n activeKeySet = newKeys;\n clearKeySpace();\n drawKeys(activeKeySet);\n }", "function prepBindings(bindings) {\n\t\t\tvar scope = {}; // Objects of functions\n\t\t\tvar attr = {}; // Object\n\n\t\t\t// Run through each binding and create the needed attr and scope\n\t\t\tangular.forEach(bindings, function(val, key) {\n\t\t\t\tattr[kebabCase(key)] = typeof val === 'function' ? key + '({ res: res });' : key\n\t\t\t\tscope[key] = val;\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tscope: scope,\n\t\t\t\tattr: attr\n\t\t\t}\n\t\t}", "function updateStylingMap(context, classesInput, stylesInput, directiveRef) {\n stylesInput = stylesInput || null;\n var directiveIndex = getDirectiveIndexFromRegistry(context, directiveRef || null);\n var element = context[5 /* ElementPosition */];\n var classesPlayerBuilder = classesInput instanceof BoundPlayerFactory ?\n new ClassAndStylePlayerBuilder(classesInput, element, 1 /* Class */) :\n null;\n var stylesPlayerBuilder = stylesInput instanceof BoundPlayerFactory ?\n new ClassAndStylePlayerBuilder(stylesInput, element, 2 /* Style */) :\n null;\n var classesValue = classesPlayerBuilder ?\n classesInput.value :\n classesInput;\n var stylesValue = stylesPlayerBuilder ? stylesInput.value : stylesInput;\n // early exit (this is what's done to avoid using ctx.bind() to cache the value)\n var ignoreAllClassUpdates = limitToSingleClasses(context) || classesValue === NO_CHANGE ||\n classesValue === context[6 /* CachedClassValueOrInitialClassString */];\n var ignoreAllStyleUpdates = stylesValue === NO_CHANGE || stylesValue === context[7 /* CachedStyleValue */];\n if (ignoreAllClassUpdates && ignoreAllStyleUpdates)\n return;\n context[6 /* CachedClassValueOrInitialClassString */] = classesValue;\n context[7 /* CachedStyleValue */] = stylesValue;\n var classNames = EMPTY_ARRAY;\n var applyAllClasses = false;\n var playerBuildersAreDirty = false;\n var classesPlayerBuilderIndex = classesPlayerBuilder ? 1 /* ClassMapPlayerBuilderPosition */ : 0;\n if (hasPlayerBuilderChanged(context, classesPlayerBuilder, 1 /* ClassMapPlayerBuilderPosition */)) {\n setPlayerBuilder(context, classesPlayerBuilder, 1 /* ClassMapPlayerBuilderPosition */);\n playerBuildersAreDirty = true;\n }\n var stylesPlayerBuilderIndex = stylesPlayerBuilder ? 3 /* StyleMapPlayerBuilderPosition */ : 0;\n if (hasPlayerBuilderChanged(context, stylesPlayerBuilder, 3 /* StyleMapPlayerBuilderPosition */)) {\n setPlayerBuilder(context, stylesPlayerBuilder, 3 /* StyleMapPlayerBuilderPosition */);\n playerBuildersAreDirty = true;\n }\n // each time a string-based value pops up then it shouldn't require a deep\n // check of what's changed.\n if (!ignoreAllClassUpdates) {\n if (typeof classesValue == 'string') {\n classNames = classesValue.split(/\\s+/);\n // this boolean is used to avoid having to create a key/value map of `true` values\n // since a classname string implies that all those classes are added\n applyAllClasses = true;\n }\n else {\n classNames = classesValue ? Object.keys(classesValue) : EMPTY_ARRAY;\n }\n }\n var classes = (classesValue || EMPTY_OBJ);\n var styleProps = stylesValue ? Object.keys(stylesValue) : EMPTY_ARRAY;\n var styles = stylesValue || EMPTY_OBJ;\n var classesStartIndex = styleProps.length;\n var multiStartIndex = getMultiStartIndex(context);\n var dirty = false;\n var ctxIndex = multiStartIndex;\n var propIndex = 0;\n var propLimit = styleProps.length + classNames.length;\n // the main loop here will try and figure out how the shape of the provided\n // styles differ with respect to the context. Later if the context/styles/classes\n // are off-balance then they will be dealt in another loop after this one\n while (ctxIndex < context.length && propIndex < propLimit) {\n var isClassBased = propIndex >= classesStartIndex;\n var processValue = (!isClassBased && !ignoreAllStyleUpdates) || (isClassBased && !ignoreAllClassUpdates);\n // when there is a cache-hit for a string-based class then we should\n // avoid doing any work diffing any of the changes\n if (processValue) {\n var adjustedPropIndex = isClassBased ? propIndex - classesStartIndex : propIndex;\n var newProp = isClassBased ? classNames[adjustedPropIndex] : styleProps[adjustedPropIndex];\n var newValue = isClassBased ? (applyAllClasses ? true : classes[newProp]) : styles[newProp];\n var playerBuilderIndex = isClassBased ? classesPlayerBuilderIndex : stylesPlayerBuilderIndex;\n var prop = getProp(context, ctxIndex);\n if (prop === newProp) {\n var value = getValue(context, ctxIndex);\n var flag = getPointers(context, ctxIndex);\n setPlayerBuilderIndex(context, ctxIndex, playerBuilderIndex, directiveIndex);\n if (hasValueChanged(flag, value, newValue)) {\n setValue(context, ctxIndex, newValue);\n playerBuildersAreDirty = playerBuildersAreDirty || !!playerBuilderIndex;\n var initialValue = getInitialValue(context, flag);\n // SKIP IF INITIAL CHECK\n // If the former `value` is `null` then it means that an initial value\n // could be being rendered on screen. If that is the case then there is\n // no point in updating the value incase it matches. In other words if the\n // new value is the exact same as the previously rendered value (which\n // happens to be the initial value) then do nothing.\n if (value != null || hasValueChanged(flag, initialValue, newValue)) {\n setDirty(context, ctxIndex, true);\n dirty = true;\n }\n }\n }\n else {\n var indexOfEntry = findEntryPositionByProp(context, newProp, ctxIndex);\n if (indexOfEntry > 0) {\n // it was found at a later point ... just swap the values\n var valueToCompare = getValue(context, indexOfEntry);\n var flagToCompare = getPointers(context, indexOfEntry);\n swapMultiContextEntries(context, ctxIndex, indexOfEntry);\n if (hasValueChanged(flagToCompare, valueToCompare, newValue)) {\n var initialValue = getInitialValue(context, flagToCompare);\n setValue(context, ctxIndex, newValue);\n // same if statement logic as above (look for SKIP IF INITIAL CHECK).\n if (valueToCompare != null || hasValueChanged(flagToCompare, initialValue, newValue)) {\n setDirty(context, ctxIndex, true);\n playerBuildersAreDirty = playerBuildersAreDirty || !!playerBuilderIndex;\n dirty = true;\n }\n }\n }\n else {\n // we only care to do this if the insertion is in the middle\n var newFlag = prepareInitialFlag(context, newProp, isClassBased, getStyleSanitizer(context, directiveIndex));\n playerBuildersAreDirty = playerBuildersAreDirty || !!playerBuilderIndex;\n insertNewMultiProperty(context, ctxIndex, isClassBased, newProp, newFlag, newValue, directiveIndex, playerBuilderIndex);\n dirty = true;\n }\n }\n }\n ctxIndex += 4 /* Size */;\n propIndex++;\n }\n // this means that there are left-over values in the context that\n // were not included in the provided styles/classes and in this\n // case the goal is to \"remove\" them from the context (by nullifying)\n while (ctxIndex < context.length) {\n var flag = getPointers(context, ctxIndex);\n var isClassBased = (flag & 2 /* Class */) === 2 /* Class */;\n var processValue = (!isClassBased && !ignoreAllStyleUpdates) || (isClassBased && !ignoreAllClassUpdates);\n if (processValue) {\n var value = getValue(context, ctxIndex);\n var doRemoveValue = valueExists(value, isClassBased);\n if (doRemoveValue) {\n setDirty(context, ctxIndex, true);\n setValue(context, ctxIndex, null);\n // we keep the player factory the same so that the `nulled` value can\n // be instructed into the player because removing a style and/or a class\n // is a valid animation player instruction.\n var playerBuilderIndex = isClassBased ? classesPlayerBuilderIndex : stylesPlayerBuilderIndex;\n setPlayerBuilderIndex(context, ctxIndex, playerBuilderIndex, directiveIndex);\n dirty = true;\n }\n }\n ctxIndex += 4 /* Size */;\n }\n // this means that there are left-over properties in the context that\n // were not detected in the context during the loop above. In that\n // case we want to add the new entries into the list\n var sanitizer = getStyleSanitizer(context, directiveIndex);\n while (propIndex < propLimit) {\n var isClassBased = propIndex >= classesStartIndex;\n var processValue = (!isClassBased && !ignoreAllStyleUpdates) || (isClassBased && !ignoreAllClassUpdates);\n if (processValue) {\n var adjustedPropIndex = isClassBased ? propIndex - classesStartIndex : propIndex;\n var prop = isClassBased ? classNames[adjustedPropIndex] : styleProps[adjustedPropIndex];\n var value = isClassBased ? (applyAllClasses ? true : classes[prop]) : styles[prop];\n var flag = prepareInitialFlag(context, prop, isClassBased, sanitizer) | 1 /* Dirty */;\n var playerBuilderIndex = isClassBased ? classesPlayerBuilderIndex : stylesPlayerBuilderIndex;\n var ctxIndex_1 = context.length;\n context.push(flag, prop, value, 0);\n setPlayerBuilderIndex(context, ctxIndex_1, playerBuilderIndex, directiveIndex);\n dirty = true;\n }\n propIndex++;\n }\n if (dirty) {\n setContextDirty(context, true);\n setDirectiveDirty(context, directiveIndex, true);\n }\n if (playerBuildersAreDirty) {\n setContextPlayersDirty(context, true);\n }\n}", "function updateStylingMap(context, classesInput, stylesInput, directiveRef) {\n stylesInput = stylesInput || null;\n var directiveIndex = getDirectiveIndexFromRegistry(context, directiveRef || null);\n var element = context[5 /* ElementPosition */];\n var classesPlayerBuilder = classesInput instanceof BoundPlayerFactory ?\n new ClassAndStylePlayerBuilder(classesInput, element, 1 /* Class */) :\n null;\n var stylesPlayerBuilder = stylesInput instanceof BoundPlayerFactory ?\n new ClassAndStylePlayerBuilder(stylesInput, element, 2 /* Style */) :\n null;\n var classesValue = classesPlayerBuilder ?\n classesInput.value :\n classesInput;\n var stylesValue = stylesPlayerBuilder ? stylesInput.value : stylesInput;\n // early exit (this is what's done to avoid using ctx.bind() to cache the value)\n var ignoreAllClassUpdates = limitToSingleClasses(context) || classesValue === NO_CHANGE ||\n classesValue === context[6 /* CachedClassValueOrInitialClassString */];\n var ignoreAllStyleUpdates = stylesValue === NO_CHANGE || stylesValue === context[7 /* CachedStyleValue */];\n if (ignoreAllClassUpdates && ignoreAllStyleUpdates)\n return;\n context[6 /* CachedClassValueOrInitialClassString */] = classesValue;\n context[7 /* CachedStyleValue */] = stylesValue;\n var classNames = EMPTY_ARRAY;\n var applyAllClasses = false;\n var playerBuildersAreDirty = false;\n var classesPlayerBuilderIndex = classesPlayerBuilder ? 1 /* ClassMapPlayerBuilderPosition */ : 0;\n if (hasPlayerBuilderChanged(context, classesPlayerBuilder, 1 /* ClassMapPlayerBuilderPosition */)) {\n setPlayerBuilder(context, classesPlayerBuilder, 1 /* ClassMapPlayerBuilderPosition */);\n playerBuildersAreDirty = true;\n }\n var stylesPlayerBuilderIndex = stylesPlayerBuilder ? 3 /* StyleMapPlayerBuilderPosition */ : 0;\n if (hasPlayerBuilderChanged(context, stylesPlayerBuilder, 3 /* StyleMapPlayerBuilderPosition */)) {\n setPlayerBuilder(context, stylesPlayerBuilder, 3 /* StyleMapPlayerBuilderPosition */);\n playerBuildersAreDirty = true;\n }\n // each time a string-based value pops up then it shouldn't require a deep\n // check of what's changed.\n if (!ignoreAllClassUpdates) {\n if (typeof classesValue == 'string') {\n classNames = classesValue.split(/\\s+/);\n // this boolean is used to avoid having to create a key/value map of `true` values\n // since a classname string implies that all those classes are added\n applyAllClasses = true;\n }\n else {\n classNames = classesValue ? Object.keys(classesValue) : EMPTY_ARRAY;\n }\n }\n var classes = (classesValue || EMPTY_OBJ);\n var styleProps = stylesValue ? Object.keys(stylesValue) : EMPTY_ARRAY;\n var styles = stylesValue || EMPTY_OBJ;\n var classesStartIndex = styleProps.length;\n var multiStartIndex = getMultiStartIndex(context);\n var dirty = false;\n var ctxIndex = multiStartIndex;\n var propIndex = 0;\n var propLimit = styleProps.length + classNames.length;\n // the main loop here will try and figure out how the shape of the provided\n // styles differ with respect to the context. Later if the context/styles/classes\n // are off-balance then they will be dealt in another loop after this one\n while (ctxIndex < context.length && propIndex < propLimit) {\n var isClassBased = propIndex >= classesStartIndex;\n var processValue = (!isClassBased && !ignoreAllStyleUpdates) || (isClassBased && !ignoreAllClassUpdates);\n // when there is a cache-hit for a string-based class then we should\n // avoid doing any work diffing any of the changes\n if (processValue) {\n var adjustedPropIndex = isClassBased ? propIndex - classesStartIndex : propIndex;\n var newProp = isClassBased ? classNames[adjustedPropIndex] : styleProps[adjustedPropIndex];\n var newValue = isClassBased ? (applyAllClasses ? true : classes[newProp]) : styles[newProp];\n var playerBuilderIndex = isClassBased ? classesPlayerBuilderIndex : stylesPlayerBuilderIndex;\n var prop = getProp(context, ctxIndex);\n if (prop === newProp) {\n var value = getValue(context, ctxIndex);\n var flag = getPointers(context, ctxIndex);\n setPlayerBuilderIndex(context, ctxIndex, playerBuilderIndex, directiveIndex);\n if (hasValueChanged(flag, value, newValue)) {\n setValue(context, ctxIndex, newValue);\n playerBuildersAreDirty = playerBuildersAreDirty || !!playerBuilderIndex;\n var initialValue = getInitialValue(context, flag);\n // SKIP IF INITIAL CHECK\n // If the former `value` is `null` then it means that an initial value\n // could be being rendered on screen. If that is the case then there is\n // no point in updating the value incase it matches. In other words if the\n // new value is the exact same as the previously rendered value (which\n // happens to be the initial value) then do nothing.\n if (value != null || hasValueChanged(flag, initialValue, newValue)) {\n setDirty(context, ctxIndex, true);\n dirty = true;\n }\n }\n }\n else {\n var indexOfEntry = findEntryPositionByProp(context, newProp, ctxIndex);\n if (indexOfEntry > 0) {\n // it was found at a later point ... just swap the values\n var valueToCompare = getValue(context, indexOfEntry);\n var flagToCompare = getPointers(context, indexOfEntry);\n swapMultiContextEntries(context, ctxIndex, indexOfEntry);\n if (hasValueChanged(flagToCompare, valueToCompare, newValue)) {\n var initialValue = getInitialValue(context, flagToCompare);\n setValue(context, ctxIndex, newValue);\n // same if statement logic as above (look for SKIP IF INITIAL CHECK).\n if (valueToCompare != null || hasValueChanged(flagToCompare, initialValue, newValue)) {\n setDirty(context, ctxIndex, true);\n playerBuildersAreDirty = playerBuildersAreDirty || !!playerBuilderIndex;\n dirty = true;\n }\n }\n }\n else {\n // we only care to do this if the insertion is in the middle\n var newFlag = prepareInitialFlag(context, newProp, isClassBased, getStyleSanitizer(context, directiveIndex));\n playerBuildersAreDirty = playerBuildersAreDirty || !!playerBuilderIndex;\n insertNewMultiProperty(context, ctxIndex, isClassBased, newProp, newFlag, newValue, directiveIndex, playerBuilderIndex);\n dirty = true;\n }\n }\n }\n ctxIndex += 4 /* Size */;\n propIndex++;\n }\n // this means that there are left-over values in the context that\n // were not included in the provided styles/classes and in this\n // case the goal is to \"remove\" them from the context (by nullifying)\n while (ctxIndex < context.length) {\n var flag = getPointers(context, ctxIndex);\n var isClassBased = (flag & 2 /* Class */) === 2 /* Class */;\n var processValue = (!isClassBased && !ignoreAllStyleUpdates) || (isClassBased && !ignoreAllClassUpdates);\n if (processValue) {\n var value = getValue(context, ctxIndex);\n var doRemoveValue = valueExists(value, isClassBased);\n if (doRemoveValue) {\n setDirty(context, ctxIndex, true);\n setValue(context, ctxIndex, null);\n // we keep the player factory the same so that the `nulled` value can\n // be instructed into the player because removing a style and/or a class\n // is a valid animation player instruction.\n var playerBuilderIndex = isClassBased ? classesPlayerBuilderIndex : stylesPlayerBuilderIndex;\n setPlayerBuilderIndex(context, ctxIndex, playerBuilderIndex, directiveIndex);\n dirty = true;\n }\n }\n ctxIndex += 4 /* Size */;\n }\n // this means that there are left-over properties in the context that\n // were not detected in the context during the loop above. In that\n // case we want to add the new entries into the list\n var sanitizer = getStyleSanitizer(context, directiveIndex);\n while (propIndex < propLimit) {\n var isClassBased = propIndex >= classesStartIndex;\n var processValue = (!isClassBased && !ignoreAllStyleUpdates) || (isClassBased && !ignoreAllClassUpdates);\n if (processValue) {\n var adjustedPropIndex = isClassBased ? propIndex - classesStartIndex : propIndex;\n var prop = isClassBased ? classNames[adjustedPropIndex] : styleProps[adjustedPropIndex];\n var value = isClassBased ? (applyAllClasses ? true : classes[prop]) : styles[prop];\n var flag = prepareInitialFlag(context, prop, isClassBased, sanitizer) | 1 /* Dirty */;\n var playerBuilderIndex = isClassBased ? classesPlayerBuilderIndex : stylesPlayerBuilderIndex;\n var ctxIndex_1 = context.length;\n context.push(flag, prop, value, 0);\n setPlayerBuilderIndex(context, ctxIndex_1, playerBuilderIndex, directiveIndex);\n dirty = true;\n }\n propIndex++;\n }\n if (dirty) {\n setContextDirty(context, true);\n setDirectiveDirty(context, directiveIndex, true);\n }\n if (playerBuildersAreDirty) {\n setContextPlayersDirty(context, true);\n }\n}", "function bindKey(event) {\n\t\t//index of keybind that contains the selected key (for conflicts)\n\t\tlet i = CS.keyBinds.findIndex(item => item[1] === event.keyCode || item[2] === event.key)\n\t\t//index of keybind that contains the selected function\n\t\tlet j = CS.keyBinds.findIndex(item => item[0] === ctrl.key2bind.action)\n\n\t\t//key is unchanged, do nothing\n\t\tif(i > -1 && i === j) {\n\t\t\tCS.popup = false;\n\t\t\tCS.keyBinding = false;\n\t\t}\n\t\t//key is in conflict\n\t\telse if(i > -1) {\n\t\t\tlet msg = 'Konflikt, stiskněte jinou klávesu.';\n\t\t\t(CS.popup.lines.slice(-1)[0] !== msg) && CS.popup.lines.push(msg);\n\t\t}\n\t\t//set the new key\n\t\telse {\n\t\t\tCS.keyBinds[j][1] = event.keyCode;\n\t\t\tCS.keyBinds[j][2] = event.key;\n\t\t\tCS.popup = false;\n\t\t\tCS.keyBinding = false;\n\t\t\tpopup('OK', true, 600);\n\t\t}\n\t}", "function normalizeKey$1(key) {\n\t switch (typeof key) {\n\t case 'undefined':\n\t return null;\n\t case 'number':\n\t if (key === Infinity || key === -Infinity || isNaN(key)) {\n\t return null;\n\t }\n\t return key;\n\t case 'object':\n\t var origKey = key;\n\t if (Array.isArray(key)) {\n\t var len = key.length;\n\t key = new Array(len);\n\t for (var i = 0; i < len; i++) {\n\t key[i] = normalizeKey$1(origKey[i]);\n\t }\n\t /* istanbul ignore next */\n\t } else if (key instanceof Date) {\n\t return key.toJSON();\n\t } else if (key !== null) { // generic object\n\t key = {};\n\t for (var k in origKey) {\n\t if (origKey.hasOwnProperty(k)) {\n\t var val = origKey[k];\n\t if (typeof val !== 'undefined') {\n\t key[k] = normalizeKey$1(val);\n\t }\n\t }\n\t }\n\t }\n\t }\n\t return key;\n\t}", "resetMap() {\n if (custom_maps[this.id]) {\n delete custom_maps[this.id];\n\n const map = getMap(this.pad);\n this.map = map;\n this.mapping = map.mapping;\n\n this._compileMapping();\n }\n }", "use (key, fnConvert) {\n this.spaces[key] = fnConvert\n return this\n }", "defineMovementKeys() {\n const props = this.props;\n let keyUp = props.keyUp,\n keyDown = props.keyDown,\n keyEnter = props.keyEnter,\n keyLeave = props.keyLeave,\n getObjectArray;\n getObjectArray = (keys) => {\n return keys.map(key => {\n let splitted;\n if (typeof key===\"number\") {\n return {\n key\n };\n }\n if (key.itsa_contains(\"+\")) {\n // special key present\n splitted = key.split(\"+\");\n return {\n key: parseInt(splitted.pop(), 10),\n special: splitted.map(item => SPECIAL_KEYS[item])\n };\n }\n return {\n key: parseInt(key, 10)\n };\n });\n };\n // first handle keyUp:\n Array.isArray(keyUp) || (keyUp=[keyUp]);\n this._keysUp = getObjectArray(keyUp);\n // next keyDown:\n Array.isArray(keyDown) || (keyDown=[keyDown]);\n this._keysDown = getObjectArray(keyDown);\n // next keyEnter:\n Array.isArray(keyEnter) || (keyEnter=keyEnter ? [keyEnter] : []);\n this._keysEnter = getObjectArray(keyEnter);\n // next keyLeave:\n Array.isArray(keyLeave) || (keyLeave=[keyLeave]);\n this._keysLeave = getObjectArray(keyLeave);\n }", "function preprocessNode(node){\n \n if (!validateBindingNode(node)){\n return;\n }\n \n var bindingAttributes = getBindingAttributesArray(node);\n \n if (bindingAttributes.length === 0) {\n return;\n }\n \n var dataBindAttribute = node.getAttribute(regularBindingAttributeName);\n var existingBindings = convertBindingsStringToObject(dataBindAttribute);\n\n for (var i = 0; i < bindingAttributes.length; i++) {\n appendBindingsFromAttribute(existingBindings, bindingAttributes[i]); \n } \n \n node.setAttribute(regularBindingAttributeName, objectLiteralToString(existingBindings)); \n }" ]
[ "0.68504876", "0.6619002", "0.6602381", "0.6602381", "0.6601707", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.58333474", "0.5548513", "0.5541882", "0.554113", "0.5285621", "0.5267215", "0.52207655", "0.5215055", "0.5207126", "0.5207126", "0.5207126", "0.5207126", "0.5207126", "0.5174154", "0.5043347", "0.48985267", "0.4873353", "0.48705336", "0.48553523", "0.4816595", "0.48048905", "0.48048905", "0.48048905", "0.48048905", "0.47904432", "0.47719538", "0.47451517", "0.47429594", "0.47294247", "0.47183585", "0.4715589", "0.4713028", "0.47020888", "0.46961007", "0.46792537", "0.4659732", "0.4659732", "0.46506667", "0.46430063", "0.46260813", "0.46234033", "0.45989314", "0.4594824", "0.45941842", "0.4590855", "0.45891818", "0.4588501", "0.45873004", "0.45830584", "0.45830584", "0.45830584", "0.45830584", "0.45830584", "0.45830584", "0.45830584", "0.45830584", "0.45830584", "0.45792988", "0.45766246", "0.45724836", "0.4566965", "0.4566965", "0.45494688", "0.4537026", "0.45220584", "0.4519006", "0.45153013", "0.45043382" ]
0.66288286
17
Modifier key presses don't count as 'real' key presses for the purpose of keymap fallthrough.
function isModifierKey(value) { var name = typeof value == "string" ? value : keyNames[value.keyCode]; return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function usualKeys(e) {\n\t\t\tview.put(String.fromCharCode(e.which));\n\t\t\treturn false;\n\t\t}", "function bufferModifier(e) { return e.shiftKey*1 + e.ctrlKey*2 + e.altKey*4 }", "function keyName(event, noShift) {\n\t\t if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n\t\t var name = keyNames[event.keyCode];\n\t\t if (name == null || event.altGraphKey) { return false }\n\t\t // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n\t\t // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n\t\t if (event.keyCode == 3 && event.code) { name = event.code; }\n\t\t return addModifierNames(name, event, noShift)\n\t\t }", "function ak(a,b){return function(e,k){var action=e.shiftKey||e.ctrlKey||e.altKey||e.metaKey||!self.keyboard.applicationKeypad?a:b;return resolve(action,e,k);};}// If mod or not application cursor a, else b. The keys that care about", "function keyName(event, noShift) {\r\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\r\n var name = keyNames[event.keyCode];\r\n if (name == null || event.altGraphKey) { return false }\r\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\r\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\r\n if (event.keyCode == 3 && event.code) { name = event.code; }\r\n return addModifierNames(name, event, noShift)\r\n}", "function clearModifier(event){\r\n var key = event.keyCode, k,\r\n i = index(_downKeys, key);\r\n \r\n // remove key from _downKeys\r\n if (i >= 0) {\r\n _downKeys.splice(i, 1);\r\n }\r\n \r\n if(key == 93 || key == 224) key = 91;\r\n if(key in _mods) {\r\n _mods[key] = false;\r\n for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;\r\n }\r\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }", "_modifiers(e) {\n const [_x, _y] = ELEM.getScrollPosition(0);\n const [x, y] = [Event.pointerX(e), Event.pointerY(e)];\n if (!isNaN(x) || isNaN(y)) {\n this.status.setCrsr(x, y);\n }\n this.status.setAltKey(e.altKey);\n this.status.setCtrlKey(e.ctrlKey);\n this.status.setShiftKey(e.shiftKey);\n this.status.setMetaKey(e.metaKey);\n }", "_modifiers(e) {\n const [_x, _y] = ELEM.getScrollPosition(0);\n const [x, y] = [Event.pointerX(e), Event.pointerY(e)];\n if (!isNaN(x) || isNaN(y)) {\n this.status.setCrsr(x, y);\n }\n this.status.setAltKey(e.altKey);\n this.status.setCtrlKey(e.ctrlKey);\n this.status.setShiftKey(e.shiftKey);\n this.status.setMetaKey(e.metaKey);\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n}", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n}", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n}", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n}", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n}", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n}", "function isModifierKey(value) {\n\t\t var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n\t\t return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n\t\t }", "handleShiftRightKey() {\n this.extendForward();\n this.checkForCursorVisibility();\n }", "function clearModifier(event){\n var key = event.keyCode, k,\n i = index(_downKeys, key);\n\n // remove key from _downKeys\n if (i >= 0) {\n _downKeys.splice(i, 1);\n }\n\n if(key == 93 || key == 224) key = 91;\n if(key in _mods) {\n _mods[key] = false;\n for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;\n }\n }", "function clearModifier(event){\n\t var key = event.keyCode, k,\n\t i = index(_downKeys, key);\n\t\n\t // remove key from _downKeys\n\t if (i >= 0) {\n\t _downKeys.splice(i, 1);\n\t }\n\t\n\t if(key == 93 || key == 224) key = 91;\n\t if(key in _mods) {\n\t _mods[key] = false;\n\t for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;\n\t }\n\t }", "function clearModifier(event){\n\t var key = event.keyCode, k,\n\t i = index(_downKeys, key);\n\t\n\t // remove key from _downKeys\n\t if (i >= 0) {\n\t _downKeys.splice(i, 1);\n\t }\n\t\n\t if(key == 93 || key == 224) key = 91;\n\t if(key in _mods) {\n\t _mods[key] = false;\n\t for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;\n\t }\n\t }", "function modifKey(e) \n{\n var modif=''; \n if (event.altKey) \n {\n modif+='[ Alt ] ';\n } \n if (event.ctrlKey) \n {\n modif+='[ Ctrl ] ';\n } \n if (event.shiftKey) \n {\n modif+='[ Shift ] ';\n } \n getKey(e,modif); \n}", "function clearModifier(event){\n var key = event.keyCode, k,\n i = index(_downKeys, key);\n\n // remove key from _downKeys\n if (i >= 0) {\n _downKeys.splice(i, 1);\n }\n\n if(key == 93 || key == 224) key = 91;\n if(key in _mods) {\n _mods[key] = false;\n for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;\n }\n }", "function clearModifier(event){\n var key = event.keyCode, k,\n i = index(_downKeys, key);\n\n // remove key from _downKeys\n if (i >= 0) {\n _downKeys.splice(i, 1);\n }\n\n if(key == 93 || key == 224) key = 91;\n if(key in _mods) {\n _mods[key] = false;\n for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;\n }\n }", "function clearModifier(event){\n var key = event.keyCode, k,\n i = index(_downKeys, key);\n\n // remove key from _downKeys\n if (i >= 0) {\n _downKeys.splice(i, 1);\n }\n\n if(key == 93 || key == 224) key = 91;\n if(key in _mods) {\n _mods[key] = false;\n for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;\n }\n }", "function keyHandler(evt){\n keymap[evt.key] = (evt.type == 'keydown');\n}", "static _HandleKeyDown(e) {\n if (!Keyboard._keys_down.map(i => i.key).includes(e.key.toLowerCase()))\n Keyboard._keys_down.push({key: e.key.toLowerCase(), blocked: false})\n }", "handleControlShiftDownKey() {\n this.extendToParagraphEnd();\n this.checkForCursorVisibility();\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n return addModifierNames(name, event, noShift)\n}", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n return addModifierNames(name, event, noShift)\n}", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n return addModifierNames(name, event, noShift)\n}", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n return addModifierNames(name, event, noShift)\n}", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n return addModifierNames(name, event, noShift)\n}", "function clearModifier(event){\n var key = getKeyCode(event), k,\n i = index(_downKeys, key);\n\n // remove key from _downKeys\n if (i >= 0) {\n _downKeys.splice(i, 1);\n }\n\n if(key == 93 || key == 224) key = 91;\n if(key in _mods) {\n _mods[key] = false;\n for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;\n }\n }", "function hasModifierKeys(oEvent) {\n\t\treturn oEvent.shiftKey || oEvent.altKey || getCtrlKey(oEvent);\n\t}", "function key_down(event) {\n if (event.shiftKey) {\n shift_key_pressed = true;\n }\n}", "function isModifier(e) {\n\treturn e.ctrlKey || e.altKey || e.metaKey;\n}", "function keyPressDown(event){\n\n let key = (96 <= event.keyCode && event.keyCode <= 105)? event.keyCode - 48 : event.keyCode;\n if(key >= 16 && key <= 18){\n\n if(pressedModifiers.indexOf(key) === -1){\n\n pressedModifiers.push(key);\n }\n if(event.data && event.data.modifierFunc){\n\n event.data.modifierFunc(event);\n }\n\n } else {\n\n if(event.data && event.data.keyFunc){\n\n event.data.keyFunc(event);\n }\n }\n if(event.data && event.data.func){\n\n event.data.func(event);\n }\n for (var handler in waitingForInput) {\n if (waitingForInput.hasOwnProperty(handler)) {\n waitingForInput[handler](event);\n }\n }\n\n}", "function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\";\n }", "function isModifierKey(value) {\r\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\r\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\r\n}", "function handleKeyDown(event) {\n currentlyPressedKeys[event.keyCode] = true;\n }", "function hasModifier(e) {\n return (e.ctrlKey || e.metaKey || e.shiftKey);\n}", "handleControlShiftUpKey() {\n this.extendToParagraphStart();\n this.checkForCursorVisibility();\n }", "function isModifierKey(event) {\n var isCtrlKey = event.ctrlKey || event.key === CTRL_CHARCODE;\n var isAltKey = event.altKey || event.key === ALT_CHARCODE;\n var isMetaKey = event.metaKey || event.key === META_CHARCODE;\n return isCtrlKey || isAltKey || isMetaKey;\n}", "function controlDown(e)\r\n\t\t{\r\n\t\t\tif (e.keyCode in keyMap)\r\n\t\t\t{\r\n\t\t\t\tkeyMap[e.keyCode] = true;\r\n\t\t\t}\t\r\n\t\t}", "function onKeyDown(e) {\n // do not handle key events when not in input mode\n if (!imode) {\n return;\n }\n\n // only handle special keys here\n specialKey(e);\n }", "handleShiftDownKey() {\n this.extendToNextLine();\n this.checkForCursorVisibility();\n }", "function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n}", "function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n}", "function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n}", "function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n}", "function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n}", "function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n}", "function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n}", "function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n}", "function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n}", "function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n}", "function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n}", "function forbid_key(){ \n /*\n\t//禁止F5\n\tif(event.keyCode==116){\n event.keyCode=0;\n event.returnValue=false;\n }\n */\n \n if(event.shiftKey){\n event.returnValue=false;\n }\n //禁止shift\n \n if(event.altKey){\n event.returnValue=false;\n }\n //禁止alt\n \n if(event.ctrlKey){\n event.returnValue=false;\n }\n //禁止ctrl\n return true;\n}", "handleNonLetterKeys(e) {\n\n switch (e.keyCode) {\n case 37: //left arrow\n case 38: //up arrow\n case 39: //right arrow\n case 40: //down arrow\n break;\n case 16: //shift\n break;\n case 9: //tab\n break;\n }\n }", "_onKeyDown(event) {\n switch (event.keyCode) {\n case 87: // w\n case 38: // up\n this.keys.forward = true;\n break;\n case 65: // a\n case 37: //left\n this.keys.left = true;\n break;\n case 83: // s\n case 40: //down\n this.keys.backward = true;\n break;\n case 68: // d\n case 39: //right\n this.keys.right = true;\n break;\n case 32: // SPACE\n this.keys.space = true;\n break;\n case 16: // SHIFT\n this.keys.run = true;\n break;\n }\n }", "onKeyDown(e) {\n e = e || window.event;\n //console.log(e.shiftKey);\n }", "function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode]\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n}", "function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode]\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n}", "keyPressed({keyPressed, keyCode}){\n console.log('keypressed, keycode', keyPressed, keyCode);\n if(keyCode === 70){ //f\n requestFullScreen();\n return;\n }\n if(keyCode === 80){ //p\n requestPointerLock();\n return;\n }\n let key = keyCode + '';\n this.keysCurrentlyPressed[key] = {keyPressed, keyCode, clock:new Clock()};\n }", "function keyPress(e) {\n var charCode = getCharCode(e);\n if ( isLowerCaseAlphaKey(charCode) ) {\n capsLockOn = !!e.shiftKey;\n } else if ( isUpperCaseAlphaKey(charCode) ) {\n capsLockOn = !!!e.shiftKey;\n }\n return capsLockOn;\n }", "function TranslateKeys()\n{\n\ttry {\n\t\tvar vReadOnly;\n\t\tvar vDisabled;\n\t\tif (!event) \n\t\t\treturn;\n\t\tif (event.altKey == true)\n\t\t\treturn;\n\t\tif (event.ctrlKey == true)\n\t\t\treturn;\n\t\tif (event.shiftKey == true)\n\t\t\treturn;\n\t\ttry {\n\t\t\tvDisabled = event.srcElement.disabled;\n\t\t\tvReadOnly = event.srcElement.readOnly;\n\t\t}\n\t\tcatch (e) {\n\t\t\tvReadOnly = true;\n\t\t\tvDisabled = true;\n\t\t}\n\t\tif ((event.keyCode == 13) && (vDisabled == false))\n\t\t{\n\t\t\tevent.keyCode = 9; //return -> tab\n\t\t\tevent.cancelBubble = true; \n\t\t\tevent.returnValue = true;\n\t\t\treturn;\n\t\t} \n\t\tif ((event.keyCode == 8) && ((vDisabled == true) || (vReadOnly == true)))\n\t\t{\n\t\t\tevent.keyCode = 0; //backspace -> end\n\t\t\tevent.cancelBubble = true; \n\t\t\tevent.returnValue = true;\n\t\t\treturn;\n\t\t} \n\t} catch (e) {}\n return;\n}", "keyPressed(){\n if(keyCode === 66) {\n this.b = !this.b;\n }\n if(keyCode === 68) {\n this.d = !this.d;\n }\n if(keyCode === 71) {\n this.g = !this.g;\n }\n if(keyCode === 80) {\n this.p = !this.p;\n }\n if(keyCode === 83) {\n this.s = !this.s;\n }\n if(keyCode === 82) {\n this.r = !this.r;\n }\n\n }", "function onKeyDown(evt) {\r\n switch (evt.keyCode) {\r\n case 39: KEY_ARROW_RIGHT = true; break;\r\n case 37: KEY_ARROW_LEFT = true; break;\r\n case 38: KEY_ARROW_UP = true; break;\r\n case 40: KEY_ARROW_DOWN = true; break;\r\n case 16: KEY_SHIFT = true; break;\r\n }\r\n}" ]
[ "0.71549004", "0.69038826", "0.684083", "0.6807286", "0.6790032", "0.67511195", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6694306", "0.6694306", "0.66727346", "0.66727346", "0.66727346", "0.66727346", "0.66727346", "0.66727346", "0.6668529", "0.66548616", "0.6629228", "0.6624128", "0.6624128", "0.66120934", "0.65960336", "0.65960336", "0.65960336", "0.6595675", "0.6553443", "0.65461224", "0.6526167", "0.6526167", "0.6526167", "0.6526167", "0.6526167", "0.6524199", "0.64916044", "0.6487135", "0.64771134", "0.6463314", "0.64609945", "0.63994026", "0.639115", "0.6389692", "0.63888127", "0.63845295", "0.63823575", "0.6343771", "0.63347316", "0.632511", "0.632511", "0.632511", "0.632511", "0.632511", "0.632511", "0.632511", "0.632511", "0.632511", "0.632511", "0.632511", "0.63239604", "0.63220036", "0.6319492", "0.6319033", "0.63150096", "0.63150096", "0.6313601", "0.6304418", "0.63027835", "0.6297609", "0.6263486" ]
0.6497272
61
Look up the name of a key as indicated by an event object.
function keyName(event, noShift) { if (presto && event.keyCode == 34 && event["char"]) { return false } var name = keyNames[event.keyCode]; if (name == null || event.altGraphKey) { return false } // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause, // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+) if (event.keyCode == 3 && event.code) { name = event.code; } return addModifierNames(name, event, noShift) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEventName(event_id) {\n for(var i in event_reference) {\n var obj = event_reference[i];\n if(obj.id === event_id)\n return obj.name;\n }\n return undefined;\n}", "function grabKey(obj, key) {\n return obj[key];\n}", "function getKey(object, key) {\n return object[key];\n}", "function findMatch(e, keyName) {\n for (key in e) {\n if (key === keyName) {\n return e[key];\n }\n }\n }", "function getLookupKey(fhcEvent) {\n let key = fhcEvent.type + \"|\" + fhcEvent.name;\n\n if (\"input\" === fhcEvent.type) {\n // prepend with empty host, input values are universal and not bound to a host\n key = \"|\" + key + \"|\" + fhcEvent.value;\n } else {\n // bind multiline fields to a specific host\n // do not add the value but the lastUsed date, we want to store one or more versions per host\n key = fhcEvent.host + \"|\" + key + \"|\" + fhcEvent.last;\n }\n return key;\n}", "function getEventObj(name) {\n for (var i = 0; i < $scope.events.length; i++) {\n if ($scope.events[i].name == name)\n return $scope.events[i];\n }\n }", "function lookup(key) {\n key = key.toLowerCase();\n \n var item;\n for (var i = 0; i < dict.length; i++) {\n item = dict[i];\n if (item[0] === key) {\n return item[1];\n }\n }\n return null;\n }", "function searchKeyObject(nameKey, obj) {\r\n nameKey = nameKey.toLowerCase();\r\n const keys = Object.keys(obj);\r\n const wantedKey = keys.find(key => key.toLowerCase().includes(nameKey));\r\n return wantedKey ? obj[wantedKey] : false;\r\n}", "function find_item_name(obj, key) {\n if (obj.ItemAliases == undefined) return key;\n let k = 0;\n let name = \"\";\n let aliases = obj.ItemAliases.split(\";\");\n aliases.forEach( function(alias) {\n if (alias.length > k) {\n k = alias.length;\n name = alias;\n };\n });\n return name;\n}", "function getKey(keyFieldName, data) {\n\t\t\tvar key = data[keyFieldName];\n\t\t\treturn key;\n\t\t}", "function search(nameKey){\n for (var i=0; i < lookup.length; i++) {\n if (lookup[i].key === nameKey) {\n return lookup[i].value;\n }\n }\n}", "findKey(obj, fn) {\n for (let key in obj) {\n return fn(obj[key]) ? key : undefined;\n }\n }", "function findObjectFromKey(upperObject,key){\n //get appropriate object\n\n len = Object.keys(upperObject).length\n var sub = \"\";\n for (var i = 0; i < len; i++) {\n sub = Object.keys(upperObject)[i]\n if (upperObject[sub].hasOwnProperty(key)) {\n var foundObject = upperObject[sub];\n }\n }\n return foundObject;\n}", "function identifyKeyFromEvent(event) {\n var key = event.key;\n var keyIdentifier = event.keyIdentifier;\n var location = event.location;\n if (key === Keys.ArrowDown || key === \"Down\" || keyIdentifier === \"Down\") {\n return Keys.ArrowDown;\n } else if (key === Keys.ArrowLeft || key === \"Left\" || keyIdentifier === \"Left\") {\n return Keys.ArrowLeft;\n } else if (key === Keys.ArrowRight || key === \"Right\" || keyIdentifier === \"Right\") {\n return Keys.ArrowRight;\n } else if (key === Keys.ArrowUp || key === \"Up\" || keyIdentifier === \"Up\") {\n return Keys.ArrowUp;\n } else if (key === Keys.Escape || key === \"Esc\" || keyIdentifier === \"U+001B\") {\n return Keys.Escape;\n } else if (key === \"0\" || keyIdentifier === \"U+0030\") {\n return \"0\";\n } else if (key === \"+\" || key === \"Add\" || keyIdentifier === \"U+002B\" || keyIdentifier === \"U+00BB\" || keyIdentifier === \"U+004B\" && location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD /* workaround for Chrome for Windows */) {\n return \"+\";\n } else if (key === \"-\" || key === \"Subtract\" || keyIdentifier === \"U+002D\" || keyIdentifier === \"U+00BD\" || keyIdentifier === \"U+004D\" && location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD /* workaround for Chrome for Windows */) {\n return \"-\";\n } else {\n return key || keyIdentifier || Keys.Unidentified;\n }\n}", "function identifyKeyFromEvent(event) {\n var key = event.key;\n var keyIdentifier = event.keyIdentifier;\n var location = event.location;\n if (key === Keys.ArrowDown || key === \"Down\" || keyIdentifier === \"Down\") {\n return Keys.ArrowDown;\n } else if (key === Keys.ArrowLeft || key === \"Left\" || keyIdentifier === \"Left\") {\n return Keys.ArrowLeft;\n } else if (key === Keys.ArrowRight || key === \"Right\" || keyIdentifier === \"Right\") {\n return Keys.ArrowRight;\n } else if (key === Keys.ArrowUp || key === \"Up\" || keyIdentifier === \"Up\") {\n return Keys.ArrowUp;\n } else if (key === Keys.Escape || key === \"Esc\" || keyIdentifier === \"U+001B\") {\n return Keys.Escape;\n } else if (key === \"0\" || keyIdentifier === \"U+0030\") {\n return \"0\";\n } else if (key === \"+\" || key === \"Add\" || keyIdentifier === \"U+002B\" || keyIdentifier === \"U+00BB\" || keyIdentifier === \"U+004B\" && location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD /* workaround for Chrome for Windows */) {\n return \"+\";\n } else if (key === \"-\" || key === \"Subtract\" || keyIdentifier === \"U+002D\" || keyIdentifier === \"U+00BD\" || keyIdentifier === \"U+004D\" && location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD /* workaround for Chrome for Windows */) {\n return \"-\";\n } else {\n return key || keyIdentifier || Keys.Unidentified;\n }\n}", "function identifyKeyFromEvent(event) {\n var key = event.key;\n var keyIdentifier = event.keyIdentifier;\n var location = event.location;\n if (key === Keys.ArrowDown || key === \"Down\" || keyIdentifier === \"Down\") {\n return Keys.ArrowDown;\n } else if (key === Keys.ArrowLeft || key === \"Left\" || keyIdentifier === \"Left\") {\n return Keys.ArrowLeft;\n } else if (key === Keys.ArrowRight || key === \"Right\" || keyIdentifier === \"Right\") {\n return Keys.ArrowRight;\n } else if (key === Keys.ArrowUp || key === \"Up\" || keyIdentifier === \"Up\") {\n return Keys.ArrowUp;\n } else if (key === Keys.Escape || key === \"Esc\" || keyIdentifier === \"U+001B\") {\n return Keys.Escape;\n } else if (key === \"0\" || keyIdentifier === \"U+0030\") {\n return \"0\";\n } else if (key === \"+\" || key === \"Add\" || keyIdentifier === \"U+002B\" || keyIdentifier === \"U+00BB\" || keyIdentifier === \"U+004B\" && location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD /* workaround for Chrome for Windows */) {\n return \"+\";\n } else if (key === \"-\" || key === \"Subtract\" || keyIdentifier === \"U+002D\" || keyIdentifier === \"U+00BD\" || keyIdentifier === \"U+004D\" && location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD /* workaround for Chrome for Windows */) {\n return \"-\";\n } else {\n return key || keyIdentifier || Keys.Unidentified;\n }\n}", "function identifyKeyFromEvent(event) {\n var key = event.key;\n var keyIdentifier = event.keyIdentifier;\n var location = event.location;\n if (key === Keys.ArrowDown || key === \"Down\" || keyIdentifier === \"Down\") {\n return Keys.ArrowDown;\n } else if (key === Keys.ArrowLeft || key === \"Left\" || keyIdentifier === \"Left\") {\n return Keys.ArrowLeft;\n } else if (key === Keys.ArrowRight || key === \"Right\" || keyIdentifier === \"Right\") {\n return Keys.ArrowRight;\n } else if (key === Keys.ArrowUp || key === \"Up\" || keyIdentifier === \"Up\") {\n return Keys.ArrowUp;\n } else if (key === Keys.Escape || key === \"Esc\" || keyIdentifier === \"U+001B\") {\n return Keys.Escape;\n } else if (key === \"0\" || keyIdentifier === \"U+0030\") {\n return \"0\";\n } else if (key === \"+\" || key === \"Add\" || keyIdentifier === \"U+002B\" || keyIdentifier === \"U+00BB\" || keyIdentifier === \"U+004B\" && location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD /* workaround for Chrome for Windows */) {\n return \"+\";\n } else if (key === \"-\" || key === \"Subtract\" || keyIdentifier === \"U+002D\" || keyIdentifier === \"U+00BD\" || keyIdentifier === \"U+004D\" && location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD /* workaround for Chrome for Windows */) {\n return \"-\";\n } else {\n return key || keyIdentifier || Keys.Unidentified;\n }\n}", "function keyPressed(event) {\n var detailToKey = [];\n detailToKey[38] = \"ArrowUp\";\n detailToKey[40] = \"ArrowDown\";\n detailToKey[37] = \"ArrowLeft\";\n detailToKey[39] = \"ArrowRight\";\n detailToKey[66] = \"b\";\n detailToKey[65] = \"a\";\n \n if (typeof event.key === \"string\") { // assume it's an event.key value\n // console.log (\"returning event.key\");\n return event.key;\n } else { // assume in testing and convert detail to key value\n // console.log (\"converting detail to key\");\n return detailToKey[event.detail];\n }\n}", "function getKeyGivenValue( objectName, value ) \n\t{\n\t\tfor( var prop in objectName ) \n\t\t{\n \t\tif( objectName.hasOwnProperty( prop ) ) \n \t\t{\n \t\t if( objectName[ prop ] === value )\n \t\t {\n \t\t return prop;\n \t\t }\n \t\t}\n \t}\n }", "function getEvent(target, event_name) {\r\n if (target.events === undefined) {\r\n target.events = {};\r\n }\r\n return target.events[event_name];\r\n }", "function findKey(obj, predicate, context) {\n predicate = cb(predicate, context);\n var _keys = keys(obj), key;\n for (var i = 0, length = _keys.length; i < length; i++) {\n key = _keys[i];\n if (predicate(obj[key], key, obj)) return key;\n }\n }", "function findKey(obj, predicate, context) {\n predicate = cb(predicate, context);\n var _keys = keys(obj), key;\n for (var i = 0, length = _keys.length; i < length; i++) {\n key = _keys[i];\n if (predicate(obj[key], key, obj)) return key;\n }\n }", "function findKey(obj, predicate, context) {\n predicate = cb(predicate, context);\n var _keys = keys(obj), key;\n for (var i = 0, length = _keys.length; i < length; i++) {\n key = _keys[i];\n if (predicate(obj[key], key, obj)) return key;\n }\n }", "function findKey(obj, predicate, context) {\n predicate = cb(predicate, context);\n var _keys = keys(obj), key;\n for (var i = 0, length = _keys.length; i < length; i++) {\n key = _keys[i];\n if (predicate(obj[key], key, obj)) return key;\n }\n }", "function findKey(obj, predicate, context) {\n predicate = cb(predicate, context);\n var _keys = keys(obj), key;\n for (var i = 0, length = _keys.length; i < length; i++) {\n key = _keys[i];\n if (predicate(obj[key], key, obj)) return key;\n }\n }", "function findKey(obj, predicate, context) {\n predicate = cb(predicate, context);\n var _keys = keys(obj), key;\n for (var i = 0, length = _keys.length; i < length; i++) {\n key = _keys[i];\n if (predicate(obj[key], key, obj)) return key;\n }\n }", "function findKey(obj, predicate, context) {\n predicate = cb(predicate, context);\n var _keys = keys(obj), key;\n for (var i = 0, length = _keys.length; i < length; i++) {\n key = _keys[i];\n if (predicate(obj[key], key, obj)) return key;\n }\n }", "function findKey(obj, predicate, context) {\n predicate = cb(predicate, context);\n var _keys = keys(obj), key;\n for (var i = 0, length = _keys.length; i < length; i++) {\n key = _keys[i];\n if (predicate(obj[key], key, obj)) return key;\n }\n }", "function findKey(obj, predicate, context) {\n predicate = cb(predicate, context);\n var _keys = keys(obj), key;\n for (var i = 0, length = _keys.length; i < length; i++) {\n key = _keys[i];\n if (predicate(obj[key], key, obj)) return key;\n }\n }", "function getKey(key) {\n const lookup = {\n \"Up\": \"ArrowUp\",\n \"Down\": \"ArrowDown\",\n \"Left\": \"ArrowLeft\",\n \"Right\": \"ArrowRight\",\n \"Spacebar\": \" \",\n \"Esc\": \"Escape\"\n };\n return lookup[key] || key;\n}", "findKey1(obj, fn) {\n for (let key in obj) {\n if (fn(obj[key])) {\n return key;\n }\n }\n return undefined;\n }", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var base = keyNames[event.keyCode], name = base\n if (name == null || event.altGraphKey) { return false }\n if (event.altKey && base != \"Alt\") { name = \"Alt-\" + name }\n if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != \"Ctrl\") { name = \"Ctrl-\" + name }\n if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != \"Cmd\") { name = \"Cmd-\" + name }\n if (!noShift && event.shiftKey && base != \"Shift\") { name = \"Shift-\" + name }\n return name\n}", "function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var base = keyNames[event.keyCode], name = base\n if (name == null || event.altGraphKey) { return false }\n if (event.altKey && base != \"Alt\") { name = \"Alt-\" + name }\n if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != \"Ctrl\") { name = \"Ctrl-\" + name }\n if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != \"Cmd\") { name = \"Cmd-\" + name }\n if (!noShift && event.shiftKey && base != \"Shift\") { name = \"Shift-\" + name }\n return name\n}", "function getHostNameKey(fhcEvent) {\n let key = \"\";\n if (\"input\" !== fhcEvent.type) {\n // this allows for multiple versions of a field per host\n key = fhcEvent.host + \"|\" + fhcEvent.type + \"|\" + fhcEvent.name;\n }\n return key;\n}", "findKey (object, predicateFunction) {\n for(key in object) {\n const value = object.key;\n const predicateFuncReturn = predicateFunction(value);\n if(predicateFuncReturn){\n return key;\n }\n }\n return undefined;\n }", "function fnGetKey(aoData, sKey) {\r\n for (var i = 0, iLen = aoData.length; i < iLen; i++) {\r\n if (aoData[i].name == sKey) {\r\n return aoData[i].value;\r\n }\r\n }\r\n return null;\r\n}", "function getEventName(match, prefix, eventName) {\n return eventName.toUpperCase();\n}", "function getEventName(match, prefix, eventName) {\n return eventName.toUpperCase();\n}", "function getEventName(match, prefix, eventName) {\n return eventName.toUpperCase();\n}", "function getEventName(match, prefix, eventName) {\n\t return eventName.toUpperCase();\n\t }", "function getEventName(match, prefix, eventName) {\n return eventName.toUpperCase();\n }", "function getEventName(match, prefix, eventName) {\n return eventName.toUpperCase();\n }", "function getEventName(match, prefix, eventName) {\n return eventName.toUpperCase();\n }", "function getEventName(match, prefix, eventName) {\n return eventName.toUpperCase();\n }", "function getEventName(match, prefix, eventName) {\n return eventName.toUpperCase();\n }", "function getKeyByValue(object, value){ // function that returns the object key when given the corresponding value\n for (var key in object){\n if(object[key] === value){\n return key;\n }\n }\n }", "function getEventName(match, prefix, eventName) {\n return eventName.toUpperCase();\n }", "function getKeyFromObjField(obj, field) {\n\tvar key = null;\n\n\tif (obj[field]) {\n\t\tkey = obj[field];\n\t\tkey = key.substring(0, key.indexOf(':'));\n\t}\n\n\treturn key;\n}", "function getNameOfEventWithID(eventID) {\n return $q(function(resolve, reject) {\n firebaseObject.child(\"event_data/\" + eventID).once(\"value\", function(eventData) {\n resolve( eventData.val()[\"Name\"] );\n });\n });\n }", "function searchGet(key, obj)\n{\n obj || (obj=this);\n\n var value;\n var Key=key.charAt(0).toUpperCase() + key.substring(1);\n var accessor;\n\n if((accessor=(\"get\" + Key)) in obj)\n {\n var fn=obj[accessor];\n\n value=fn.call(obj);\n }\n // else if((\"is\" + Key) in obj)\n // {\n // value=obj.isKey();\n // }\n // else if((\"_\" + key) in obj)\n // {\n // value=obj[\"_\" + key];\n // }\n // else if((\"_is\" + Key) in obj)\n // {\n // value=obj[\"_is\" + key];\n // }\n // else// if((key in obj))\n // {\n // value=obj[key];\n // }\n else {\n value=ivarGet(key, obj);\n }\n\n return value;\n}", "function keyAccess () {\n const bestFruit = { name: 'banana', count: 42, isDelicious: true }\n\n // console.assert() allows you to declare things that should be true; it's like\n // a sanity-check for your code.\n // Here we are confirming that object access works like we expect:\n console.assert(bestFruit['name'] === 'banana')\n console.assert(bestFruit['count'] === 42)\n console.assert(bestFruit['isDelicious'] === true)\n\n // return the name of the bestFruit Object here.\n return bestFruit.name;\n}", "findKey(myObject, myPredicate){\r\n for (let aKey in myObject){\r\n if (myPredicate(myObject[aKey])){\r\n return aKey;\r\n }\r\n }\r\n return undefined;\r\n }", "getStringKeyValue(object, value) {\n if (typeof value === 'string') {\n return value;\n }\n\n let matchedKeys = Object.keys(object).filter(key => object[key] === value);\n if (matchedKeys.length === 0) {\n return value;\n }\n\n return matchedKeys[0];\n }", "getEventName(eventType, funcName) {\n return `sls-${eventType}-${funcName}`.replace(/-/g, '_');\n }", "function getKey(self, hashname, callback)\n{\n // moi?\n if(self.hashname === hashname) return callback(null, self.pubkey);\n \n // already known\n var who = seen(self, hashname);\n if(who.pubkey) return callback(null, who.pubkey);\n\n // multiple things may be wanting the key, create a watch\n var watch = keywatch(self, \"getkey \"+hashname, callback, 10*1000);\n if(watch.callbacks.length > 1) return;\n\n // if we're open and we know an ip for this hashname, just ask them!\n if(self.open && who.ip) return sendWho(self, who, hashname, watch.done);\n\n // if we have a lookup function, use that\n if(self.cb.lookup) return self.cb.lookup(hashname, watch.done);\n \n // resort to asking the operator\n doVerify(self, hashname, watch.done);\n}", "get eventResourceKey() {\n return `${this.event ? this.eventId : this.data.eventId || this.internalId}-${this.resource ? this.resourceId : this.data.resourceId || this.internalId}`;\n }", "function v2k(val, inObject, defReturn) {\n for (let k of Object.keys(inObject)) {\n if (inObject[k] === val) {\n return k;\n }\n }\n return defReturn === undefined ? null : defReturned;\n}", "getEvent(nameOrSignatureOrTopic) {\n if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__ethersproject_bytes__[\"f\" /* isHexString */])(nameOrSignatureOrTopic)) {\n const topichash = nameOrSignatureOrTopic.toLowerCase();\n for (const name in this.events) {\n if (topichash === this.getEventTopic(name)) {\n return this.events[name];\n }\n }\n logger.throwArgumentError(\"no matching event\", \"topichash\", topichash);\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (nameOrSignatureOrTopic.indexOf(\"(\") === -1) {\n const name = nameOrSignatureOrTopic.trim();\n const matching = Object.keys(this.events).filter((f) => (f.split(\"(\" /* fix:) */)[0] === name));\n if (matching.length === 0) {\n logger.throwArgumentError(\"no matching event\", \"name\", name);\n }\n else if (matching.length > 1) {\n logger.throwArgumentError(\"multiple matching events\", \"name\", name);\n }\n return this.events[matching[0]];\n }\n // Normlize the signature and lookup the function\n const result = this.events[__WEBPACK_IMPORTED_MODULE_8__fragments__[\"b\" /* EventFragment */].fromString(nameOrSignatureOrTopic).format()];\n if (!result) {\n logger.throwArgumentError(\"no matching event\", \"signature\", nameOrSignatureOrTopic);\n }\n return result;\n }", "getEvent(nameOrSignatureOrTopic) {\n if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__ethersproject_bytes__[\"f\" /* isHexString */])(nameOrSignatureOrTopic)) {\n const topichash = nameOrSignatureOrTopic.toLowerCase();\n for (const name in this.events) {\n if (topichash === this.getEventTopic(name)) {\n return this.events[name];\n }\n }\n logger.throwArgumentError(\"no matching event\", \"topichash\", topichash);\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (nameOrSignatureOrTopic.indexOf(\"(\") === -1) {\n const name = nameOrSignatureOrTopic.trim();\n const matching = Object.keys(this.events).filter((f) => (f.split(\"(\" /* fix:) */)[0] === name));\n if (matching.length === 0) {\n logger.throwArgumentError(\"no matching event\", \"name\", name);\n }\n else if (matching.length > 1) {\n logger.throwArgumentError(\"multiple matching events\", \"name\", name);\n }\n return this.events[matching[0]];\n }\n // Normlize the signature and lookup the function\n const result = this.events[__WEBPACK_IMPORTED_MODULE_8__fragments__[\"a\" /* EventFragment */].fromString(nameOrSignatureOrTopic).format()];\n if (!result) {\n logger.throwArgumentError(\"no matching event\", \"signature\", nameOrSignatureOrTopic);\n }\n return result;\n }", "findKey2(object, predicate) {\n for (let key in object) {\n const value = object[key];\n const predicateReturnValue = predicate(value);\n if (predicateReturnValue) return key;\n }\n return undefined;\n }", "function findKey(keyName : String) : Transform\n{\n\tDebug.Log(\"finding key with \" + keyName);\n\tfor(var i:Transform in associatedInventory.Contents) //Loop through the Items in the Inventory:\n\t{\n\t\tif(i.name == keyName) //When a match is found, return the Item.\n\t\t{\n\t\t\tDebug.Log(\"Key found\");\n\t\t\tgameObject.SendMessage(\"findKeyCallback\", i);\n\t\t\treturn i;\n\t\t\t//No need to continue running through the loop since we found our item.\n\t\t}\n\t}\n\t\n\tgameObject.SendMessage(\"findKeyFailCallback\", true, SendMessageOptions.DontRequireReceiver);\n\treturn null;\n}", "getEvent(eventName) {\n return this.events.find((e) => e.title == eventName);\n }", "function getKeyFromList(list, key) {\n for (const data of list) {\n if (data.name === key) {\n return data.value;\n }\n }\n throw Error(`'${key}' not found in ${JSON.stringify(list)}`);\n}", "getEvent(nameOrSignatureOrTopic) {\n if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__[/* isHexString */ \"l\"])(nameOrSignatureOrTopic)) {\n const topichash = nameOrSignatureOrTopic.toLowerCase();\n for (const name in this.events) {\n if (topichash === this.getEventTopic(name)) {\n return this.events[name];\n }\n }\n logger.throwArgumentError(\"no matching event\", \"topichash\", topichash);\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (nameOrSignatureOrTopic.indexOf(\"(\") === -1) {\n const name = nameOrSignatureOrTopic.trim();\n const matching = Object.keys(this.events).filter((f) => (f.split(\"(\" /* fix:) */)[0] === name));\n if (matching.length === 0) {\n logger.throwArgumentError(\"no matching event\", \"name\", name);\n }\n else if (matching.length > 1) {\n logger.throwArgumentError(\"multiple matching events\", \"name\", name);\n }\n return this.events[matching[0]];\n }\n // Normlize the signature and lookup the function\n const result = this.events[_fragments__WEBPACK_IMPORTED_MODULE_7__[/* EventFragment */ \"c\"].fromString(nameOrSignatureOrTopic).format()];\n if (!result) {\n logger.throwArgumentError(\"no matching event\", \"signature\", nameOrSignatureOrTopic);\n }\n return result;\n }", "function getKey(_, ctx) {\n var k = 'k:' + _.$key + '_' + (!!_.$flat);\n return ctx.fn[k] || (ctx.fn[k] = vegaUtil.key(_.$key, _.$flat));\n }", "function getKeyValue(sourceCode){\n\tif(sourceCode == null)\n\t\tsourceCode = window.event.keyCode;\n\t\n\tvar code = getKeyCode(sourceCode);\n\tvar actualkey = code;\n\t\n\tif(isNumber(code))\n\t// try to look up the key now\n\t\tactualkey=String.fromCharCode(code);\n\n\tif(actualkey == null)\n\t\treturn null;\n\n\treturn actualkey.toLowerCase();\n}", "function key(kind, key) {\n \n}", "function get_obj_key_val(obj,key){\n\t\tif (!is_undefined_key(obj,key)) {\n\t\t\treturn _obj_composed_key_val(obj,key);\n\t\t}else {\n\t\t\treturn -1;\n\t\t}\n\n\t\tfunction _obj_composed_key_val(obj,key_str) {\n\t\t\tvar arr_key = key_str.split(\".\");\n\t\t\tvar inner_val = obj;\n\t\t\tfor (var i = 0; i < arr_key.length; i++) {\n\t\t\t\tinner_val = inner_val[arr_key[i]];\n\t\t\t}\n\t\t\treturn inner_val;\n\t\t}\n\t}", "getKey(arg) {\n return typeof arg === 'object'\n ? this.selectId(arg)\n : arg;\n }", "matchKey(needle, obj, caseInsensitive) {\n\t\tneedle = (caseInsensitive) ? needle.toLowerCase() : needle;\n\t\tfor (let key in obj) {\n\t\t\tconst keyCopy = (caseInsensitive) ? key.toLowerCase() : key;\n\t\t\tif (keyCopy === needle) {\n\t\t\t\treturn key; \t\t\t\t//return the original\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "function getFieldEntryKey(node) {\n return node.alias ? node.alias.value : node.name.value;\n}", "function getFieldEntryKey(node) {\n return node.alias ? node.alias.value : node.name.value;\n}", "function getFieldEntryKey(node) {\n return node.alias ? node.alias.value : node.name.value;\n}", "function getFieldEntryKey(node) {\n return node.alias ? node.alias.value : node.name.value;\n}", "function getFieldEntryKey(node) {\n return node.alias ? node.alias.value : node.name.value;\n}", "function getFieldEntryKey(node) {\n return node.alias ? node.alias.value : node.name.value;\n}", "function getValue(object, key) {\n return object[key];\n}", "function find(map, name) {\n name = name.toLowerCase();\n\n for (var key in map) {\n if (key.toLowerCase() === name) {\n return key;\n }\n }\n\n return undefined;\n}", "function get(object, key) {\n //Loop through the object\n //if you find that key return value\n //else return undefined\n for(let banana in object) {\n return object[key];\n}\n}", "function find$1(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find$1(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function getSearchKey( event ) {\n\tif(!event) return;\n\tvar regex = new RegExp(\"^[a-zA-Z0-9]+$\");\n var key = String.fromCharCode(!(event.charCode) ? event.which : event.charCode);\n\tconsole.log('GOT KEY', key);\n if (!regex.test(key)) {\n getAutosuggesionHeader( '#form_topsearch', event );\n\t}\n\t\n\t getAutosuggesionHeader( '#form_topsearch', event, key );\n\t//func_call( '#form_topsearch', event, key );\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}", "function find(map, name) {\n\tname = name.toLowerCase();\n\tfor (const key in map) {\n\t\tif (key.toLowerCase() === name) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}" ]
[ "0.68437785", "0.66774225", "0.6616543", "0.63617873", "0.6232344", "0.58947927", "0.58873767", "0.582189", "0.5820872", "0.57668227", "0.57626027", "0.5733329", "0.57292217", "0.571779", "0.571779", "0.571779", "0.571779", "0.57143486", "0.57070446", "0.57045966", "0.5690433", "0.5690433", "0.5690433", "0.5690433", "0.5690433", "0.5690433", "0.5690433", "0.5690433", "0.5690433", "0.5685507", "0.56844205", "0.56721836", "0.56721836", "0.5657038", "0.5649207", "0.5647428", "0.5598604", "0.5598604", "0.5598604", "0.55836457", "0.5582812", "0.5582812", "0.5582812", "0.558173", "0.5563735", "0.5562106", "0.5562093", "0.5554088", "0.5544347", "0.55129737", "0.5476872", "0.5476234", "0.5473183", "0.5472847", "0.5430662", "0.53893656", "0.53824747", "0.53768724", "0.5376849", "0.53747696", "0.53697014", "0.53663504", "0.53631616", "0.5361257", "0.536027", "0.53377026", "0.53365606", "0.53347486", "0.53251547", "0.5323941", "0.53098106", "0.53098106", "0.53098106", "0.53098106", "0.53098106", "0.53098106", "0.5288472", "0.52818775", "0.52767575", "0.5275071", "0.5275071", "0.52596307", "0.5246372", "0.5246372", "0.5246372", "0.5246372", "0.5246372", "0.5246372", "0.5246372", "0.5246372", "0.5246372", "0.5246372", "0.5246372", "0.5246372", "0.5246372", "0.5246372", "0.5246372", "0.5246372", "0.5246372", "0.5246372", "0.5246372" ]
0.0
-1
Helper for deleting text near the selection(s), used to implement backspace, delete, and similar functionality.
function deleteNearSelection(cm, compute) { var ranges = cm.doc.sel.ranges, kill = []; // Build up a set of ranges to kill first, merging overlapping // ranges. for (var i = 0; i < ranges.length; i++) { var toKill = compute(ranges[i]); while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) { var replaced = kill.pop(); if (cmp(replaced.from, toKill.from) < 0) { toKill.from = replaced.from; break } } kill.push(toKill); } // Next, remove those actual ranges. runInOp(cm, function () { for (var i = kill.length - 1; i >= 0; i--) { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); } ensureCursorVisible(cm); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeTextSelections() {\n if (document.selection) document.selection.empty();\n else if (window.getSelection) window.getSelection().removeAllRanges();\n}", "function removeTextSelection() {\n\n if (window.getSelection) {\n\n window.getSelection().removeAllRanges();\n\n } else if (document.selection) {\n\n document.selection.empty();\n\n }\n\n}", "delete(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n reverse = false,\n unit = 'character',\n distance = 1,\n voids = false\n } = options;\n var {\n at = editor.selection,\n hanging = false\n } = options;\n\n if (!at) {\n return;\n }\n\n if (Range.isRange(at) && Range.isCollapsed(at)) {\n at = at.anchor;\n }\n\n if (Point.isPoint(at)) {\n var furthestVoid = Editor.void(editor, {\n at,\n mode: 'highest'\n });\n\n if (!voids && furthestVoid) {\n var [, voidPath] = furthestVoid;\n at = voidPath;\n } else {\n var opts = {\n unit,\n distance\n };\n var target = reverse ? Editor.before(editor, at, opts) || Editor.start(editor, []) : Editor.after(editor, at, opts) || Editor.end(editor, []);\n at = {\n anchor: at,\n focus: target\n };\n hanging = true;\n }\n }\n\n if (Path.isPath(at)) {\n Transforms.removeNodes(editor, {\n at,\n voids\n });\n return;\n }\n\n if (Range.isCollapsed(at)) {\n return;\n }\n\n if (!hanging) {\n at = Editor.unhangRange(editor, at, {\n voids\n });\n }\n\n var [start, end] = Range.edges(at);\n var startBlock = Editor.above(editor, {\n match: n => Editor.isBlock(editor, n),\n at: start,\n voids\n });\n var endBlock = Editor.above(editor, {\n match: n => Editor.isBlock(editor, n),\n at: end,\n voids\n });\n var isAcrossBlocks = startBlock && endBlock && !Path.equals(startBlock[1], endBlock[1]);\n var isSingleText = Path.equals(start.path, end.path);\n var startVoid = voids ? null : Editor.void(editor, {\n at: start,\n mode: 'highest'\n });\n var endVoid = voids ? null : Editor.void(editor, {\n at: end,\n mode: 'highest'\n }); // If the start or end points are inside an inline void, nudge them out.\n\n if (startVoid) {\n var before = Editor.before(editor, start);\n\n if (before && startBlock && Path.isAncestor(startBlock[1], before.path)) {\n start = before;\n }\n }\n\n if (endVoid) {\n var after = Editor.after(editor, end);\n\n if (after && endBlock && Path.isAncestor(endBlock[1], after.path)) {\n end = after;\n }\n } // Get the highest nodes that are completely inside the range, as well as\n // the start and end nodes.\n\n\n var matches = [];\n var lastPath;\n\n for (var entry of Editor.nodes(editor, {\n at,\n voids\n })) {\n var [node, path] = entry;\n\n if (lastPath && Path.compare(path, lastPath) === 0) {\n continue;\n }\n\n if (!voids && Editor.isVoid(editor, node) || !Path.isCommon(path, start.path) && !Path.isCommon(path, end.path)) {\n matches.push(entry);\n lastPath = path;\n }\n }\n\n var pathRefs = Array.from(matches, (_ref) => {\n var [, p] = _ref;\n return Editor.pathRef(editor, p);\n });\n var startRef = Editor.pointRef(editor, start);\n var endRef = Editor.pointRef(editor, end);\n\n if (!isSingleText && !startVoid) {\n var _point = startRef.current;\n var [_node] = Editor.leaf(editor, _point);\n var {\n path: _path\n } = _point;\n var {\n offset\n } = start;\n\n var text = _node.text.slice(offset);\n\n editor.apply({\n type: 'remove_text',\n path: _path,\n offset,\n text\n });\n }\n\n for (var pathRef of pathRefs) {\n var _path2 = pathRef.unref();\n\n Transforms.removeNodes(editor, {\n at: _path2,\n voids\n });\n }\n\n if (!endVoid) {\n var _point2 = endRef.current;\n var [_node2] = Editor.leaf(editor, _point2);\n var {\n path: _path3\n } = _point2;\n\n var _offset = isSingleText ? start.offset : 0;\n\n var _text = _node2.text.slice(_offset, end.offset);\n\n editor.apply({\n type: 'remove_text',\n path: _path3,\n offset: _offset,\n text: _text\n });\n }\n\n if (!isSingleText && isAcrossBlocks && endRef.current && startRef.current) {\n Transforms.mergeNodes(editor, {\n at: endRef.current,\n hanging: true,\n voids\n });\n }\n\n var point = endRef.unref() || startRef.unref();\n\n if (options.at == null && point) {\n Transforms.select(editor, point);\n }\n });\n }", "function ClearTextSelection() {\n\t//console.log('Clear text selection.');\n\tif ( document.selection ) {\n //console.log('document.selection'); \n\t\tdocument.selection.empty();\n\t} else if ( window.getSelection ) {\n\t\t//console.log('window.getSelection');\n\t\twindow.getSelection().removeAllRanges();\n\t}\n} // END ClearTextSelection.", "function keyCommandPlainDelete(editorState){var afterRemoval=removeTextWithStrategy(editorState,function(strategyState){var selection=strategyState.getSelection();var content=strategyState.getCurrentContent();var key=selection.getAnchorKey();var offset=selection.getAnchorOffset();var charAhead=content.getBlockForKey(key).getText()[offset];return moveSelectionForward(strategyState,charAhead?UnicodeUtils.getUTF16Length(charAhead,0):1);},'forward');if(afterRemoval===editorState.getCurrentContent()){return editorState;}var selection=editorState.getSelection();return EditorState.push(editorState,afterRemoval.set('selectionBefore',selection),selection.isCollapsed()?'delete-character':'remove-range');}", "unselectText_() {\n try {\n this.win.getSelection().removeAllRanges();\n } catch (e) {\n // Selection API not supported.\n }\n }", "function unselectText() {\n window.getSelection().empty();\n}", "function clearSelection()\n{\n if (window.getSelection) {window.getSelection().removeAllRanges();}\n else if (document.selection) {document.selection.empty();}\n}", "function keyCommandPlainDelete(editorState) {\n\t var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n\t var selection = strategyState.getSelection();\n\t var content = strategyState.getCurrentContent();\n\t var key = selection.getAnchorKey();\n\t var offset = selection.getAnchorOffset();\n\t var charAhead = content.getBlockForKey(key).getText()[offset];\n\t return moveSelectionForward(strategyState, charAhead ? UnicodeUtils.getUTF16Length(charAhead, 0) : 1);\n\t }, 'forward');\n\n\t if (afterRemoval === editorState.getCurrentContent()) {\n\t return editorState;\n\t }\n\n\t var selection = editorState.getSelection();\n\n\t return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'delete-character' : 'remove-range');\n\t}", "delete(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n reverse = false,\n unit = 'character',\n distance = 1,\n voids = false\n } = options;\n var {\n at = editor.selection,\n hanging = false\n } = options;\n\n if (!at) {\n return;\n }\n\n if (Range.isRange(at) && Range.isCollapsed(at)) {\n at = at.anchor;\n }\n\n if (Point.isPoint(at)) {\n var furthestVoid = Editor.void(editor, {\n at,\n mode: 'highest'\n });\n\n if (!voids && furthestVoid) {\n var [, voidPath] = furthestVoid;\n at = voidPath;\n } else {\n var opts = {\n unit,\n distance\n };\n var target = reverse ? Editor.before(editor, at, opts) || Editor.start(editor, []) : Editor.after(editor, at, opts) || Editor.end(editor, []);\n at = {\n anchor: at,\n focus: target\n };\n hanging = true;\n }\n }\n\n if (Path.isPath(at)) {\n Transforms.removeNodes(editor, {\n at,\n voids\n });\n return;\n }\n\n if (Range.isCollapsed(at)) {\n return;\n }\n\n if (!hanging) {\n var [, _end] = Range.edges(at);\n var endOfDoc = Editor.end(editor, []);\n\n if (!Point.equals(_end, endOfDoc)) {\n at = Editor.unhangRange(editor, at, {\n voids\n });\n }\n }\n\n var [start, end] = Range.edges(at);\n var startBlock = Editor.above(editor, {\n match: n => Editor.isBlock(editor, n),\n at: start,\n voids\n });\n var endBlock = Editor.above(editor, {\n match: n => Editor.isBlock(editor, n),\n at: end,\n voids\n });\n var isAcrossBlocks = startBlock && endBlock && !Path.equals(startBlock[1], endBlock[1]);\n var isSingleText = Path.equals(start.path, end.path);\n var startVoid = voids ? null : Editor.void(editor, {\n at: start,\n mode: 'highest'\n });\n var endVoid = voids ? null : Editor.void(editor, {\n at: end,\n mode: 'highest'\n }); // If the start or end points are inside an inline void, nudge them out.\n\n if (startVoid) {\n var before = Editor.before(editor, start);\n\n if (before && startBlock && Path.isAncestor(startBlock[1], before.path)) {\n start = before;\n }\n }\n\n if (endVoid) {\n var after = Editor.after(editor, end);\n\n if (after && endBlock && Path.isAncestor(endBlock[1], after.path)) {\n end = after;\n }\n } // Get the highest nodes that are completely inside the range, as well as\n // the start and end nodes.\n\n\n var matches = [];\n var lastPath;\n\n for (var entry of Editor.nodes(editor, {\n at,\n voids\n })) {\n var [node, path] = entry;\n\n if (lastPath && Path.compare(path, lastPath) === 0) {\n continue;\n }\n\n if (!voids && Editor.isVoid(editor, node) || !Path.isCommon(path, start.path) && !Path.isCommon(path, end.path)) {\n matches.push(entry);\n lastPath = path;\n }\n }\n\n var pathRefs = Array.from(matches, _ref => {\n var [, p] = _ref;\n return Editor.pathRef(editor, p);\n });\n var startRef = Editor.pointRef(editor, start);\n var endRef = Editor.pointRef(editor, end);\n\n if (!isSingleText && !startVoid) {\n var _point = startRef.current;\n var [_node] = Editor.leaf(editor, _point);\n var {\n path: _path\n } = _point;\n var {\n offset\n } = start;\n\n var text = _node.text.slice(offset);\n\n if (text.length > 0) editor.apply({\n type: 'remove_text',\n path: _path,\n offset,\n text\n });\n }\n\n for (var pathRef of pathRefs) {\n var _path2 = pathRef.unref();\n\n Transforms.removeNodes(editor, {\n at: _path2,\n voids\n });\n }\n\n if (!endVoid) {\n var _point2 = endRef.current;\n var [_node2] = Editor.leaf(editor, _point2);\n var {\n path: _path3\n } = _point2;\n\n var _offset = isSingleText ? start.offset : 0;\n\n var _text = _node2.text.slice(_offset, end.offset);\n\n if (_text.length > 0) editor.apply({\n type: 'remove_text',\n path: _path3,\n offset: _offset,\n text: _text\n });\n }\n\n if (!isSingleText && isAcrossBlocks && endRef.current && startRef.current) {\n Transforms.mergeNodes(editor, {\n at: endRef.current,\n hanging: true,\n voids\n });\n }\n\n var point = reverse ? startRef.unref() || endRef.unref() : endRef.unref() || startRef.unref();\n\n if (options.at == null && point) {\n Transforms.select(editor, point);\n }\n });\n }", "deselectAll() {\n if (document.selection) {\n document.selection.empty();\n } else if (window.getSelection) {\n window.getSelection().removeAllRanges();\n }\n }", "function keyCommandPlainDelete(editorState) {\n var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n var selection = strategyState.getSelection();\n var content = strategyState.getCurrentContent();\n var key = selection.getAnchorKey();\n var offset = selection.getAnchorOffset();\n var charAhead = content.getBlockForKey(key).getText()[offset];\n return moveSelectionForward(strategyState, charAhead ? UnicodeUtils.getUTF16Length(charAhead, 0) : 1);\n }, 'forward');\n\n if (afterRemoval === editorState.getCurrentContent()) {\n return editorState;\n }\n\n var selection = editorState.getSelection();\n\n return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'delete-character' : 'remove-range');\n}", "function keyCommandPlainDelete(editorState) {\n var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n var selection = strategyState.getSelection();\n var content = strategyState.getCurrentContent();\n var key = selection.getAnchorKey();\n var offset = selection.getAnchorOffset();\n var charAhead = content.getBlockForKey(key).getText()[offset];\n return moveSelectionForward(strategyState, charAhead ? UnicodeUtils.getUTF16Length(charAhead, 0) : 1);\n }, 'forward');\n\n if (afterRemoval === editorState.getCurrentContent()) {\n return editorState;\n }\n\n var selection = editorState.getSelection();\n\n return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'delete-character' : 'remove-range');\n}", "function keyCommandPlainDelete(editorState) {\n var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n var selection = strategyState.getSelection();\n var content = strategyState.getCurrentContent();\n var key = selection.getAnchorKey();\n var offset = selection.getAnchorOffset();\n var charAhead = content.getBlockForKey(key).getText()[offset];\n return moveSelectionForward(strategyState, charAhead ? UnicodeUtils.getUTF16Length(charAhead, 0) : 1);\n }, 'forward');\n\n if (afterRemoval === editorState.getCurrentContent()) {\n return editorState;\n }\n\n var selection = editorState.getSelection();\n\n return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'delete-character' : 'remove-range');\n}", "function keyCommandPlainDelete(editorState) {\n var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n var selection = strategyState.getSelection();\n var content = strategyState.getCurrentContent();\n var key = selection.getAnchorKey();\n var offset = selection.getAnchorOffset();\n var charAhead = content.getBlockForKey(key).getText()[offset];\n return moveSelectionForward(strategyState, charAhead ? UnicodeUtils.getUTF16Length(charAhead, 0) : 1);\n }, 'forward');\n\n if (afterRemoval === editorState.getCurrentContent()) {\n return editorState;\n }\n\n var selection = editorState.getSelection();\n\n return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'delete-character' : 'remove-range');\n}", "function keyCommandPlainDelete(editorState) {\n var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n var selection = strategyState.getSelection();\n var content = strategyState.getCurrentContent();\n var key = selection.getAnchorKey();\n var offset = selection.getAnchorOffset();\n var charAhead = content.getBlockForKey(key).getText()[offset];\n return moveSelectionForward(strategyState, charAhead ? UnicodeUtils.getUTF16Length(charAhead, 0) : 1);\n }, 'forward');\n\n if (afterRemoval === editorState.getCurrentContent()) {\n return editorState;\n }\n\n var selection = editorState.getSelection();\n\n return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'delete-character' : 'remove-range');\n}", "function keyCommandPlainDelete(editorState) {\n var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n var selection = strategyState.getSelection();\n var content = strategyState.getCurrentContent();\n var key = selection.getAnchorKey();\n var offset = selection.getAnchorOffset();\n var charAhead = content.getBlockForKey(key).getText()[offset];\n return moveSelectionForward(strategyState, charAhead ? UnicodeUtils.getUTF16Length(charAhead, 0) : 1);\n }, 'forward');\n\n if (afterRemoval === editorState.getCurrentContent()) {\n return editorState;\n }\n\n var selection = editorState.getSelection();\n\n return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'delete-character' : 'remove-range');\n}", "function keyCommandPlainDelete(editorState) {\n var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n var selection = strategyState.getSelection();\n var content = strategyState.getCurrentContent();\n var key = selection.getAnchorKey();\n var offset = selection.getAnchorOffset();\n var charAhead = content.getBlockForKey(key).getText()[offset];\n return moveSelectionForward(strategyState, charAhead ? UnicodeUtils.getUTF16Length(charAhead, 0) : 1);\n }, 'forward');\n\n if (afterRemoval === editorState.getCurrentContent()) {\n return editorState;\n }\n\n var selection = editorState.getSelection();\n\n return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'delete-character' : 'remove-range');\n}", "function keyCommandPlainDelete(editorState) {\n var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n var selection = strategyState.getSelection();\n var content = strategyState.getCurrentContent();\n var key = selection.getAnchorKey();\n var offset = selection.getAnchorOffset();\n var charAhead = content.getBlockForKey(key).getText()[offset];\n return moveSelectionForward(strategyState, charAhead ? UnicodeUtils.getUTF16Length(charAhead, 0) : 1);\n }, 'forward');\n\n if (afterRemoval === editorState.getCurrentContent()) {\n return editorState;\n }\n\n var selection = editorState.getSelection();\n\n return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'delete-character' : 'remove-range');\n}", "function keyCommandPlainDelete(editorState) {\n var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n var selection = strategyState.getSelection();\n var content = strategyState.getCurrentContent();\n var key = selection.getAnchorKey();\n var offset = selection.getAnchorOffset();\n var charAhead = content.getBlockForKey(key).getText()[offset];\n return moveSelectionForward(strategyState, charAhead ? UnicodeUtils.getUTF16Length(charAhead, 0) : 1);\n }, 'forward');\n\n if (afterRemoval === editorState.getCurrentContent()) {\n return editorState;\n }\n\n var selection = editorState.getSelection();\n\n return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'delete-character' : 'remove-range');\n}", "function removeAllSelections() {\r\n\tvar pos = getCaretPosition();\r\n\twindow.getSelection().removeAllRanges();\r\n\tsetCaretPosition(pos);\r\n}", "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 del(){\n\tvar position = results.selectionStart - 1;\n\tvar numsValue = results.value;\n\tvar str = numsValue.slice(0,position) + numsValue.slice(position+1, results.length);\n\tresults.value = str;\n\tresults.selectionStart = position;\n}", "function selectionTrim() {\n if (selectionExists()) {\n var range = selectionRange();\n rangeTrim(range);\n selectionSet(range);\n }\n}", "function clearSelection () {\n if (document.selection) {\n document.selection.empty();\n } else if (window.getSelection) {\n window.getSelection().removeAllRanges();\n }\n}", "function removeUnderlineSelection() {\n\n var sel = window.getSelection();\n var range = sel.getRangeAt(0);\n\n var nodes = getRangeTextNodes(range);\n\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n// unhighlight(node);\n var parent = node.parentNode;\n// window.TextSelection.jsLog(\"====\\n!@@@@@@@@@@! span= \" + parent.getElementsByTagName(\"span\").length);\n if (parent.nodeName != \"SPAN\") {\n unhighlight(node);\n// window.TextSelection.jsLog(\"1111\");\n } else {\n// window.TextSelection.jsLog(\"2222\");\n unhighlight(parent);\n }\n\n// window.TextSelection.jsError(\"!@@@@@@@@@@! = \" + parent.nodeType);\n// window.TextSelection.jsError(\"!@@@@@@@@@@! = \" + parent.textContent);\n// window.TextSelection.jsError(\"!@@@@@@@@@@! = \" + parent.nodeName);\n// continue;\n//\n// var r = document.createRange();\n// r.setStart(node, 0);\n// r.setEnd(node, node.textContent.length);\n// setRangeTextDecoration(r, \"none\");\n//\n//\n//// r.setStart(node, )\n// if (node.style) {\n// node.style.textDecoration = \"none\";\n// }\n }\n}", "clearSelection() {\n this._clearSelection();\n }", "function replaceSelectedText(replacementText) {\n var sel, range;\n if (window.getSelection) {\n sel = window.getSelection();\n if (sel.rangeCount) {\n range = sel.getRangeAt(0);\n range.deleteContents();\n range.insertNode(document.createTextNode(replacementText));\n }\n } else if (document.selection && document.selection.createRange) {\n range = document.selection.createRange();\n range.text = replacementText;\n }\n}", "function clearSelectedText() {\n selectedText = \"\";\n}", "function clearPreviousSelection()\n {\n if ($.browser.msie) \n {\n document.selection.empty();\n }\n else\n {\n window.getSelection().removeAllRanges();\n }\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 }", "clearSelection() {\n this.selectionStart = undefined;\n this.selectionEnd = undefined;\n this.isSelectAllActive = false;\n this.selectionStartLength = 0;\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 }", "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 }", "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 }", "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 keyCommandDeleteWord(editorState){var afterRemoval=removeTextWithStrategy(editorState,function(strategyState){var selection=strategyState.getSelection();var offset=selection.getStartOffset();var key=selection.getStartKey();var content=strategyState.getCurrentContent();var text=content.getBlockForKey(key).getText().slice(offset);var toRemove=DraftRemovableWord.getForward(text);// If there are no words in front of the cursor, remove the newline.\r\n\treturn moveSelectionForward(strategyState,toRemove.length||1);},'forward');if(afterRemoval===editorState.getCurrentContent()){return editorState;}return EditorState.push(editorState,afterRemoval,'remove-range');}", "deleteSelection(e) {\n var direction, selection, values, caret, tail;\n var self = this;\n direction = e && e.keyCode === KEY_BACKSPACE ? -1 : 1;\n selection = getSelection(self.control_input); // determine items that will be removed\n\n values = [];\n\n if (self.activeItems.length) {\n tail = getTail(self.activeItems, direction);\n caret = nodeIndex(tail);\n\n if (direction > 0) {\n caret++;\n }\n\n for (const item of self.activeItems) {\n values.push(item.dataset.value);\n }\n } else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) {\n if (direction < 0 && selection.start === 0 && selection.length === 0) {\n values.push(self.items[self.caretPos - 1]);\n } else if (direction > 0 && selection.start === self.inputValue().length) {\n values.push(self.items[self.caretPos]);\n }\n } // allow the callback to abort\n\n\n if (!values.length || typeof self.settings.onDelete === 'function' && self.settings.onDelete.call(self, values, e) === false) {\n return false;\n }\n\n preventDefault(e, true); // perform removal\n\n if (typeof caret !== 'undefined') {\n self.setCaret(caret);\n }\n\n while (values.length) {\n self.removeItem(values.pop());\n }\n\n self.showInput();\n self.positionDropdown();\n self.refreshOptions(false);\n return true;\n }", "function _corexitOnMouseUp(event) {\r\n\tvar selection = window.getSelection();\r\n\tvar selectedText = selection ? selection.toString() : \"\";\r\n\r\n //unselect\r\n //selection.collapseToStart();\r\n\r\n\t//if (selectedText.length != 0) {\r\n chrome.extension.sendRequest({command : \"sendText\", text : selectedText});\r\n\t//}\r\n \r\n\t//gClickInTextBox = false;\r\n \r\n}", "function r(e,t){e.selection.isCollapsed()&&e.selection.selectLine();for(var n=e.selection.surround(t),o=0,s=n.length;o<s;o++)b.dom.lineBreaks(n[o]).remove(),u(n[o]);// rethink restoring selection\n// composer.selection.selectNode(element, wysihtml5.browser.displaysCaretInEmptyContentEditableCorrectly());\n}", "function onRemoveText() {\n let elText = document.querySelector('.currText').value\n if (elText === '' || gMeme.existText.length === 1) return;\n var text = findTextById(gMeme.currText.id)\n gMeme.existText.splice(text, 1);\n resetValues()\n gMeme.currText = gMeme.existText[0]\n draw()\n}", "removeWordLeft() {\n if (this.selection.isEmpty())\n this.selection.selectWordLeft();\n\n this.session.remove(this.getSelectionRange());\n this.clearSelection();\n }", "removeHyperlink() {\n if (this.owner.isReadOnlyMode) {\n return;\n }\n let selection = this.selection;\n let fieldBegin = selection.getHyperlinkField();\n if (isNullOrUndefined(fieldBegin)) {\n return;\n }\n let fieldEnd = fieldBegin.fieldEnd;\n let fieldSeparator = fieldBegin.fieldSeparator;\n let fieldStartPosition = new TextPosition(selection.owner);\n // tslint:disable-next-line:max-line-length\n fieldStartPosition.setPositionParagraph(fieldBegin.line, (fieldBegin.line).getOffset(fieldBegin, 0));\n let fieldSeparatorPosition = new TextPosition(selection.owner);\n // tslint:disable-next-line:max-line-length\n fieldSeparatorPosition.setPositionParagraph(fieldSeparator.line, (fieldSeparator.line).getOffset(fieldSeparator, fieldSeparator.length));\n this.initComplexHistory('RemoveHyperlink');\n selection.start.setPositionParagraph(fieldEnd.line, (fieldEnd.line).getOffset(fieldEnd, 0));\n selection.end.setPositionInternal(selection.start);\n this.onDelete();\n selection.start.setPositionInternal(fieldSeparatorPosition);\n this.initHistory('Underline');\n this.updateCharacterFormatWithUpdate(selection, 'underline', 'None', false);\n if (this.editorHistory) {\n this.editorHistory.updateHistory();\n }\n // Applies font color for field result.\n this.initHistory('FontColor');\n this.updateCharacterFormatWithUpdate(selection, 'fontColor', undefined, false);\n if (this.editorHistory) {\n this.editorHistory.updateHistory();\n }\n this.reLayout(selection, false);\n selection.end.setPositionInternal(selection.start);\n selection.start.setPositionInternal(fieldStartPosition);\n this.initHistory('Delete');\n this.deleteSelectedContents(selection, false);\n this.reLayout(selection, true);\n if (this.editorHistory && !isNullOrUndefined(this.editorHistory.currentHistoryInfo)) {\n this.editorHistory.updateComplexHistory();\n }\n }", "function fixTextSelection( dom_element )\n {\n //chrome, opera, and safari select PRE text correctly \n if ($.chili.selection.active && ($.browser.msie || $.browser.mozilla)) \n {\n var element = null;\n $(dom_element)\n .parents()\n .filter(\"pre\")\n .bind(\"mousedown\", resetSelectedTextElement)\n .bind(\"mouseup\", displaySelectedTextDialog)\n ;\n }\n }", "function emptyEditorWhenDeleting() {\n\t\t\tfunction serializeRng(rng) {\n\t\t\t\tvar body = dom.create(\"body\");\n\t\t\t\tvar contents = rng.cloneContents();\n\t\t\t\tbody.appendChild(contents);\n\t\t\t\treturn selection.serializer.serialize(body, {format: 'html'});\n\t\t\t}\n\n\t\t\tfunction allContentsSelected(rng) {\n\t\t\t\tif (!rng.setStart) {\n\t\t\t\t\tif (rng.item) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar bodyRng = rng.duplicate();\n\t\t\t\t\tbodyRng.moveToElementText(editor.getBody());\n\t\t\t\t\treturn RangeUtils.compareRanges(rng, bodyRng);\n\t\t\t\t}\n\n\t\t\t\tvar selection = serializeRng(rng);\n\n\t\t\t\tvar allRng = dom.createRng();\n\t\t\t\tallRng.selectNode(editor.getBody());\n\n\t\t\t\tvar allSelection = serializeRng(allRng);\n\t\t\t\treturn selection === allSelection;\n\t\t\t}\n\n\t\t\teditor.on('keydown', function(e) {\n\t\t\t\tvar keyCode = e.keyCode, isCollapsed, body;\n\n\t\t\t\t// Empty the editor if it's needed for example backspace at <p><b>|</b></p>\n\t\t\t\tif (!isDefaultPrevented(e) && (keyCode == DELETE || keyCode == BACKSPACE)) {\n\t\t\t\t\tisCollapsed = editor.selection.isCollapsed();\n\t\t\t\t\tbody = editor.getBody();\n\n\t\t\t\t\t// Selection is collapsed but the editor isn't empty\n\t\t\t\t\tif (isCollapsed && !dom.isEmpty(body)) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Selection isn't collapsed but not all the contents is selected\n\t\t\t\t\tif (!isCollapsed && !allContentsSelected(editor.selection.getRng())) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Manually empty the editor\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\teditor.setContent('');\n\n\t\t\t\t\tif (body.firstChild && dom.isBlock(body.firstChild)) {\n\t\t\t\t\t\teditor.selection.setCursorLocation(body.firstChild, 0);\n\t\t\t\t\t} else {\n\t\t\t\t\t\teditor.selection.setCursorLocation(body, 0);\n\t\t\t\t\t}\n\n\t\t\t\t\teditor.nodeChanged();\n\t\t\t\t}\n\t\t\t});\n\t\t}", "function emptyEditorWhenDeleting() {\n\t\t\tfunction serializeRng(rng) {\n\t\t\t\tvar body = dom.create(\"body\");\n\t\t\t\tvar contents = rng.cloneContents();\n\t\t\t\tbody.appendChild(contents);\n\t\t\t\treturn selection.serializer.serialize(body, {format: 'html'});\n\t\t\t}\n\n\t\t\tfunction allContentsSelected(rng) {\n\t\t\t\tif (!rng.setStart) {\n\t\t\t\t\tif (rng.item) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar bodyRng = rng.duplicate();\n\t\t\t\t\tbodyRng.moveToElementText(editor.getBody());\n\t\t\t\t\treturn RangeUtils.compareRanges(rng, bodyRng);\n\t\t\t\t}\n\n\t\t\t\tvar selection = serializeRng(rng);\n\n\t\t\t\tvar allRng = dom.createRng();\n\t\t\t\tallRng.selectNode(editor.getBody());\n\n\t\t\t\tvar allSelection = serializeRng(allRng);\n\t\t\t\treturn selection === allSelection;\n\t\t\t}\n\n\t\t\teditor.on('keydown', function(e) {\n\t\t\t\tvar keyCode = e.keyCode, isCollapsed, body;\n\n\t\t\t\t// Empty the editor if it's needed for example backspace at <p><b>|</b></p>\n\t\t\t\tif (!isDefaultPrevented(e) && (keyCode == DELETE || keyCode == BACKSPACE)) {\n\t\t\t\t\tisCollapsed = editor.selection.isCollapsed();\n\t\t\t\t\tbody = editor.getBody();\n\n\t\t\t\t\t// Selection is collapsed but the editor isn't empty\n\t\t\t\t\tif (isCollapsed && !dom.isEmpty(body)) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Selection isn't collapsed but not all the contents is selected\n\t\t\t\t\tif (!isCollapsed && !allContentsSelected(editor.selection.getRng())) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Manually empty the editor\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\teditor.setContent('');\n\n\t\t\t\t\tif (body.firstChild && dom.isBlock(body.firstChild)) {\n\t\t\t\t\t\teditor.selection.setCursorLocation(body.firstChild, 0);\n\t\t\t\t\t} else {\n\t\t\t\t\t\teditor.selection.setCursorLocation(body, 0);\n\t\t\t\t\t}\n\n\t\t\t\t\teditor.nodeChanged();\n\t\t\t\t}\n\t\t\t});\n\t\t}", "function emptyEditorWhenDeleting() {\n\t\t\tfunction serializeRng(rng) {\n\t\t\t\tvar body = dom.create(\"body\");\n\t\t\t\tvar contents = rng.cloneContents();\n\t\t\t\tbody.appendChild(contents);\n\t\t\t\treturn selection.serializer.serialize(body, {format: 'html'});\n\t\t\t}\n\n\t\t\tfunction allContentsSelected(rng) {\n\t\t\t\tif (!rng.setStart) {\n\t\t\t\t\tif (rng.item) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar bodyRng = rng.duplicate();\n\t\t\t\t\tbodyRng.moveToElementText(editor.getBody());\n\t\t\t\t\treturn RangeUtils.compareRanges(rng, bodyRng);\n\t\t\t\t}\n\n\t\t\t\tvar selection = serializeRng(rng);\n\n\t\t\t\tvar allRng = dom.createRng();\n\t\t\t\tallRng.selectNode(editor.getBody());\n\n\t\t\t\tvar allSelection = serializeRng(allRng);\n\t\t\t\treturn selection === allSelection;\n\t\t\t}\n\n\t\t\teditor.on('keydown', function(e) {\n\t\t\t\tvar keyCode = e.keyCode, isCollapsed, body;\n\n\t\t\t\t// Empty the editor if it's needed for example backspace at <p><b>|</b></p>\n\t\t\t\tif (!isDefaultPrevented(e) && (keyCode == DELETE || keyCode == BACKSPACE)) {\n\t\t\t\t\tisCollapsed = editor.selection.isCollapsed();\n\t\t\t\t\tbody = editor.getBody();\n\n\t\t\t\t\t// Selection is collapsed but the editor isn't empty\n\t\t\t\t\tif (isCollapsed && !dom.isEmpty(body)) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Selection isn't collapsed but not all the contents is selected\n\t\t\t\t\tif (!isCollapsed && !allContentsSelected(editor.selection.getRng())) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Manually empty the editor\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\teditor.setContent('');\n\n\t\t\t\t\tif (body.firstChild && dom.isBlock(body.firstChild)) {\n\t\t\t\t\t\teditor.selection.setCursorLocation(body.firstChild, 0);\n\t\t\t\t\t} else {\n\t\t\t\t\t\teditor.selection.setCursorLocation(body, 0);\n\t\t\t\t\t}\n\n\t\t\t\t\teditor.nodeChanged();\n\t\t\t\t}\n\t\t\t});\n\t\t}", "function removeGhostSelection() {\n\t\t\teditor.on('Undo Redo SetContent', function(e) {\n\t\t\t\tif (!e.initial) {\n\t\t\t\t\teditor.execCommand('mceRepaint');\n\t\t\t\t}\n\t\t\t});\n\t\t}", "_deleteHandler(event) {\n const that = this,\n selectionStart = that.$.input.selectionStart,\n selectionEnd = that.$.input.selectionEnd,\n key = event.key;\n\n let newSelectionStart = selectionStart;\n\n that._preventDefault(event);\n\n if (selectionStart === selectionEnd) {\n if (key === 'Backspace') {\n for (let i = selectionStart; i > 0; i--) {\n const maskItem = that._mask[i - 1];\n\n if (maskItem.type === 'mask') {\n newSelectionStart = i - 1;\n maskItem.character = '';\n break;\n }\n else {\n newSelectionStart = selectionStart - 1;\n break;\n }\n }\n }\n else {\n for (let i = selectionStart; i < that._mask.length; i++) {\n const maskItem = that._mask[i];\n\n if (maskItem.type === 'mask') {\n newSelectionStart = i + 1;\n maskItem.character = '';\n break;\n }\n else {\n newSelectionStart = selectionStart + 1;\n break;\n }\n }\n }\n }\n else {\n that._cleanMask(selectionStart, selectionEnd);\n if (key === 'Delete') {\n newSelectionStart = selectionEnd;\n }\n }\n\n that._setMaskToInput();\n that._updateMaskFullAndCompleted();\n that.value = that._getValueWithTextMaskFormat({ start: 0, end: that._mask.length }, that.textMaskFormat);\n that.$.input.selectionStart = that.$.input.selectionEnd = newSelectionStart;\n }", "insertText(editor, text) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n voids = false\n } = options;\n var {\n at = editor.selection\n } = options;\n\n if (!at) {\n return;\n }\n\n if (Path.isPath(at)) {\n at = Editor.range(editor, at);\n }\n\n if (Range.isRange(at)) {\n if (Range.isCollapsed(at)) {\n at = at.anchor;\n } else {\n var end = Range.end(at);\n\n if (!voids && Editor.void(editor, {\n at: end\n })) {\n return;\n }\n\n var pointRef = Editor.pointRef(editor, end);\n Transforms.delete(editor, {\n at,\n voids\n });\n at = pointRef.unref();\n Transforms.setSelection(editor, {\n anchor: at,\n focus: at\n });\n }\n }\n\n if (!voids && Editor.void(editor, {\n at\n })) {\n return;\n }\n\n var {\n path,\n offset\n } = at;\n if (text.length > 0) editor.apply({\n type: 'insert_text',\n path,\n offset,\n text\n });\n });\n }", "function deleteNearSelection(cm, compute) {\n\t\t var ranges = cm.doc.sel.ranges, kill = [];\n\t\t // Build up a set of ranges to kill first, merging overlapping\n\t\t // ranges.\n\t\t for (var i = 0; i < ranges.length; i++) {\n\t\t var toKill = compute(ranges[i]);\n\t\t while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n\t\t var replaced = kill.pop();\n\t\t if (cmp(replaced.from, toKill.from) < 0) {\n\t\t toKill.from = replaced.from;\n\t\t break;\n\t\t }\n\t\t }\n\t\t kill.push(toKill);\n\t\t }\n\t\t // Next, remove those actual ranges.\n\t\t runInOp(cm, function() {\n\t\t for (var i = kill.length - 1; i >= 0; i--)\n\t\t replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\");\n\t\t ensureCursorVisible(cm);\n\t\t });\n\t\t }", "function keyCommandDeleteWord(editorState) {\n\t var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n\t var selection = strategyState.getSelection();\n\t var offset = selection.getStartOffset();\n\t var key = selection.getStartKey();\n\t var content = strategyState.getCurrentContent();\n\t var text = content.getBlockForKey(key).getText().slice(offset);\n\t var toRemove = DraftRemovableWord.getForward(text);\n\n\t // If there are no words in front of the cursor, remove the newline.\n\t return moveSelectionForward(strategyState, toRemove.length || 1);\n\t }, 'forward');\n\n\t if (afterRemoval === editorState.getCurrentContent()) {\n\t return editorState;\n\t }\n\n\t return EditorState.push(editorState, afterRemoval, 'remove-range');\n\t}", "insertText(editor, text) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n voids = false\n } = options;\n var {\n at = editor.selection\n } = options;\n\n if (!at) {\n return;\n }\n\n if (Path.isPath(at)) {\n at = Editor.range(editor, at);\n }\n\n if (Range.isRange(at)) {\n if (Range.isCollapsed(at)) {\n at = at.anchor;\n } else {\n var end = Range.end(at);\n\n if (!voids && Editor.void(editor, {\n at: end\n })) {\n return;\n }\n\n var pointRef = Editor.pointRef(editor, end);\n Transforms.delete(editor, {\n at,\n voids\n });\n at = pointRef.unref();\n Transforms.setSelection(editor, {\n anchor: at,\n focus: at\n });\n }\n }\n\n if (!voids && Editor.void(editor, {\n at\n })) {\n return;\n }\n\n var {\n path,\n offset\n } = at;\n editor.apply({\n type: 'insert_text',\n path,\n offset,\n text\n });\n });\n }", "function frankerCoreGetSelectedText(doc, trim) {\n\tvar selection = doc.getSelection();\n\treturn (trim) ? frankerUtilTrimString(selection + \"\") : selection + \"\";\n}", "function deleteNearSelection(cm, compute) {\n\t\t var ranges = cm.doc.sel.ranges, kill = [];\n\t\t // Build up a set of ranges to kill first, merging overlapping\n\t\t // ranges.\n\t\t for (var i = 0; i < ranges.length; i++) {\n\t\t var toKill = compute(ranges[i]);\n\t\t while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n\t\t var replaced = kill.pop();\n\t\t if (cmp(replaced.from, toKill.from) < 0) {\n\t\t toKill.from = replaced.from;\n\t\t break\n\t\t }\n\t\t }\n\t\t kill.push(toKill);\n\t\t }\n\t\t // Next, remove those actual ranges.\n\t\t runInOp(cm, function () {\n\t\t for (var i = kill.length - 1; i >= 0; i--)\n\t\t { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\"); }\n\t\t ensureCursorVisible(cm);\n\t\t });\n\t\t }", "function getOffsetsAfterAccountingForSomeSpecialSelectionCases(allText, offsets) {\n var newOffs = oldOffs = offsets;\n \n // strip leading and trailing white space\n newOffs = getOffsetsAfterStrippingWhiteSpace(allText,newOffs[0],newOffs[1]);\n \n //remove trailing &nbsp; tag if there\n // this can happen if a user shift down-clicks and the following line\n // is empty; dw expands the selection to include the \"<p>nbsp;\"\n // on the next line\n var selStr = allText.substring(newOffs[0],newOffs[1]);\n var chunk = \"&nbsp;\";\n var chunkPos = selStr.lastIndexOf(chunk);\n if (chunkPos!=-1 && chunkPos == (selStr.length - chunk.length)) \n newOffs[1] -= chunk.length;\n\n // remove last tag if it is an opening block tag\n // this can happen if a user shift down-clicks; dw selects the\n // opening block tag on the next paragraph, resulting in a selection like:\n // <p>|some text</p>\n // <p>|more text</p>\n selStr = allText.substring(newOffs[0], newOffs[1]);\n var pattern = /<([^>]*)>$/;\n var result = selStr.match(pattern);\n if (result != null){\n if ( isAContainerTag(result[1]) ){\n newOffs[1] -= result[0].length;\n }\n }\n\n // if selection starts with a closing block tag, remove it\n // this can happen if a user puts the mouse at the end of a line and\n // presses shift-up-arrow to select it\n selStr = allText.substring(newOffs[0],newOffs[1]);\n pattern = /^<\\/([^>]*)>/;\n result = selStr.match(pattern);\n if (result != null){\n if ( isAContainerTag(result[1]) ){\n newOffs[0] += result[0].length;\n }\n }\n\n // strip leading and trailing white space if offsets have changed\n if (newOffs != oldOffs){\n newOffs = getOffsetsAfterStrippingWhiteSpace(allText,newOffs[0],newOffs[1]);\n oldOffs = newOffs;\n }\n\n // account for special list case: selecting the first item in a list\n // can select the opening <ol> or <ul> as well. Strip it.\n newOffs = getOffsetsAfterListCheck(allText,newOffs[0],newOffs[1]);\n\n // strip leading and trailing white space if offsets have changed\n if (newOffs != oldOffs){\n newOffs = getOffsetsAfterStrippingWhiteSpace(allText,newOffs[0],newOffs[1]);\n }\n \n return newOffs;\n\n}", "function removeD_text(){\r\n d_text.destroy();\r\n}", "selectContent(textPosition, clearMultiSelection) {\n if (isNullOrUndefined(textPosition)) {\n throw new Error('textPosition is undefined.');\n }\n this.start.setPositionInternal(textPosition);\n this.end.setPositionInternal(textPosition);\n this.upDownSelectionLength = this.end.location.x;\n this.fireSelectionChanged(true);\n }", "function deleteAndRaiseFN() {\n let sel = $('#' + $('.selected').attr('id'));\n let pos = sel.offset();\n let subTree = sel.detach();\n $('#' + sel.attr('line-target')).remove();\n subTree.appendTo('body');\n sel.css({\n 'top' : pos.top,\n 'left' : pos.left\n });\n calc_all_lines('#' + sel.attr('id'));\n }", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = []\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i])\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop()\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from\n break\n }\n }\n kill.push(toKill)\n }\n // Next, remove those actual ranges.\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\") }\n ensureCursorVisible(cm)\n })\n}", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = []\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i])\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop()\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from\n break\n }\n }\n kill.push(toKill)\n }\n // Next, remove those actual ranges.\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\") }\n ensureCursorVisible(cm)\n })\n}", "function emptyEditorOnDeleteEverything() {\n\t\t\tfunction isEverythingSelected(editor) {\n\t\t\t\tvar caretWalker = new CaretWalker(editor.getBody());\n\t\t\t\tvar rng = editor.selection.getRng();\n\t\t\t\tvar startCaretPos = CaretPosition.fromRangeStart(rng);\n\t\t\t\tvar endCaretPos = CaretPosition.fromRangeEnd(rng);\n\t\t\t\tvar prev = caretWalker.prev(startCaretPos);\n\t\t\t\tvar next = caretWalker.next(endCaretPos);\n\n\t\t\t\treturn !editor.selection.isCollapsed() &&\n\t\t\t\t\t(!prev || (prev.isAtStart() && startCaretPos.isEqual(prev))) &&\n\t\t\t\t\t(!next || (next.isAtEnd() && startCaretPos.isEqual(next)));\n\t\t\t}\n\n\t\t\t// Type over case delete and insert this won't cover typeover with a IME but at least it covers the common case\n\t\t\teditor.on('keypress', function (e) {\n\t\t\t\tif (!isDefaultPrevented(e) && !selection.isCollapsed() && e.charCode > 31 && !VK.metaKeyPressed(e)) {\n\t\t\t\t\tif (isEverythingSelected(editor)) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\teditor.setContent(String.fromCharCode(e.charCode));\n\t\t\t\t\t\teditor.selection.select(editor.getBody(), true);\n\t\t\t\t\t\teditor.selection.collapse(false);\n\t\t\t\t\t\teditor.nodeChanged();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\teditor.on('keydown', function (e) {\n\t\t\t\tvar keyCode = e.keyCode;\n\n\t\t\t\tif (!isDefaultPrevented(e) && (keyCode == DELETE || keyCode == BACKSPACE)) {\n\t\t\t\t\tif (isEverythingSelected(editor)) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\teditor.setContent('');\n\t\t\t\t\t\teditor.nodeChanged();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}", "doTextOperation(){let root=this,selection=root.selection;if(root.toggled&&null!==root.toggledCommand){document.execCommand(root.toggledCommand,!1,root.toggledCommand||\"\")}else if(null!==root.command){root.dispatchEvent(new CustomEvent(root.command+\"-button\",{bubbles:!0,cancelable:!0,composed:!0,detail:root}));document.execCommand(root.command,!1,root.commandVal||\"\");root.selection=selection}}", "deleteRow() {\n if (this.owner.isReadOnlyMode) {\n return;\n }\n let startPos = !this.selection.isForward ? this.selection.end : this.selection.start;\n let endPos = !this.selection.isForward ? this.selection.start : this.selection.end;\n if (startPos.paragraph.isInsideTable) {\n let startCell = this.getOwnerCell(this.selection.isForward);\n let endCell = this.getOwnerCell(!this.selection.isForward);\n if (this.checkIsNotRedoing()) {\n this.initHistory('DeleteRow');\n }\n this.selection.owner.isShiftingEnabled = true;\n let table = startCell.ownerTable.combineWidget(this.viewer);\n let row = this.getOwnerRow(true);\n if (this.editorHistory && this.editorHistory.currentBaseHistoryInfo) {\n this.cloneTableToHistoryInfo(table);\n }\n let paragraph = undefined;\n if (row.nextWidget) {\n let nextCell = row.nextWidget.childWidgets[0];\n paragraph = this.selection.getFirstParagraph(nextCell);\n }\n if (isNullOrUndefined(paragraph)) {\n paragraph = this.getParagraphForSelection(table);\n }\n if (!this.selection.isEmpty) {\n //tslint:disable-next-line:max-line-length\n let containerCell = this.selection.getContainerCellOf(startCell, endCell);\n if (containerCell.ownerTable.contains(endCell)) {\n startCell = this.selection.getSelectedCell(startCell, containerCell);\n endCell = this.selection.getSelectedCell(endCell, containerCell);\n if (this.selection.containsCell(containerCell, endCell)) {\n row = startCell.ownerRow;\n this.removeRow(row);\n }\n else {\n row = startCell.ownerRow;\n let endRow = endCell.ownerRow;\n //Update the selection paragraph.\n paragraph = undefined;\n if (endRow.nextWidget) {\n let nextCell = endRow.nextWidget.childWidgets[0];\n paragraph = this.selection.getFirstParagraph(nextCell);\n }\n if (isNullOrUndefined(paragraph)) {\n paragraph = this.getParagraphForSelection(table);\n }\n for (let i = 0; i < table.childWidgets.length; i++) {\n let tableRow = table.childWidgets[i];\n if (tableRow.rowIndex >= row.rowIndex && tableRow.rowIndex <= endRow.rowIndex) {\n table.childWidgets.splice(i, 1);\n tableRow.destroy();\n i--;\n }\n }\n if (table.childWidgets.length === 0) {\n this.removeBlock(table);\n if (this.editorHistory && this.editorHistory.currentBaseHistoryInfo) {\n this.editorHistory.currentBaseHistoryInfo.action = 'DeleteTable';\n }\n table.destroy();\n }\n else {\n this.updateTable(table);\n }\n }\n }\n }\n else {\n this.removeRow(row);\n }\n this.selection.selectParagraphInternal(paragraph, true);\n if (isNullOrUndefined(this.editorHistory) || this.checkIsNotRedoing()) {\n this.reLayout(this.selection, true);\n }\n }\n }", "function selectedText() {\n var selection = '';\n if (window.getSelection) {\n selection = window.getSelection();\n } else if (document.selection) { // Opera\n selection = document.selection.createRange();\n }\n if (selection.text) {\n selection = selection.text;\n } else if (selection.toString) {\n selection = selection.toString();\n }\n return selection;\n }", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break;\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function() {\n for (var i = kill.length - 1; i >= 0; i--)\n replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\");\n ensureCursorVisible(cm);\n });\n }", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break;\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function() {\n for (var i = kill.length - 1; i >= 0; i--)\n replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\");\n ensureCursorVisible(cm);\n });\n }", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break;\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function() {\n for (var i = kill.length - 1; i >= 0; i--)\n replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\");\n ensureCursorVisible(cm);\n });\n }", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break;\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function() {\n for (var i = kill.length - 1; i >= 0; i--)\n replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\");\n ensureCursorVisible(cm);\n });\n }", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break;\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function() {\n for (var i = kill.length - 1; i >= 0; i--)\n replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\");\n ensureCursorVisible(cm);\n });\n }", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break;\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function() {\n for (var i = kill.length - 1; i >= 0; i--)\n replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\");\n ensureCursorVisible(cm);\n });\n }", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break;\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function() {\n for (var i = kill.length - 1; i >= 0; i--)\n replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\");\n ensureCursorVisible(cm);\n });\n }", "function untagSelectedText( fTag, fAttrs, ld, rd, fDirectEditing) {\r\n var input = self.el;\r\n /* internet explorer */\r\n if( typeof document.selection != 'undefined') {\r\n var range = document.selection.createRange();\r\n var selText = range.text;\r\n /* für Direct-Editing */\r\n if ( fDirectEditing) {\r\n var inpValue = input.value;\r\n /* Preceding selected text */\r\n var fullText = untag( inpValue);\r\n var aRange = range.duplicate();\r\n while ( fullText.indexOf( aRange.text) != 0)\r\n aRange.moveStart( 'word', -1);\r\n aRange.moveEnd( 'word', -1);\r\n /* Find Preceding selected text in raw-html of input */\r\n var start = taggedStart( inpValue, aRange.text);\r\n while ( inpValue.charAt( start) == ' ')\r\n start++;\r\n var aTag = ld+fTag+rd;\r\n var eTag = ld+'/'+fTag+rd;\r\n var taggedText = selText;\r\n /* Strip trailing blanks */\r\n while ( taggedText.length > 0 && taggedText.charAt( taggedText.length - 1) == ' ') {\r\n taggedText = taggedText.substr( 0, taggedText.length - 1);\r\n eTag += ' ';\r\n }\r\n /* Apply value */\r\n if ( inpValue.substr( start).indexOf( aTag + taggedText + eTag) == 0 ||\r\n inpValue.substr( start).indexOf( aTag.toUpperCase() + taggedText + eTag.toUpperCase()) == 0 ) {\r\n input.value = inpValue.substr( 0, start) + selText + inpValue.substr( start + (aTag + taggedText + eTag).length);\r\n return true;\r\n }\r\n }\r\n else {\r\n var startTag = ld+fTag;\r\n var endTag = ld+'/'+fTag+rd;\r\n if ( selText.indexOf(startTag) == 0 && selText.lastIndexOf(endTag) == selText.length - endTag.length) {\r\n selText = selText.substr( startTag.length + 1, selText.lastIndexOf( endTag) - startTag.length - 1); \r\n /* Apply value */\r\n range.text = selText;\r\n return true;\r\n }\r\n else {\r\n range.moveStart('character', -(startTag.length+1));\r\n range.moveEnd('character', endTag.length);\r\n var taggedText = range.text;\r\n if ( taggedText.indexOf(startTag) == 0 && taggedText.lastIndexOf(endTag) == taggedText.length - endTag.length) {\r\n /* Apply value */\r\n range.text = selText;\r\n return true;\r\n }\r\n else if ( fAttrs.length > 0) {\r\n startTag += fAttrs;\r\n range.moveStart('character', -fAttrs.length);\r\n var taggedText = range.text;\r\n if ( taggedText.indexOf(startTag) == 0 && taggedText.lastIndexOf(endTag) == taggedText.length - endTag.length) {\r\n /* Apply value */\r\n range.text = selText;\r\n return true;\r\n }\r\n }\r\n } \r\n }\r\n }\r\n /* newer gecko-based browsers */\r\n else if( typeof input.selectionStart != 'undefined') {\r\n var start = self.selectionStart;\r\n var end = self.selectionEnd;\r\n var inpValue = input.value;\r\n var selText = inpValue.substring( start, end);\r\n var tagStart = inpValue.substr( 0, start);\r\n var i = tagStart.length;\r\n var c = tagStart.charAt( i - 1);\r\n if ( c == '>') {\r\n /* Handle DTML in a.href */\r\n i--;\r\n var l = 1;\r\n while ( l > 0 && i > 0) {\r\n c = tagStart.charAt( i - 1);\r\n if ( c == rd)\r\n l++;\r\n if ( c == ld)\r\n l--;\r\n i--;\r\n }\r\n if ( i >= 0) {\r\n var tag = tagStart.substr( i);\r\n tagStart = tagStart.substr( 0, i);\r\n if ( tag.indexOf(ld+fTag) == 0 && tag.indexOf(rd) > 0) {\r\n var tagEnd = inpValue.substr( end);\r\n if ( tagEnd.indexOf(rd) > 0) {\r\n var tag = tagEnd.substr( 0, tagEnd.indexOf(rd) + 1);\r\n tagEnd = tagEnd.substr( tagEnd.indexOf(rd) + 1);\r\n if ( tag.indexOf(ld+'/'+fTag+rd) == 0) {\r\n input.value = tagStart + selText + tagEnd;\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n}", "function removeSelectionHighlight() {\r\n hideSelectionRect();\r\n hideRotIndicator();\r\n }", "function sanitizeWithSelection(o) {\n var startCaretPos = getSelectionStart(o),\n endCaretPos = getSelectionEnd(o),\n temp = \"\",\n testPlusChar = \"\",\n selectionCharInfo = [];\n \n //records selection information for each char\n for (i=0;i<o.value.length;i++) {\n if (startCaretPos > i){\n selectionCharInfo[i] = 'beforeSelection';\n } else if ((startCaretPos <= i) && (endCaretPos > i)) {\n selectionCharInfo[i] = 'inSelection';\n } //note: if a char after the selection is invalid the selection would not change if that char is removed...\n }\n \n for (i=0;i<o.value.length;i++) {\n var iPlusOne = i + 1;\n testPlusChar += o.value.substring(i,iPlusOne);\n if ((!regExpression.test(testPlusChar))) {\n var lastChar = testPlusChar.length-1;\n temp = testPlusChar.substring(0,lastChar);\n testPlusChar = temp;\n if (selectionCharInfo[i] == 'beforeSelection'){\n startCaretPos = startCaretPos - 1;\n endCaretPos = endCaretPos - 1;\n } else if (selectionCharInfo[i] == 'inSelection'){\n endCaretPos = endCaretPos - 1;\n }\n }\n }\n o.value = testPlusChar;\n setSelectionRange (o,startCaretPos,endCaretPos);\n }", "function deleteNearSelection(cm, compute) {\r\n var ranges = cm.doc.sel.ranges, kill = [];\r\n // Build up a set of ranges to kill first, merging overlapping\r\n // ranges.\r\n for (var i = 0; i < ranges.length; i++) {\r\n var toKill = compute(ranges[i]);\r\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\r\n var replaced = kill.pop();\r\n if (cmp(replaced.from, toKill.from) < 0) {\r\n toKill.from = replaced.from;\r\n break;\r\n }\r\n }\r\n kill.push(toKill);\r\n }\r\n // Next, remove those actual ranges.\r\n runInOp(cm, function() {\r\n for (var i = kill.length - 1; i >= 0; i--)\r\n replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\");\r\n ensureCursorVisible(cm);\r\n });\r\n }", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\"); }\n ensureCursorVisible(cm);\n });\n}", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\"); }\n ensureCursorVisible(cm);\n });\n}", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\"); }\n ensureCursorVisible(cm);\n });\n}", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\"); }\n ensureCursorVisible(cm);\n });\n}", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\"); }\n ensureCursorVisible(cm);\n });\n}", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\"); }\n ensureCursorVisible(cm);\n });\n}", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\"); }\n ensureCursorVisible(cm);\n });\n}", "function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\"); }\n ensureCursorVisible(cm);\n });\n}" ]
[ "0.7447715", "0.7392373", "0.70983833", "0.70505744", "0.69707197", "0.69394445", "0.69200784", "0.6823771", "0.6810343", "0.68008053", "0.6721571", "0.67189825", "0.67189825", "0.67189825", "0.67189825", "0.67189825", "0.67189825", "0.67189825", "0.67189825", "0.67189825", "0.6686755", "0.6651526", "0.6650927", "0.65999895", "0.6560191", "0.6516659", "0.64943427", "0.64340925", "0.64271235", "0.6380984", "0.63465786", "0.6326525", "0.63165396", "0.63098", "0.63090146", "0.6283895", "0.627222", "0.6147761", "0.61328286", "0.6120875", "0.6073965", "0.6049954", "0.6030814", "0.5999346", "0.5956187", "0.5956187", "0.5956187", "0.5937635", "0.5915692", "0.590277", "0.5901066", "0.5888536", "0.58790886", "0.58697546", "0.58680415", "0.5859272", "0.5854888", "0.584686", "0.5827508", "0.5824178", "0.5824178", "0.58213717", "0.58182436", "0.5811151", "0.57977456", "0.57959014", "0.57959014", "0.57959014", "0.57959014", "0.57959014", "0.57959014", "0.57959014", "0.5795822", "0.5783985", "0.5781972", "0.57782346", "0.57724386", "0.57724386", "0.57724386", "0.57724386", "0.57724386", "0.57724386", "0.57724386", "0.57724386" ]
0.577363
91
Run a handler that was bound to a key.
function doHandleBinding(cm, bound, dropShift) { if (typeof bound == "string") { bound = commands[bound]; if (!bound) { return false } } // Ensure previous input has been read, so that the handler sees a // consistent view of the document cm.display.input.ensurePolled(); var prevShift = cm.display.shift, done = false; try { if (cm.isReadOnly()) { cm.state.suppressEdits = true; } if (dropShift) { cm.display.shift = false; } done = bound(cm) != Pass; } finally { cm.display.shift = prevShift; cm.state.suppressEdits = false; } return done }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getBindingHandler (/* key */) {}", "function receive(key, handler) {\n pxsim.board().bus.listen(key, 0x1, handler);\n }", "function bind(key, action) {\r\n bindings[key] = action; \r\n\r\n}", "function listen(key, callback) {\n handlers[key] = callback;\n}", "function handleCb(key, payload) {\n if (key && callbacks[key])\n callbacks[key](payload);\n }", "function runHandler() {\r\n var trigger, triggerName, paras;\r\n if(arguments.length > 0){\r\n triggerName = arguments[0];\r\n [].splice.call(arguments, 0, 1);\r\n paras = arguments;\r\n }else{\r\n return;\r\n }\r\n trigger = this._triggerHandlers[triggerName];\r\n if(trigger){\r\n trigger.forEach(function(fn, idx){\r\n fn.apply(this, paras); \r\n }); \r\n }\r\n }", "static BindKey(key, callback, key_reset = false) {\n key = key.toLowerCase()\n if (!this._keybindings) this._keybindings = []\n // add key if not alrady bound\n if (!this._keybindings.map(bind => bind.key).includes(key))\n this._keybindings.push({key: key, actions: [], key_reset: key_reset})\n // bind callback to key\n const binding = this._keybindings.find(bind => bind.key == key)\n if (!binding.actions.includes(callback)) binding.actions.push(callback)\n }", "function _processKey(event, bindings) {\n\t\t\tfor (var id in bindings) {\n\t\t\t\tif (bindings[id] && bindings[id].keyBinding && bindings[id].command) {\n\t\t\t\t\tif (bindings[id].keyBinding.match(event)) {\n\t\t\t\t\t\tvar activeBinding = bindings[id];\n\t\t\t\t\t\tvar keyBinding = activeBinding.keyBinding;\n\t\t\t\t\t\t// Check for keys that are scoped to a particular part of the DOM\n\t\t\t\t\t\tif (!keyBinding.domScope || lib.contains(lib.node(keyBinding.domScope), event.target)) {\n\t\t\t\t\t\t\tif (executeBinding(activeBinding)) {\n\t\t\t\t\t\t\t\tlib.stop(event);\n\t\t\t\t\t\t\t\treturn;\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}\n\t\t\t}\n\t\t}", "static eventCallback(fullKey, handler, zone) {\n return (event /** TODO #9100 */) => {\n if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {\n zone.runGuarded(() => handler(event));\n }\n };\n }", "static eventCallback(fullKey, handler, zone) {\n return (event /** TODO #9100 */) => {\n if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {\n zone.runGuarded(() => handler(event));\n }\n };\n }", "static eventCallback(fullKey, handler, zone) {\n return (event /** TODO #9100 */) => {\n if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {\n zone.runGuarded(() => handler(event));\n }\n };\n }", "static eventCallback(fullKey, handler, zone) {\n return (event /** TODO #9100 */) => {\n if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {\n zone.runGuarded(() => handler(event));\n }\n };\n }", "static eventCallback(fullKey, handler, zone) {\n return (event /** TODO #9100 */) => {\n if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {\n zone.runGuarded(() => handler(event));\n }\n };\n }", "static eventCallback(fullKey, handler, zone) {\n return (event\n /** TODO #9100 */\n ) => {\n if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {\n zone.runGuarded(() => handler(event));\n }\n };\n }", "* processBinding (key, value) {\n // Get the \"on\" binding from \"on.click\"\n const [handlerName, property] = key.split('.')\n const handler = this.bindingHandlers.get(handlerName)\n\n if (handler && handler.preprocess) {\n const bindingsAddedByHandler = []\n const chainFn = (...args) => bindingsAddedByHandler.push(args)\n value = handler.preprocess(value, key, chainFn)\n for (const [key, value] of bindingsAddedByHandler) {\n yield * this.processBinding(key, value)\n }\n } else if (property) {\n value = `{${property}:${value}}`\n }\n\n yield `${handlerName}:${value}`\n }", "* processBinding (key, value) {\n // Get the \"on\" binding from \"on.click\"\n const [handlerName, property] = key.split('.');\n const handler = this.bindingHandlers.get(handlerName);\n\n if (handler && handler.preprocess) {\n const bindingsAddedByHandler = [];\n const chainFn = (...args) => bindingsAddedByHandler.push(args);\n value = handler.preprocess(value, key, chainFn);\n for (const [key, value] of bindingsAddedByHandler) {\n yield * this.processBinding(key, value);\n }\n } else if (property) {\n value = `{${property}:${value}}`;\n }\n\n yield `'${handlerName}':${value}`;\n }", "function keyPressed() {\n if (handler.active === handler.nameplate) {\n doorbell.keyPressed();\n }\n}", "bindKeyHandlers() {\n const tank = this.tank;\n\n Object.keys(GameView.MOVES).forEach((k) => {\n const moves = GameView.MOVES[k];\n\n key(k, () => { \n this.gun.pos = [tank.pos[0] + moves[0], tank.pos[1]];\n tank.pos = [tank.pos[0] + moves[0], tank.pos[1]];\n });\n });\n\n key(\"space\", () => { tank.fireBullets() });\n }", "emit(key, name, event) {\n\t\tif (!this.keyPool[key]) return\n\t\tthis.keyPool[key](name, event)\n\t}", "function keyBinding() {\n\n $(document).keydown(function (e) {\n that.snake.changeDirection(e.which);\n });\n }", "function BindAndRun() {\r\n}", "function bindCommand(options)\n{\n KeyMap.clear();\n\n $.each($.extend(true, {}, options.default_key_bind, options.key_bind), function(map, bind) {\n $.each(bind, function(key, command) {\n KeyMap[map](key, command);\n });\n });\n}", "function keyEventAttacher(handler){\r\n\t\treturn function(event){\r\n\t\t\tvar node = event.target;\r\n\t\t\t\r\n\t\t\tif(isUsableNode(node))\r\n\t\t\t\thandler.call(node, event);\t\t\t\r\n\t\t};\r\n\t}", "function handler() {\n\t\treturn function () {\n\t\t\tself.handler.apply(self, arguments);\n\t\t};\n\t}", "function registerHandler (handler) {\n app[handler.method]( handler.path, handler.func() );\n }", "function eventHandler(e, fnmap) {\n if (/^key/.test(e.type)) {\n var state = analyzeEvent(e);\n if (state.changed) {\n if (state.on) {\n if (fnmap.capsLockOn) fnmap.capsLockOn();\n } else {\n if (fnmap.capsLockOff) fnmap.capsLockOff();\n }\n }\n } else if (fnmap[e.type]) {\n fnmap[e.type]( capsLockCore.isCapsLockOn() );\n }\n }", "handleKeyDown(kCode) {\n console.log(\"handleKeyDown \" + this.id + \" \" + kCode)\n }", "function fn(e) {\n e.preventDefault();\n self.log(key, 'has been pressed:', cmd.desc);\n return cmd.fn(e);\n }", "_addKeyHandler() {\n // Keyboard.addKeyHandlers...\n }", "function registerKeyHandler(dos_code, fun) {\n if (dos_code.charCodeAt != undefined) dos_code = dos_code.charCodeAt(0);\n keyHandlers_[dos_code] = fun;\n}", "function handleKeyPress({ key }) {\n dispatch(playerTyped(key.toLowerCase()));\n }", "function assignKey(key, scope, method){\n\t var keys, mods;\n\t keys = getKeys(key);\n\t if (method === undefined) {\n\t method = scope;\n\t scope = 'all';\n\t }\n\t\n\t // for each shortcut\n\t for (var i = 0; i < keys.length; i++) {\n\t // set modifier keys if any\n\t mods = [];\n\t key = keys[i].split('+');\n\t if (key.length > 1){\n\t mods = getMods(key);\n\t key = [key[key.length-1]];\n\t }\n\t // convert to keycode and...\n\t key = key[0]\n\t key = code(key);\n\t // ...store handler\n\t if (!(key in _handlers)) _handlers[key] = [];\n\t _handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });\n\t }\n\t }", "function assignKey(key, scope, method){\n\t var keys, mods;\n\t keys = getKeys(key);\n\t if (method === undefined) {\n\t method = scope;\n\t scope = 'all';\n\t }\n\t\n\t // for each shortcut\n\t for (var i = 0; i < keys.length; i++) {\n\t // set modifier keys if any\n\t mods = [];\n\t key = keys[i].split('+');\n\t if (key.length > 1){\n\t mods = getMods(key);\n\t key = [key[key.length-1]];\n\t }\n\t // convert to keycode and...\n\t key = key[0]\n\t key = code(key);\n\t // ...store handler\n\t if (!(key in _handlers)) _handlers[key] = [];\n\t _handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });\n\t }\n\t }", "function runHandlers(handlerEvent, event) {\n var handler;\n for (var name in HANDLERS) {\n handler = HANDLERS[name];\n if( handler instanceof $$MdGestureHandler ) {\n\n if (handlerEvent === 'start') {\n // Run cancel to reset any handlers' state\n handler.cancel();\n }\n handler[handlerEvent](event, pointer);\n\n }\n }\n }", "function SetKeyHandler(event)\n{\n var key = event.charCode || event.keyCode || 0;\n var page = GetState(\"page\");\n \n switch(page)\n {\n case \"movies\" : SetMainKeyHandler(key, event);\n break;\n \n case \"tvshows\": SetMainKeyHandler(key, event);\n break;\n \n case \"music\" : SetMainKeyHandler(key, event);\n break; \n \n case \"system\" : SetSystemKeyHandler(key, event);\n break; \n \n case \"popup\" : SetPopupKeyHandler(key);\n break;\n }\n}", "function runHandlers(handlerEvent,event){var handler;for(var name in HANDLERS){handler=HANDLERS[name];if(handler instanceof $$MdGestureHandler){if(handlerEvent==='start'){// Run cancel to reset any handlers' state\n\thandler.cancel();}handler[handlerEvent](event,pointer);}}}", "function bind(eventName, handler) {\n\t\t\t_this.on(eventName, handler);\n\t\t\tbindTuples.push([ eventName, handler ]);\n\t\t}", "function bind(eventName, handler) {\n\t\t\t_this.on(eventName, handler);\n\t\t\tbindTuples.push([ eventName, handler ]);\n\t\t}", "function bind(eventName, handler) {\n\t\t\t_this.on(eventName, handler);\n\t\t\tbindTuples.push([ eventName, handler ]);\n\t\t}", "function bind(eventName, handler) {\n\t\t\t_this.on(eventName, handler);\n\t\t\tbindTuples.push([ eventName, handler ]);\n\t\t}", "_keypressHandler(chunk, key)\n\t\t{\n\t\t\tif(key)\n\t\t\t{\n\t\t\t\tif(key.name == \"return\")\n\t\t\t\t{\n\t\t\t\t\tSCli.log(\"\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif((key.ctrl && key.name == \"c\") || (key.name == \"escape\"))\n\t\t\t\t{\n\t\t\t\t\tSCli.log(\"Monitoring stopped.\");\n\t\t\t\t\tprocess.exit();\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function handleKeyBinding(cm, e) {\n\t\t var name = keyName(e, true);\n\t\t if (!name) return false;\n\t\t\n\t\t if (e.shiftKey && !cm.state.keySeq) {\n\t\t // First try to resolve full name (including 'Shift-'). Failing\n\t\t // that, see if there is a cursor-motion command (starting with\n\t\t // 'go') bound to the keyname without 'Shift-'.\n\t\t return dispatchKey(cm, \"Shift-\" + name, e, function(b) {return doHandleBinding(cm, b, true);})\n\t\t || dispatchKey(cm, name, e, function(b) {\n\t\t if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion)\n\t\t return doHandleBinding(cm, b);\n\t\t });\n\t\t } else {\n\t\t return dispatchKey(cm, name, e, function(b) { return doHandleBinding(cm, b); });\n\t\t }\n\t\t }", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "bind(key) {\n const binding = new binding_1.Binding(key.toString());\n this.add(binding);\n return binding;\n }", "function runHandlers(handlerEvent, event) {\n var handler;\n for (var name in HANDLERS) {\n handler = HANDLERS[name];\n if( handler instanceof $$MdGestureHandler ) {\n\n if (handlerEvent === 'start') {\n // Run cancel to reset any handlers' state\n handler.cancel();\n }\n handler[handlerEvent](event, pointer);\n\n }\n }\n }", "function runHandlers(handlerEvent, event) {\n var handler;\n for (var name in HANDLERS) {\n handler = HANDLERS[name];\n if( handler instanceof $$MdGestureHandler ) {\n\n if (handlerEvent === 'start') {\n // Run cancel to reset any handlers' state\n handler.cancel();\n }\n handler[handlerEvent](event, pointer);\n\n }\n }\n }", "function runHandlers(handlerEvent, event) {\n var handler;\n for (var name in HANDLERS) {\n handler = HANDLERS[name];\n if (handler instanceof $$MdGestureHandler) {\n\n if (handlerEvent === 'start') {\n // Run cancel to reset any handlers' state\n handler.cancel();\n }\n handler[handlerEvent](event, pointer);\n\n }\n }\n }", "function runHandlers(handlerEvent, event) {\n var handler;\n for (var name in HANDLERS) {\n handler = HANDLERS[name];\n if( handler instanceof $$MdGestureHandler ) {\n\n if (handlerEvent === 'start') {\n // Run cancel to reset any handlers' state\n handler.cancel();\n }\n handler[handlerEvent](event, pointer);\n\n }\n }\n }", "function bindKey(event) {\n\t\t//index of keybind that contains the selected key (for conflicts)\n\t\tlet i = CS.keyBinds.findIndex(item => item[1] === event.keyCode || item[2] === event.key)\n\t\t//index of keybind that contains the selected function\n\t\tlet j = CS.keyBinds.findIndex(item => item[0] === ctrl.key2bind.action)\n\n\t\t//key is unchanged, do nothing\n\t\tif(i > -1 && i === j) {\n\t\t\tCS.popup = false;\n\t\t\tCS.keyBinding = false;\n\t\t}\n\t\t//key is in conflict\n\t\telse if(i > -1) {\n\t\t\tlet msg = 'Konflikt, stiskněte jinou klávesu.';\n\t\t\t(CS.popup.lines.slice(-1)[0] !== msg) && CS.popup.lines.push(msg);\n\t\t}\n\t\t//set the new key\n\t\telse {\n\t\t\tCS.keyBinds[j][1] = event.keyCode;\n\t\t\tCS.keyBinds[j][2] = event.key;\n\t\t\tCS.popup = false;\n\t\t\tCS.keyBinding = false;\n\t\t\tpopup('OK', true, 600);\n\t\t}\n\t}", "function handleKeyBinding(cm, e) {\n\t\t var name = keyName(e, true);\n\t\t if (!name) { return false }\n\n\t\t if (e.shiftKey && !cm.state.keySeq) {\n\t\t // First try to resolve full name (including 'Shift-'). Failing\n\t\t // that, see if there is a cursor-motion command (starting with\n\t\t // 'go') bound to the keyname without 'Shift-'.\n\t\t return dispatchKey(cm, \"Shift-\" + name, e, function (b) { return doHandleBinding(cm, b, true); })\n\t\t || dispatchKey(cm, name, e, function (b) {\n\t\t if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion)\n\t\t { return doHandleBinding(cm, b) }\n\t\t })\n\t\t } else {\n\t\t return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })\n\t\t }\n\t\t }", "function assignKey(key, scope, method){\n var keys, mods;\n keys = getKeys(key);\n if (method === undefined) {\n method = scope;\n scope = 'all';\n }\n\n // for each shortcut\n for (var i = 0; i < keys.length; i++) {\n // set modifier keys if any\n mods = [];\n key = keys[i].split('+');\n if (key.length > 1){\n mods = getMods(key);\n key = [key[key.length-1]];\n }\n // convert to keycode and...\n key = key[0]\n key = code(key);\n // ...store handler\n if (!(key in _handlers)) _handlers[key] = [];\n _handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });\n }\n }", "function assignKey(key, scope, method){\n var keys, mods;\n keys = getKeys(key);\n if (method === undefined) {\n method = scope;\n scope = 'all';\n }\n\n // for each shortcut\n for (var i = 0; i < keys.length; i++) {\n // set modifier keys if any\n mods = [];\n key = keys[i].split('+');\n if (key.length > 1){\n mods = getMods(key);\n key = [key[key.length-1]];\n }\n // convert to keycode and...\n key = key[0]\n key = code(key);\n // ...store handler\n if (!(key in _handlers)) _handlers[key] = [];\n _handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });\n }\n }", "function assignKey(key, scope, method){\n var keys, mods;\n keys = getKeys(key);\n if (method === undefined) {\n method = scope;\n scope = 'all';\n }\n\n // for each shortcut\n for (var i = 0; i < keys.length; i++) {\n // set modifier keys if any\n mods = [];\n key = keys[i].split('+');\n if (key.length > 1){\n mods = getMods(key);\n key = [key[key.length-1]];\n }\n // convert to keycode and...\n key = key[0]\n key = code(key);\n // ...store handler\n if (!(key in _handlers)) _handlers[key] = [];\n _handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });\n }\n }", "function assignKey(key, scope, method){\n var keys, mods;\n keys = getKeys(key);\n if (method === undefined) {\n method = scope;\n scope = 'all';\n }\n\n // for each shortcut\n for (var i = 0; i < keys.length; i++) {\n // set modifier keys if any\n mods = [];\n key = keys[i].split('+');\n if (key.length > 1){\n mods = getMods(key);\n key = [key[key.length-1]];\n }\n // convert to keycode and...\n key = key[0]\n key = code(key);\n // ...store handler\n if (!(key in _handlers)) _handlers[key] = [];\n _handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });\n }\n }", "function assignKey(key, scope, method){\r\n var keys, mods;\r\n keys = getKeys(key);\r\n if (method === undefined) {\r\n method = scope;\r\n scope = 'all';\r\n }\r\n \r\n // for each shortcut\r\n for (var i = 0; i < keys.length; i++) {\r\n // set modifier keys if any\r\n mods = [];\r\n key = keys[i].split('+');\r\n if (key.length > 1){\r\n mods = getMods(key);\r\n key = [key[key.length-1]];\r\n }\r\n // convert to keycode and...\r\n key = key[0]\r\n key = code(key);\r\n // ...store handler\r\n if (!(key in _handlers)) _handlers[key] = [];\r\n _handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });\r\n }\r\n }", "function handleCharBinding(cm, e, ch) {\n\t\t return dispatchKey(cm, \"'\" + ch + \"'\", e, function (b) { return doHandleBinding(cm, b, true); })\n\t\t }", "function _handler(){\r\n\t\tvar tool = touchstate || state;\r\n\t\ttools[tool]();\r\n\t}", "function executeKey(key) {\n if (keyIsDisabled(key)) return; // Do not execute if key is disabled (e.g. decimal)\n const type = keys[keyIndexByKey(key)].type;\n\n switch (type) {\n case \"number\":\n executeNumber(key);\n break;\n case \"operator\":\n executeOperator(key);\n break;\n case \"command\":\n executeCommand(key);\n break;\n }\n}", "function doHandleBinding(cm, bound, dropShift) {\n\t\t if (typeof bound == \"string\") {\n\t\t bound = commands[bound];\n\t\t if (!bound) return false;\n\t\t }\n\t\t // Ensure previous input has been read, so that the handler sees a\n\t\t // consistent view of the document\n\t\t cm.display.input.ensurePolled();\n\t\t var prevShift = cm.display.shift, done = false;\n\t\t try {\n\t\t if (cm.isReadOnly()) cm.state.suppressEdits = true;\n\t\t if (dropShift) cm.display.shift = false;\n\t\t done = bound(cm) != Pass;\n\t\t } finally {\n\t\t cm.display.shift = prevShift;\n\t\t cm.state.suppressEdits = false;\n\t\t }\n\t\t return done;\n\t\t }", "function runScopeHandlers(view, event, scope) {\n return runHandlers(getKeymap(view.state), event, view, scope);\n}", "function bindHandlers(id){\n\tunbindHandlers();\n\tvar elements = recipes[id].elements_key;\n\t\n\t// the fetching...\n\t$.each(elements, function(i, e) { // i is element index. e is element as text.\n\t var newElement = ( /[\\+]+/.test(elements[i]) ) ? elements[i].replace(\"+\",\"_\") : elements[i];\n\t \n\t // Binding keys\n\t $(document).bind('keydown', elements[i], function assets() {\n\t\t $('#_'+ newElement).addClass(\"active\");\n\t\t return false;\n\t });\n\t // Binding keys\n\t $(document).bind('keyup', elements[i], function assets() {\n\t\t updateBar();\n\t\t $('#_'+ newElement).removeClass(\"active\");\n\t\t return false;\n\t });\n\t});\n\t//make buttons click able\n\t$('.input-key').click(function(){updateBar();});\n}", "static getOrCreateFor (key, handler) {\n if (legacyBindingMap.has(handler)) {\n return legacyBindingMap.get(handler)\n }\n const newLegacyHandler = this.createFor(key, handler);\n legacyBindingMap.set(handler, newLegacyHandler);\n return newLegacyHandler\n }", "function handler() {\n fired = true;\n }", "function getBindingHandler(bindingKey) {\n return options.bindingProviderInstance.bindingHandlers.get(bindingKey);\n }", "function handleCharBinding(cm, e, ch) {\n\t\t return dispatchKey(cm, \"'\" + ch + \"'\", e,\n\t\t function(b) { return doHandleBinding(cm, b, true); });\n\t\t }", "fire(sender, args) {\n this.handlers.forEach((callback) => callback(sender, args));\n }", "function handleKeyBinding(cm, e) {\n\t var name = keyName(e, true);\n\t if (!name) return false;\n\t\n\t if (e.shiftKey && !cm.state.keySeq) {\n\t // First try to resolve full name (including 'Shift-'). Failing\n\t // that, see if there is a cursor-motion command (starting with\n\t // 'go') bound to the keyname without 'Shift-'.\n\t return dispatchKey(cm, \"Shift-\" + name, e, function(b) {return doHandleBinding(cm, b, true);})\n\t || dispatchKey(cm, name, e, function(b) {\n\t if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion)\n\t return doHandleBinding(cm, b);\n\t });\n\t } else {\n\t return dispatchKey(cm, name, e, function(b) { return doHandleBinding(cm, b); });\n\t }\n\t }", "function getKeymap(state) {\n var bindings = state.facet(keymap);\n var map = Keymaps.get(bindings);\n if (!map) Keymaps.set(bindings, map = buildKeymap(bindings.reduce(function (a, b) {\n return a.concat(b);\n }, [])));\n return map;\n} /// Run the key handlers registered for a given scope. The event", "function doHandleBinding(cm, bound, dropShift) {\n\t\t if (typeof bound == \"string\") {\n\t\t bound = commands[bound];\n\t\t if (!bound) { return false }\n\t\t }\n\t\t // Ensure previous input has been read, so that the handler sees a\n\t\t // consistent view of the document\n\t\t cm.display.input.ensurePolled();\n\t\t var prevShift = cm.display.shift, done = false;\n\t\t try {\n\t\t if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n\t\t if (dropShift) { cm.display.shift = false; }\n\t\t done = bound(cm) != Pass;\n\t\t } finally {\n\t\t cm.display.shift = prevShift;\n\t\t cm.state.suppressEdits = false;\n\t\t }\n\t\t return done\n\t\t }", "function runScopeHandlers(view, event, scope) {\n return runHandlers(getKeymap(view.state), event, view, scope);\n}", "function handleKeyBinding(cm, e) {\n\t var name = keyName(e, true);\n\t if (!name) return false;\n\n\t if (e.shiftKey && !cm.state.keySeq) {\n\t // First try to resolve full name (including 'Shift-'). Failing\n\t // that, see if there is a cursor-motion command (starting with\n\t // 'go') bound to the keyname without 'Shift-'.\n\t return dispatchKey(cm, \"Shift-\" + name, e, function(b) {return doHandleBinding(cm, b, true);})\n\t || dispatchKey(cm, name, e, function(b) {\n\t if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion)\n\t return doHandleBinding(cm, b);\n\t });\n\t } else {\n\t return dispatchKey(cm, name, e, function(b) { return doHandleBinding(cm, b); });\n\t }\n\t }", "function handleKeyBinding(cm, e) {\n\t var name = keyName(e, true);\n\t if (!name) return false;\n\n\t if (e.shiftKey && !cm.state.keySeq) {\n\t // First try to resolve full name (including 'Shift-'). Failing\n\t // that, see if there is a cursor-motion command (starting with\n\t // 'go') bound to the keyname without 'Shift-'.\n\t return dispatchKey(cm, \"Shift-\" + name, e, function(b) {return doHandleBinding(cm, b, true);})\n\t || dispatchKey(cm, name, e, function(b) {\n\t if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion)\n\t return doHandleBinding(cm, b);\n\t });\n\t } else {\n\t return dispatchKey(cm, name, e, function(b) { return doHandleBinding(cm, b); });\n\t }\n\t }", "function keyDownHandler(event) {\n keyHandler(true, event);\n}", "function handle(h) {\n try {\n h.apply(h, args);\n } catch (err) {\n console.warn('Event handler raised an error!');\n console.error(err);\n }\n }", "onKeyDown(keyName, e, handle) {\n console.log(\"test:onKeyDown\", keyName, e, handle);\n\n if (keyName == \"alt+s\") {\n // alert(\"save key\")\n this.saveClient();\n console.log(e.which);\n }\n\n this.setState({\n output: `onKeyDown ${keyName}`\n });\n }", "add_press(key, action_func){\n this.press[key] = action_func;\n }", "function eachHandler(h) {\n try {\n handle(h);\n } catch (err) {\n console.error('event handler caused error');\n console.log(err);\n }\n }", "bind() {\n\t\tdocument.addEventListener('keydown', this.handleKeyPress);\n\t}", "bindKeys() {\n document.addEventListener('keydown', this.handleKeys);\n }", "HandleKeyDown(event) {}", "function keyup_handler(event)\n{\n\tgame.handle_key(event.code, false);\n}", "function handle (key, velocity) {\r\n\r\n console.log('got \"keypress\"', key);\r\n\r\n if (key === \"B\") {\r\n orb.color(\"blue\");\r\n }\r\n\r\n if (key === \"R\") {\r\n orb.color(\"red\");\r\n }\r\n\r\n if (key === \"S\") {\r\n startCalibration();\r\n }\r\n\r\n if (key === \"F\") {\r\n stopCalibration(configureLocator);\r\n }\r\n\r\n if (key === \"&\") {\r\n roll(velocity, 0);\r\n }\r\n\r\n if (key === \"'\") {\r\n roll(velocity, 90);\r\n }\r\n\r\n if (key === \"(\") {\r\n roll(velocity, 180);\r\n }\r\n\r\n if (key === \"%\") {\r\n roll(velocity, 270);\r\n }\r\n}", "function bindInput(i,obj, key){\n inputsThatAreBound[i] = null;\n i.theThingImBoundTo = obj;\n i.thePropertyImBoundTo = key; \n addBoundInputObservation(obj,key,i);\n i.addEventListener(WHATEVENTTRIGGERSDATABINDING, function(e){\n //how do the other frameworks handle this - in order to get the latest value immediately when the key is pressed, you have to do this, otherwise the value is not there yet\n window.setTimeout( function(){ \n e.target.theThingImBoundTo[e.target.thePropertyImBoundTo] = e.target.value;\n notify(e.target.theThingImBoundTo,e.target.thePropertyImBoundTo);\n }, 1);\n });\n\n\n }", "function onKey(event) {\n console.log('pgdialogs key handler');\n if (event.controlPressed) {\n console.log(\"Key:\" + event.key);\n switch (event.key) {\n case 's':\n console.log(\"cntrlS\");\n if (event.shiftPressed) { // save as\n saveRecordAs();\n } else {\n saveRecord();\n }\n propagate = false;\n return false;\n case 'o':\n console.log(\"cntrlO\");\n if (confirm(\"Do you want to load from storage?\")) {\n if (event.shiftPressed) { // load from\n nodeComms.setFileSelector(fileSelectorDialog);\n nodeComms.listFiles(\"loadRecord\", \"pgl\");\n } else {\n loadRecord();\n }\n }\n propagate = false;\n return false;\n }\n }\n if (typeof onKeyChain === 'function')\n return onKeyChain(event); // pass it on\n console.log(\"Passing key on\");\n return true;\n }", "function bindKey(strRaw) {\n // split and trim, remove empty strings\n var processed = [];\n var sp = strRaw.split(\" \");\n for (i = 0; i < sp.length; i++) {\n sp[i] = sp[i].trim();\n if (i <= 1) sp[i] = sp[i].toUpperCase();\n if (sp[i] != \"\") {\n processed.push(sp[i]);\n }\n }\n\n var pKey = new Object();\n pKey.keyCode = processed[0].charCodeAt(0);\n pKey.command = processed[1];\n processed.splice(0, 2);\n pKey.arguments = processed;\n parsedKeyBinding.push(pKey);\n}", "function handleCharBinding(cm, e, ch) {\n\t return dispatchKey(cm, \"'\" + ch + \"'\", e,\n\t function(b) { return doHandleBinding(cm, b, true); });\n\t }", "function handleCharBinding(cm, e, ch) {\n\t return dispatchKey(cm, \"'\" + ch + \"'\", e,\n\t function(b) { return doHandleBinding(cm, b, true); });\n\t }", "function handleCharBinding(cm, e, ch) {\n\t return dispatchKey(cm, \"'\" + ch + \"'\", e,\n\t function(b) { return doHandleBinding(cm, b, true); });\n\t }", "function handleKey(e) {\n if (e.key.includes(\"Arrow\")) {\n e.preventDefault();\n draw({ key: e.key }); // Here the key object is being deconstructing that its value is the key that the event had\n console.log(e.key);\n console.log(\"HANDLE KEYY!!\")\n };\n}", "function dispatch (ke) {\n console.log('dispatch', ke)\n for (let listener of keydownListeners) {\n listener(ke.key)\n }\n}", "function doHandleBinding(cm, bound, dropShift) {\n\t if (typeof bound == \"string\") {\n\t bound = commands[bound];\n\t if (!bound) return false;\n\t }\n\t // Ensure previous input has been read, so that the handler sees a\n\t // consistent view of the document\n\t cm.display.input.ensurePolled();\n\t var prevShift = cm.display.shift, done = false;\n\t try {\n\t if (cm.isReadOnly()) cm.state.suppressEdits = true;\n\t if (dropShift) cm.display.shift = false;\n\t done = bound(cm) != Pass;\n\t } finally {\n\t cm.display.shift = prevShift;\n\t cm.state.suppressEdits = false;\n\t }\n\t return done;\n\t }" ]
[ "0.66893464", "0.6387576", "0.6263076", "0.6140119", "0.6125587", "0.5889015", "0.5853597", "0.5827518", "0.5789461", "0.5789461", "0.5789461", "0.5789461", "0.5789461", "0.57228875", "0.5662782", "0.5644284", "0.5632373", "0.5600212", "0.5537149", "0.55028874", "0.5479583", "0.5457987", "0.5421492", "0.54151267", "0.5397734", "0.5379964", "0.5334692", "0.53117454", "0.52901417", "0.5287808", "0.52685285", "0.52494717", "0.52494717", "0.52416337", "0.5239013", "0.5237332", "0.5226795", "0.5226795", "0.5226795", "0.5226795", "0.52053016", "0.5200225", "0.51937604", "0.51937604", "0.51937604", "0.51937604", "0.51937604", "0.51937604", "0.51937604", "0.51937604", "0.51937604", "0.51937604", "0.51937604", "0.5191067", "0.518937", "0.518937", "0.5170507", "0.5166785", "0.5158257", "0.5156446", "0.51494163", "0.51494163", "0.51494163", "0.51469374", "0.51446426", "0.5140103", "0.51247513", "0.51192015", "0.5112561", "0.51087785", "0.5108049", "0.50912005", "0.5090325", "0.50893766", "0.50831807", "0.5081267", "0.50758207", "0.50735706", "0.5067452", "0.5057002", "0.5053638", "0.5053638", "0.50470805", "0.5046087", "0.50456995", "0.5041295", "0.5040103", "0.5036242", "0.5035751", "0.503524", "0.503497", "0.5034944", "0.5032143", "0.50258875", "0.5019373", "0.50133425", "0.50133425", "0.50133425", "0.50115764", "0.5010593", "0.5009565" ]
0.0
-1
Handle a key from the keydown event.
function handleKeyBinding(cm, e) { var name = keyName(e, true); if (!name) { return false } if (e.shiftKey && !cm.state.keySeq) { // First try to resolve full name (including 'Shift-'). Failing // that, see if there is a cursor-motion command (starting with // 'go') bound to the keyname without 'Shift-'. return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); }) || dispatchKey(cm, name, e, function (b) { if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion) { return doHandleBinding(cm, b) } }) } else { return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); }) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "HandleKeyDown(event) {}", "function keydown_handler(event)\n{\n\tif (event.defaultPrevented) return;\n\tif (game.handle_key(event.code, true)) return;\n\n\t// cancel the default action to avoid it being handled twice\n\tevent.preventDefault();\n}", "function keyDownHandler(event) {\n keyHandler(true, event);\n}", "function keydown(event) {\n keys[event.code] = event;\n }", "handleInput(keycode) {\n if (keycode !== undefined && player.moves === true) {\n key = keycode;\n }\n }", "handleKeyDown (event) {\n }", "function canvasHandleKeyDown(e){\r\n\tvar key = e.keyCode;\r\n\t//println(key);\r\n\tif(useStates){\r\n\t\tStates.current().input.handleKeyDown(e);\r\n\t}\r\n\tgInput.handleKeyDown(e);\r\n}", "function handleKeyPress({ key }) {\n dispatch(playerTyped(key.toLowerCase()));\n }", "function handleKeydown(keyCode) {\n\t\tconst roomID = clientRooms[client.id]; // Look for client ID in clientRooms keys\n\n\t\tif (!roomID) return;\n\n\t\ttry {\n\t\t\tkeyCode = parseInt(keyCode);\n\t\t} catch (error) {\n\t\t\tconsole.error(error);\n\t\t\treturn;\n\t\t}\n\t\tconst vel = getUpdatedVelocity(keyCode);\n\n\t\tif (vel) {\n\t\t\tstate[roomID].players[client.number - 1].vel = vel;\n\t\t}\n\t}", "handleKeyDown({ key }) {\n switch (key) {\n case \"Enter\":\n this.addTodoToState(this._inputEl.value);\n break;\n default:\n break;\n }\n }", "keyDown(_keycode) {}", "_handleKeyEvent(event) {\n const keyManager = this._keyManager;\n switch (event.keyCode) {\n case LEFT_ARROW:\n case RIGHT_ARROW:\n if (this._isHorizontal()) {\n event.preventDefault();\n keyManager.setFocusOrigin('keyboard');\n keyManager.onKeydown(event);\n }\n break;\n case UP_ARROW:\n case DOWN_ARROW:\n if (!this._isHorizontal()) {\n event.preventDefault();\n keyManager.setFocusOrigin('keyboard');\n keyManager.onKeydown(event);\n }\n break;\n case ESCAPE:\n if (!hasModifierKey(event)) {\n event.preventDefault();\n this._menuStack.close(this, 2 /* currentItem */);\n }\n break;\n case TAB:\n this._menuStack.closeAll();\n break;\n default:\n keyManager.onKeydown(event);\n }\n }", "function onKeyDown(e) {\n // do not handle key events when not in input mode\n if (!imode) {\n return;\n }\n\n // only handle special keys here\n specialKey(e);\n }", "_keydown(event) {\n if (this._originatesFromChip(event)) {\n this._keyManager.onKeydown(event);\n }\n }", "_keydown(event) {\n if (this._originatesFromChip(event)) {\n this._keyManager.onKeydown(event);\n }\n }", "function handleKeyPress(event) {\n\n var action = getSwitcherAction(event.keyCode);\n\n switch (action) {\n case Config.GOING_UP:\n case Config.GOING_DOWN:\n moveListFocus(action);\n break;\n case Config.ESCAPING:\n $(Config.LIST_SWITCHER).hide();\n break;\n case Config.SWITCHING:\n switchToSelectedList();\n break;\n }\n }", "function handleKeyDown(event) {\n switch (event.key) {\n case \"Escape\":\n closeSuggestions();\n break;\n case \"ArrowDown\":\n highlightNext();\n break;\n case \"ArrowUp\":\n highlightPrev();\n break;\n case \"Enter\":\n selectItem();\n }\n}", "_handleKeydown(event) {\n // We don't handle any key bindings with a modifier key.\n if (Object(_angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_14__[\"hasModifierKey\"])(event)) {\n return;\n }\n switch (event.keyCode) {\n case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_14__[\"ENTER\"]:\n case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_14__[\"SPACE\"]:\n if (this.focusIndex !== this.selectedIndex) {\n this.selectFocusedIndex.emit(this.focusIndex);\n this._itemSelected(event);\n }\n break;\n default:\n this._keyManager.onKeydown(event);\n }\n }", "function handleKeyDown(event) {\n wgl.listOfPressedKeys[event.keyCode] = true;\n // console.log(\"keydown - keyCode=%d, charCode=%d\", event.keyCode, event.charCode);\n }", "handleKeyDown(kCode) {\n console.log(\"handleKeyDown \" + this.id + \" \" + kCode)\n }", "function handleKey(e) {\n if (e.key.includes(\"Arrow\")) {\n e.preventDefault();\n draw({ key: e.key }); // Here the key object is being deconstructing that its value is the key that the event had\n console.log(e.key);\n console.log(\"HANDLE KEYY!!\")\n };\n}", "function handleKeyDown(event) {\r\n // storing the pressed state for individual key\r\n currentlyPressedKeys[event.keyCode] = true;\r\n}", "handleKeyPress(kEvent) {\n switch (kEvent.keyCode) {\n case Phaser.KeyCode.BACKSPACE:\n this.deleteChar();\n break;\n case Phaser.KeyCode.LEFT:\n case Phaser.KeyCode.RIGHT:\n case Phaser.KeyCode.UP:\n case Phaser.KeyCode.DOWN:\n console.warn('CMD NAV NOT IMPLEMENTED');\n break;\n case Phaser.KeyCode.SPACEBAR:\n this.addTextToCommand(' ');\n break;\n case Phaser.KeyCode.ENTER:\n this.submitCommand();\n break;\n case Phaser.KeyCode.TAB:\n console.warn('CMD AUTOCOMPLETE NOT IMPLEMENTED');\n break;\n default:\n this.addTextToCommand(kEvent);\n break;\n }\n }", "function keyup_handler(event)\n{\n\tgame.handle_key(event.code, false);\n}", "function handleKey(event) {\n if (event.key.includes('Arrow')) {\n event.preventDefault();\n draw({ key: event.key });\n // console.log(event.key);\n // console.log('handling key');\n }\n}", "function handleKeydown(event)\n {\n\n switch(event.which)\n { \n \n case 13: \n handleEnterKey(event);\n break;\n \t \n case 36:\n event.preventDefault();\n handleInitKey();\n break;\n \n case 46: \n preventPromptErasing(event, true);\n break;\n \t \n case 8: \n case 37: \n preventPromptErasing(event, false);\n break;\n \n case 38: \n event.preventDefault();\n applyCommandHistory(true);\n break;\n \n case 40: \n applyCommandHistory(false);\n event.preventDefault();\n break;\n \n default: \n // As of now, nothing is done in this case.\n break;\n }\n }", "function keydown() {\n switch (d3.event.keyCode) {\n case 8: // backspace\n {\n break;\n }\n case 46: { // delete\n delete_node = true;\n break;\n }\n case 16: { //shift\n should_modify = true;\n break;\n }\n case 17: { //control\n drawing_line = true;\n }\n\n }\n}", "function keyDown(evt) {\n var c = (evt.keyCode) ? evt.keyCode : evt.charCode;\n switch(c) {\n case 37: // left\n case 63234:\n dx = 1; break;\n case 39: // right\n case 63235:\n dx = -1; break;\n case 40: // down\n case 63233:\n dy = -1; break;\n case 38: // up\n case 63232:\n dy = 1; break;\n case 32: // fire\n if (Torpedo.x) {\n playSound('notAvail');\n message('Not loaded new torpedo yet!');\n mainPanel(\"#779\");\n } else Torpedo.fire();\n break;\n case 16: // shift\n withShift = 1; break;\n case 27: // esc\n gameRunning = score = 0;\n IntroOutro.endAnimDest(0 , 1, 1);\n }\n}", "function keydown(evt) {\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n\r\n switch (keyCode) {\r\n case \"A\".charCodeAt(0):\r\n player.motion = motionType.LEFT;\r\n player.facing = facingDir.LEFT;\r\n break;\r\n\r\n case \"D\".charCodeAt(0):\r\n player.motion = motionType.RIGHT;\r\n\t\t\tplayer.facing = facingDir.RIGHT;\r\n break;\r\n\r\n case \"W\".charCodeAt(0):\r\n if (player.isOnPlatform()||cheating) {\r\n player.verticalSpeed = JUMP_SPEED;\r\n }\r\n break;\r\n\r\n\t\tcase \"C\".charCodeAt(0):\r\n\t\t\tif (!cheating){\r\n\t\t\t\tplayer.rolenode.style.setProperty(\"opacity\", 0.5, null);\r\n\t\t\t\tcheating = true;\r\n\t\t\t\tOLD_BCOUNT = BULLET_COUNT;\r\n\t\t\t\tBULLET_COUNT = Number.POSITIVE_INFINITY;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"V\".charCodeAt(0):\r\n\t\tif (cheating){\r\n\t\t\t\tplayer.rolenode.style.setProperty(\"opacity\", 1, null);\r\n\t\t\t\tcheating = false;\r\n\t\t\t\tBULLET_COUNT = OLD_BCOUNT;\r\n\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"Q\".charCodeAt(0):\r\n\t\t\talert( player.position.x+ \", \"+ (player.position.y - 5) );\r\n\t\t\tbreak;\r\n\r\n\r\n\t\tcase 32:\r\n if (canShoot) shootBullet();\r\n break;\r\n }\r\n}", "handleKeyPress(e) {\n if((this.gameOver() === 'won') || (this.gameOver() === 'loose')) {\n if (e.key === ' ') {\n this.restartGame();\n }\n } \n else {\n if ((e.keyCode >= 65) && (e.keyCode <= 90)) {\n this.handleKeyClick(e.key.toUpperCase());\n }\n }\n }", "function onKeyPress(e) {\n const pressed = e.keyCode;\n\n switch(pressed) {\n case 82: // R\n handleRestart();\n break;\n case 83: // S\n handleStartMenu();\n break;\n case 27:\n // Esc\n handlePause();\n break;\n }\n}", "function handleKey(e){\n if(e.key.includes('Arrow')){\n e.preventDefault();\n console.log(e.key);\n draw({key: e.key});\n console.log('HANDLING KEY');\n }\n}", "function handleKeyDown(e) {\n\t\t//cross browser issues exist\n\t\tif(!e){ var e = window.event; }\n\t\tswitch(e.keyCode) {\n\t\t\tcase KEYCODE_SPACE:\tshootHeld = true; return false;\n\t\t\tcase KEYCODE_A:\n\t\t\tcase KEYCODE_LEFT:\tlfHeld = true; return false;\n\t\t\tcase KEYCODE_D:\n\t\t\tcase KEYCODE_RIGHT: rtHeld = true; return false;\n\t\t\tcase KEYCODE_W:\n\t\t\tcase KEYCODE_UP:\tfwdHeld = true; return false;\n\t\t\tcase KEYCODE_ENTER:\t if(canvas.onclick == handleClick){ handleClick(); }return false;\n\t\t}\n\t}", "function keydown(evt) {\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\n\n switch (keyCode) {\n case \"N\".charCodeAt(0):\n player.motion = motionType.LEFT;\n break;\n\n case \"M\".charCodeAt(0):\n player.motion = motionType.RIGHT;\n break;\n\t\t\t\n\n // Add your code here\n\t\t\n\t\t\t\n case \"Z\".charCodeAt(0):\n if (player.isOnPlatform()) {\n player.verticalSpeed = JUMP_SPEED;\n }\n break;\n\t\t\n\t\tcase 32: // spacebar = shoot\n\t\t\tif (canShoot) shootBullet();\n\t\t\tbreak;\n }\n}", "function handleKeys(e){\n\tswitch (e.keyCode){\n\t\tcase 67: \t\t\t// 'c'\n\t\t\tcomposeWindowOpener();\n\t\t\tbreak;\n\t\tcase 88: \t\t\t// 'x'\n\t\t\tselectEmail();\n\t\t\tbreak;\n\t\tcase 38: \t\t\t// 'up'\n\t\tcase 74: \t\t\t// 'j'\n\t\t\trowSelector(-1);\n\t\t\tbreak;\n\t\tcase 40: \t\t\t// 'down'\n\t\tcase 75: \t\t\t// 'k'\n\t\t\trowSelector(1);\n\t\t\tbreak;\n\t\tcase 46: \t\t\t// 'del'\n\t\t\tcloseAd_keyEvent();\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tconsole.log(\"not listening to keyCode\",e.keyCode);\n\t}\n}", "_handleHeaderKeydown(event) {\n this._keyManager.onKeydown(event);\n }", "function keydownEventListener(event) {\n\tvar elementXPath = getXPath(event.target);\n\tvar keyIdentifier;\n\tif (isCharacterKeyPress(event)) {\n\t\t// For charcter keys return printable character instead of code\n\t\tkeyIdentifier = String.fromCharCode(event.which);\n\t} else {\n\t\tkeyIdentifier = event.which;\n\t};\n\n\tif (isCharacterKeyPress(event) && ((!event.altKey && !event.metaKey && !event.shiftKey && !event.ctrlKey) || (!event.altKey && !event.metaKey && event.shiftKey && !event.ctrlKey))) {\n\t\t// Ignore as it's just normal key press and will be sent via \"keypress event\" or someone did Shift+key to make it capital – again will be sent via keypress event\n\t} else {\n\t\tconsole.log('Pressed down: ' + keyIdentifier + ' on ' + elementXPath + ' alt: ' + event.altKey + ' meta: ' + event.metaKey + ' shift: ' + event.shiftKey + ' ctrl: ' + event.ctrlKey);\n\t\tsendEvent(\"{\\\"path\\\":\\\"\" + elementXPath + \"\\\", \\\"action\\\":\\\"keydown\\\", \\\"keyIdentifier\\\":\\\"\" + keyIdentifier + \"\\\", \\\"metaKey\\\":\\\"\" + event.metaKey + \"\\\", \\\"ctrlKey\\\":\\\"\" + event.ctrlKey + \"\\\", \\\"altKey\\\":\\\"\" + event.altKey + \"\\\", \\\"shiftKey\\\":\\\"\" + event.shiftKey + \"\\\"}\");\n\t};\n}", "function keyDownHandler(e) {\n\twasdKeys.onKeyDown(e);\n}", "keyHandler(event){\n switch(event.which){\n // previous slide\n case 33: // pgup\n case 37: // left\n event.preventDefault();\n this.previous();\n break;\n\n // next slide\n case 32: // spacebar\n case 34: // pgdn\n case 39: // right\n event.preventDefault();\n this.next()\n break;\n\n // autoplay\n case 65: // a\n event.preventDefault();\n this.toggleAutoplay();\n break;\n\n // fullscreen\n case 70: // f\n event.preventDefault();\n this.fullscreen();\n break;\n\n // goto home slide\n case 72: // h\n event.preventDefault();\n this.goto(1);\n break;\n\n // play / pause\n case 80: // p\n event.preventDefault();\n this.playAudio();\n break;\n\n // transcript / table of contents\n case 84: // t\n event.preventDefault();\n this.toggleTranscript();\n break;\n }\n }", "function keyPressDown(event){\n\n let key = (96 <= event.keyCode && event.keyCode <= 105)? event.keyCode - 48 : event.keyCode;\n if(key >= 16 && key <= 18){\n\n if(pressedModifiers.indexOf(key) === -1){\n\n pressedModifiers.push(key);\n }\n if(event.data && event.data.modifierFunc){\n\n event.data.modifierFunc(event);\n }\n\n } else {\n\n if(event.data && event.data.keyFunc){\n\n event.data.keyFunc(event);\n }\n }\n if(event.data && event.data.func){\n\n event.data.func(event);\n }\n for (var handler in waitingForInput) {\n if (waitingForInput.hasOwnProperty(handler)) {\n waitingForInput[handler](event);\n }\n }\n\n}", "function onKeyPress(event) {\n\t\n\tswitch (event.key) {\n\t\t\n\t\t// Light Keys\n\t\tcase \"ArrowDown\":\n\t\tcase \"ArrowUp\":\n\t\tcase \"ArrowRight\":\n\t\tcase \"ArrowLeft\":\n\t\tcase \"+\":\n\t\tcase \"-\":\n\t\t\tlightEventHandler(event);\n\t\t\tbreak;\n\n\t\t// Camera keys\n\t\tcase \"w\":\n\t\tcase \"s\":\n\t\tcase \"d\":\n\t\tcase \"a\":\n\t\tcase \"q\":\n\t\tcase \"e\":\n\t\t\tSC.keyPress(event); // pass the listener event to the camera (Required for SphericalCamera Module)\n\t\t\tupdateMVP(); // re-generate the MVP matrix and update it\n\t\t\tbreak;\n\t}\n\n\trender(); // draw with the new view\n}", "function canvasHandleKeyPress(e){\r\n\tvar key = e.which;\r\n\tif(useStates){\r\n\t\tStates.current().input.handleKeyPress(e);\r\n\t}\r\n\tgInput.handleKeyPress(e);\r\n}", "handleKeys(event) {\n\t\tswitch (event.which) {\n\t\t\tcase KeyEvent.DOM_VK_DOWN:\n\t\t\t\tevent.preventDefault();\n\t\t\t\t\tthis.nextItem();\n\t\t\t\tbreak;\n\t\t\tcase KeyEvent.DOM_VK_UP:\n\t\t\t\tevent.preventDefault();\n\t\t\t\t\tthis.previousItem();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}", "function keyDownHandler(e) {\n switch (e.keyCode) {\n case KEY_CODE_LEFT:\n keyPressedLeft = true;\n break;\n case KEY_CODE_RIGHT:\n keyPressedRight = true;\n break;\n case KEY_CODE_SPACE:\n if (!isVikingDown && gameStarted) {\n jumpViking();\n }\n break;\n }\n }", "function handleKey(event) { //function to create input when key is pressed\n\t\tvar pressedKey = event.key;\n\t\tmakeSound(pressedKey);\n\t\tbuttonAnimation(pressedKey);\n\t\tsetTimeout(buttonAnimation,500);\n\t\t// console.log(pressedKey);\n}", "handleKeydown(event) {\n if (event.which === 13 || event.which === 27) { // enter or esc\n this.finishUpdate();\n }\n }", "function keyHandler(e){\n\tvar keyCode = String(e.keyCode);\n\tupdateScore(keyCode);\n\tvar p1 = d.getElementById(\"keypressed\");\n\t//p1.innerHTML = e.keyCode;\n\tvar track = map_key_track[keyCode];\n \tstaticCircles.playedNote(track, new Date().getTime());\n \tplaySound(track);\n\t\n}", "[keydown](/** @type {KeyboardEvent} */ event) {\n let handled;\n\n switch (event.key) {\n case \" \":\n this.click();\n handled = true;\n break;\n }\n\n // Prefer mixin result if it's defined, otherwise use base result.\n return handled || (super[keydown] && super[keydown](event));\n }", "function keyPressed() {\n if (handler.active === handler.nameplate) {\n doorbell.keyPressed();\n }\n}", "function handleKeyDown(event) {\n currentlyPressedKeys[event.keyCode] = true;\n }", "function keyPressHandler(event)\n\t{\n\t\t// Make sure it's not the same event firing over and over again\n\t\tif (keyPressEvent == event) {\n\t\t\treturn;\n\t\t} else {\n\t\t\tkeyPressEvent = event;\n\t\t}\n\n\t\t// Get character that was typed\n\t\tvar charCode = event.which;\n\t\tif (charCode == KEYCODE_RETURN)\t// If return, clear and get out\n\t\t{\n\t\t\tclearTypingBuffer();\n\t\t\tclearTypingTimer();\n\t\t\treturn;\n\t\t}\n\n\t\t// Clear timer if still running, and start it again\n\t\tclearTypingTimer();\n\t\ttypingTimer = setTimeout(clearTypingBuffer, typingTimeout);\n\n\t\t// Add new character to typing buffer\n\t\tvar char = String.fromCharCode(charCode);\n\t\ttypingBuffer.push(char);\n\n\t\t// Check typed text for shortcuts\n\t\tcheckShortcuts(char, typingBuffer, event.target);\n\t}", "handleKeyInput (event) {\n event.stopPropagation()\n\n // Ignore key input during animations\n if (this.isAnimating()) {\n return\n }\n\n const keyCode = event.which || event.keyCode\n\n // Ignore key presses that happen too close to each other (when rapid fire key pressing or holding down the key)\n // But allow it if it's a lightbox closing action\n const currentTime = new Date()\n if ((currentTime.getTime() - this.lastKeyDownTime) < this.props.keyRepeatLimit && keyCode !== KEYS.ESC) {\n return\n }\n this.lastKeyDownTime = currentTime.getTime()\n\n switch (keyCode) {\n // ESC key closes the lightbox\n case KEYS.ESC:\n event.preventDefault()\n this.requestClose(event)\n break\n\n // Left arrow key moves to previous image\n case KEYS.LEFT_ARROW:\n if (!this.props.prevSrc) {\n return\n }\n\n event.preventDefault()\n this.keyPressed = true\n this.requestMovePrev(event)\n break\n\n // Right arrow key moves to next image\n case KEYS.RIGHT_ARROW:\n if (!this.props.nextSrc) {\n return\n }\n\n event.preventDefault()\n this.keyPressed = true\n this.requestMoveNext(event)\n break\n\n default:\n }\n }", "function handleKey(event){ \n switch (event.code){\n case 'ArrowRight':\n playerOne.moveRight() \n break\n case 'ArrowLeft':\n playerOne.moveLeft() \n break \n case 'ArrowUp':\n playerOne.moveUp() \n break\n case 'ArrowDown':\n playerOne.moveDown() \n break\n }\n }", "function onKeyDown(event) {\n}", "function keyHandler(evt){\n keymap[evt.key] = (evt.type == 'keydown');\n}", "static _HandleKeyDown(e) {\n if (!Keyboard._keys_down.map(i => i.key).includes(e.key.toLowerCase()))\n Keyboard._keys_down.push({key: e.key.toLowerCase(), blocked: false})\n }", "function keyPressed() {\n\t// toggle fullscreen mode\n\tif( key === 'f') {\n\t\tfs = fullscreen();\n\t\tfullscreen(!fs);\n\t\treturn;\n\t}\n\n\t// dispatch key events for adventure manager to move from state to \n\tadventureManager.keyPressed(key); \n}", "function handleKeyEvent(event) {\n if (isEventModifier(event)) {\n return;\n }\n\n if (ignoreInputEvents && isInputEvent(event)) {\n return;\n }\n\n const eventName = getKeyEventName(event);\n const listeners = __subscriptions[eventName.toLowerCase()] || [];\n\n if (typeof __monitor === 'function') {\n const matched = listeners.length > 0;\n __monitor(eventName, matched, event);\n }\n\n if (listeners.length) {\n event.preventDefault();\n }\n\n // flag to tell if execution should continue;\n let propagate = true;\n //\n for (let i = listeners.length - 1; i >= 0; i--) {\n if (listeners[i]) {\n propagate = listeners[i](event);\n }\n if (propagate === false) {\n break;\n }\n }\n // listeners.map(listener => listener());\n }", "_handleKeydown(event) {\n const keyCode = event.keyCode;\n const manager = this._keyManager;\n switch (keyCode) {\n case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_2__[\"ESCAPE\"]:\n if (!Object(_angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_2__[\"hasModifierKey\"])(event)) {\n event.preventDefault();\n this.closed.emit('keydown');\n }\n break;\n case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_2__[\"LEFT_ARROW\"]:\n if (this.parentMenu && this.direction === 'ltr') {\n this.closed.emit('keydown');\n }\n break;\n case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_2__[\"RIGHT_ARROW\"]:\n if (this.parentMenu && this.direction === 'rtl') {\n this.closed.emit('keydown');\n }\n break;\n default:\n if (keyCode === _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_2__[\"UP_ARROW\"] || keyCode === _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_2__[\"DOWN_ARROW\"]) {\n manager.setFocusOrigin('keyboard');\n }\n manager.onKeydown(event);\n }\n }", "_keydown(event) {\n const target = event.target;\n const keyCode = event.keyCode;\n const manager = this._keyManager;\n if (keyCode === TAB && target.id !== this._chipInput.id) {\n this._allowFocusEscape();\n }\n else if (this._originatesFromEditingChip(event)) {\n // No-op, let the editing chip handle all keyboard events except for Tab.\n }\n else if (this._originatesFromChip(event)) {\n manager.onKeydown(event);\n }\n this.stateChanges.next();\n }", "function handleKey(e) {\n if (e.key.includes('Arrow')) {\n draw({ key: e.key });\n e.preventDefault();\n // console.log('Handling keys: ', e.key);\n }\n}", "function keydown(e) {\n\t //alert(e.key)\n\t if (!isNaN(e.key)) {\n\t clickNumber(e.key.toString());\n\t return;\n\t }\n\t switch (e.key) {\n\t case \"c\":\n\t clickClear();\n\t break;\n\t case \"Backspace\":\n\t clickBackspace();\n\t break;\n\t case \".\":\n\t clickDecimal();\n\t break;\n\t case \"Enter\":\n\t clickEquals();\n\t break;\n\t case \"=\":\n\t clickEquals();\n\t break;\n\t case \"+\":\n\t clickCalc(\"+\");\n\t break;\n\t case \"-\":\n\t clickCalc(\"-\");\n\t break;\n\t case \"*\":\n\t clickCalc(\"\\xD7\");\n\t break;\n\t case \"/\":\n\t clickCalc(\"\\xF7\");\n\t break;\n\t case \"%\":\n\t clickCalc(\"%\");\n\t break;\n\t }\n\t}", "keydown({keyCode}) {\n switch (keyCode) {\n case this.keys.up: this.moveUp(); break\n case this.keys.bottom: this.moveDown(); break\n case this.keys.left: this.moveLeft(); break\n case this.keys.right: this.moveRight(); break\n }\n }", "function keysHandle(e) {\n e.preventDefault;\n switch (e.keyCode) {\n case 83:\n if (!gameStarted) {\n displayCards();\n }\n break;\n case 82:\n if (gameStarted) {\n displayCards();\n }\n break;\n case 32:\n if (gameStarted) {\n if (pausePressed) {\n e.preventDefault();\n startTimer();\n pausePressed = false;\n } else {\n e.preventDefault();\n pause();\n pausePressed = true;\n }\n }\n break;\n }\n}", "function handleKeyDown(keyCode) {\n\n\t\tif (keyCode === 13 && step === 1 && !isStepOneNextDisabled()) {\n\t\t\tonNext();\n\t\t} else if (keyCode === 13 && step === 2 && !isStepTwoSubmitDisabled()) {\n\t\t\tonSubmit();\n\t\t}\n\t}", "function cust_KeyDown(evnt) {\n //f_log(evnt.keyCode)\n}", "function keydown(evt) {\r\n if (isGameOver) return false\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n var SPACE = 32;\r\n\r\n switch (keyCode) {\r\n case \"N\".charCodeAt(0):\r\n if (player.motion!=motionType.LEFT) flipPlayer = motionType.LEFT\r\n player.motion = motionType.LEFT;\r\n break;\r\n\r\n case \"M\".charCodeAt(0):\r\n if (player.motion!=motionType.RIGHT) flipPlayer = motionType.RIGHT\r\n player.motion = motionType.RIGHT;\r\n break;\r\n case \"Z\".charCodeAt(0):\r\n if (player.isOnPlatform() || player.isOnVerticalPlatform){\r\n player.verticalSpeed = JUMP_SPEED\r\n }\r\n break;\r\n case \"C\".charCodeAt(0):\r\n cheatMode = true\r\n console.log(\"cheat mode enabled\")\r\n break;\r\n case \"V\".charCodeAt(0):\r\n cheatMode = false\r\n console.log(\"cheat mode disabled\")\r\n break;\r\n case SPACE:\r\n if (bullet_count > 0 || cheatMode) shoot()\r\n evt.preventDefault()\r\n break;\r\n return false\r\n }\r\n}", "function keyPressed(event) {\n const digits = \"0123456789\";\n const operators = \"+-x*/\";\n if (digits.indexOf(event.key) !== -1) {\n digitPressed(event.key);\n } else if (operators.indexOf(event.key) !== -1) {\n operatorPressed(event.key);\n } else if (event.key === \"=\" || event.key === \"Enter\") {\n computeResult();\n } else if (event.key === \"c\" || event.key === \"C\") {\n clearDisplay();\n } else if (event.key === \".\") {\n addDecimal();\n } else if (event.key === \"m\" || event.key === \"M\") {\n flipSign();\n } else if (event.key === \"Backspace\") {\n deleteLastDigit();\n }\n}", "function keyPressHandler(e) {\r\n if (e.which === 117) rocket1.moveUp(10);\r\n if (e.which === 100) rocket1.moveDown(10);\r\n if (e.which === 114) rocket1.moveRight(10);\r\n if (e.which === 108) rocket1.moveLeft(10);\r\n if (e.which === 32) {\r\n soundFiring();\r\n rocket1.addBullet(rocket1.x, rocket1.y + rocket1.height / 2);\r\n }\r\n if (e.which === 48) {\r\n clearInterval(animate);\r\n }\r\n if (e.which === 49) {\r\n clearInterval(animate);\r\n animate = setInterval(animation, 100);\r\n }\r\n }", "keyDown(event){\n\t\tconsole.log(`======] Key Down [======`, event);\n\t\tevent.preventDefault();\n\n\t\tlet keycode = event.which;\n\t\tif(keycode === 16){\n\t\t\tthis.setState({shiftDown: true});\n\t\t}\n\t\t\n\t\t//TODO: figure out how to use SHIFT and CAPS lock\n\t\tif(this.state.focused){\n\t\t\tlet androidKeycode = keycodes.map[keycode];\n\t\t\tconsole.log(`======] KeyCode ${keycode} -> ${androidKeycode} [======`);\n\t\t\tif(androidKeycode){\n\t\t\t\tlet commands = [];\n\t\t\t\tif(this.state.shiftDown){\n\t\t\t\t\tcommands.push(keycodes.map[16]);\n\t\t\t\t}\n\t\t\t\tcommands.push(androidKeycode);\n\t\t\t\tthis.serializer.to({type: 'KEYEVENT', commands: commands})\n\t\t\t\t\t.then(message => {\n\t\t\t\t\t\tthis.websocket.send(message);\n\t\t\t\t\t})\n\t\t\t\t\t.catch(error => console.error(error));\n\t\t\t}\n\t\t}\n\t}", "function keydownHandler(e) {\n var keyCode = e.keyCode;\n \n // enter key code = 13\n if (keyCode == 13) {\n clickHandler();\n }\n}", "function onKeyDown(evt) {\n // Keys with modifiers are ignored\n if (evt.altKey || evt.ctrlKey || evt.metaKey) {\n return;\n }\n\n switch (evt.keyCode) {\n case 36: // Home\n player.moveToFirst();\n break;\n case 35: // End\n player.moveToLast();\n break;\n case 38: // Arrow up\n player.jumpToPrevious();\n break;\n case 33: // Page up\n case 37: // Arrow left\n player.moveToPrevious();\n break;\n case 40: // Arrow down\n player.jumpToNext();\n break;\n case 34: // Page down\n case 39: // Arrow right\n case 13: // Enter\n case 32: // Space\n player.moveToNext();\n break;\n }\n \n evt.stopPropagation();\n \n // In Chrome/Chromium, preventDefault() inhibits the 'keypress' event\n }", "handleInput(key) {\n switch(key) {\n case 'right':\n if(this.x < 400) {\n this.x += this.moveLR;\n }\n break;\n case 'left':\n if(this.x > 0) {\n this.x -= this.moveLR;\n }\n break;\n case 'up':\n if(this.y > 0) {\n this.y -= this.moveFB;\n }\n break;\n case 'down':\n if(this.y < 385) {\n this.y += this.moveFB;\n }\n break;\n }\n }", "function keyPressed() {\n // toggle fullscreen mode\n if( key === 'f') {\n fs = fullscreen();\n fullscreen(!fs);\n return;\n }\n\n // dispatch all keys to adventure manager\n adventureManager.keyPressed(key); \n}", "function keyPressed() {\n // toggle fullscreen mode\n if( key === 'f') {\n fs = fullscreen();\n fullscreen(!fs);\n return;\n }\n\n // dispatch all keys to adventure manager\n adventureManager.keyPressed(key); \n}", "_keyHandler(event) {\n const that = this;\n\n if ((that.disabled !== true) && !that.readonly && (event.keyCode === 32)) {\n if (event.type === 'keydown') {\n event.preventDefault();\n return;\n }\n\n if (that.switchMode === 'none') {\n return;\n }\n\n that._changeCheckState('keyboard');\n that._updateHidenInputNameAndValue();\n }\n }", "function handleInput( keyPressed ) {\n // if the user pressed the space bar\n if ( keyPressed === \"space\" )\n {\n // if we're in the \"showResult\" game state\n if ( global.gameState === \"showResult\" )\n {\n // reset the game and transition back to the running state\n reset();\n global.gameState = \"running\";\n }\n }\n }", "function processKeyPress(event){\n if (!validKeys.includes(event.keyCode)) {\n return;\n }\n // prevent default browser mapping of keys\n event.preventDefault();\n\n let isShifted = event.shiftKey;\n let element = undefined;\n \n if (isShifted) {\n let shiftedKey = shiftedKeys[event.keyCode];\n element = document.querySelector(`[data-key=\"${shiftedKey}\"]`);\n } else {\n element = document.querySelector(`[data-key=\"${event.keyCode}\"]`);\n }\n let mouseDown = new Event('mousedown');\n element.dispatchEvent(mouseDown);\n // init mouse up and delay 100 ms, keyup seems to fire faster than mouseup so when using keyboard you can barely see calculator key animations\n setTimeout(() => {\n let mouseUp = new Event('mouseup');\n element.dispatchEvent(mouseUp);\n }, 100);\n }", "function computeKey(event){\n if(event.code == 'KeyV')\n scene.changeActiveCamera();\n else if(event.code == 'Space' && !scene.endedGame) //barra espaciadora\n scene.pauseGame();\n else if(!scene.pausedGame)\n scene.computeKey(event);\n}", "_keydown(event) {\n switch (event.keyCode) {\n // Toggle for space and enter keys.\n case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_7__[\"SPACE\"]:\n case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_7__[\"ENTER\"]:\n if (!Object(_angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_7__[\"hasModifierKey\"])(event)) {\n event.preventDefault();\n this._toggle();\n }\n break;\n default:\n if (this.panel.accordion) {\n this.panel.accordion._handleHeaderKeydown(event);\n }\n return;\n }\n }", "function onKeyDown(event){\n \n //keyboard events\n switch(event.keyCode){\n case 48:\n case 96:\n lookUp = true;\n break;\n case 38: //up\n case 87: //w\n console.log('w');\n moveForward = true;\n break;\n case 37: //left\n case 65: //a\n moveLeft = true;\n break;\n case 40: //down \n case 83: //s\n moveBackward = true;\n break;\n case 39: //right\n case 68: //d\n moveRight = true;\n break;\n }//end switch\n}", "function onKeyDown(event){\n var key = (event.keyCode) ? event.keyCode : event.which;\n\n if (currentGameState === GameState.IN_GAME) {\n switch (key) {\n case String('W').charCodeAt():\n case String('A').charCodeAt():\n case String('S').charCodeAt():\n case String('D').charCodeAt():\n case String('Q').charCodeAt():\n case String('E').charCodeAt():\n case String(' ').charCodeAt():\n case 37: // Left arrow\n case 38: // Up arrow\n case 39: // Right arrow\n case 40: // Down arrow\n if(pressedKeysArray.indexOf(key) == -1) {\n pressedKeysArray.push(key);\n }\n }\n }\n}", "function receive(key, handler) {\n pxsim.board().bus.listen(key, 0x1, handler);\n }", "function handleKeyDown(event) {\n console.log(\"Key down \", event.key, \" code \", event.code);\n if (event.key == \"ArrowDown\" || event.key == \"ArrowUp\" || event.key == \"ArrowLeft\" || event.key == \"ArrowRight\") {\n event.preventDefault();\n }\n \n currentlyPressedKeys[event.key] = true;\n\n //if key = o, add one particle\n if (currentlyPressedKeys[\"o\"]) {\n particleNum = particleNum + 1;\n }\n //if key = p, add five particles\n if (currentlyPressedKeys[\"p\"]) {\n particleNum = particleNum + 5;\n }\n //if key = r, remove all particles\n if (currentlyPressedKeys[\"r\"]) {\n particles = [];\n particleNum = 0;\n }\n //if key = n, reset particles on screen to 1\n if (currentlyPressedKeys[\"n\"]) {\n particles = [];\n particleNum = 1; \n }\n}", "function pressKey(event) {\n currentKey = event.which;\n}", "function keyDown (event) {\n let key = event.key;\n key = standardizeKey(key);\n if (keyIsValid(key)) {\n addActiveClasses(key);\n }\n}", "function receiveKey(event) {\n\tvar code = keyCodeStr(event);\n\tif (!code) {\n\t\treturn;\n\t}\n\tvar type = event.type;\n\tvar target = event.target;\n\tvar data = {\n\t\tstate: event.type.replace(/^key/, ''),\n\t\tcode: code,\n\t\tkey: event.key,\n\t\telement: target\n\t};\n\t/*\n\t * Generate key-press events for:\n\t * * repeat \"down\" messages\n\t * * only the first \"up\" message\n\t * where the key string is exactly the same as that of the last \"down\"\n\t * message.\n\t *\n\t * Do not generate duplicate consecutive \"down\" messages, convert to\n\t * key-press instead.\n\t */\n\tif (lastKeyDown && data.code === lastKeyDown.code) {\n\t\tvar pressData = _.clone(data);\n\t\tpressData.state = 'press';\n\t\tdispatchEvent(pressData, event);\n\t\tif (data.state === 'down') {\n\t\t\t/* Don't generate duplicate \"down\" events */\n\t\t\treturn;\n\t\t}\n\t}\n\tif (data.state === 'down') {\n\t\tlastKeyDown = data;\n\t}\n\tif (data.state === 'up') {\n\t\tlastKeyDown = null;\n\t}\n\tdispatchEvent(data, event);\n}", "function onkey(event) {\n\n if (!(event.metaKey || event.altKey || event.ctrlKey)) {\n event.preventDefault();\n }\n\n if (event.charCode == 'z'.charCodeAt(0)) { // z\n controls.zeroSensor();\n } else if (event.charCode == 'f'.charCodeAt(0)) { // f\n effect.setFullScreen( true );\n } else if (event.charCode == 'w'.charCodeAt(0)) { // w - move a row up\n animator.changeRow( -1 );\n currentRow -= 1;\n } else if (event.charCode == 's'.charCodeAt(0)) { // s - move a row down\n animator.changeRow( 1 );\n currentRow += 1;\n } else if (event.charCode == 'a'.charCodeAt(0)) { // a - spin row left\n animator.spinRow( -1 );\n } else if (event.charCode == 'd'.charCodeAt(0)) { // d - spin row right\n animator.spinRow( 1 );\n }\n}", "function handleInput (key) {\n if (keysDown[key] && !wasDown[key]) {\n const historyItem = ['keydown', key]\n /* socket.send(JSON.stringify(historyItem))*/\n wasDown[key] = true\n // play engine sound if we're thrusting\n if (key === 'up' || key === 'down') {\n sounds.engine.play()\n }\n return historyItem\n } else if (!keysDown[key] && wasDown[key]) {\n const historyItem = ['keyup', key]\n /* socket.send(JSON.stringify(historyItem))*/\n wasDown[key] = false\n // Pause engine sound if we aren't holding down other thrust keys\n if (wasDown['up'] === false && wasDown['down'] === false) {\n sounds.engine.pause()\n }\n return historyItem\n }\n}", "_keypressHandler(chunk, key)\n\t\t{\n\t\t\tif(key)\n\t\t\t{\n\t\t\t\tif(key.name == \"return\")\n\t\t\t\t{\n\t\t\t\t\tSCli.log(\"\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif((key.ctrl && key.name == \"c\") || (key.name == \"escape\"))\n\t\t\t\t{\n\t\t\t\t\tSCli.log(\"Monitoring stopped.\");\n\t\t\t\t\tprocess.exit();\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function handleKeyDown(e) {\n // use common key handling code with custom switch callback\n return handleKeySignals(e, function (e, player) {\n var nonGameKeyPressed = true;\n var now = Date.now();\n switch (e.keyCode) {\n case leftKey:\n if (!keyPressedLeft && now - lastLeftKeydownTime > keyUpLag) {\n keyPressedLeft = true;\n player.startLeftMotion();\n }\n lastLeftKeydownTime = now;\n nonGameKeyPressed = false;\n break;\n case rightKey:\n if (!keyPressedRight && now - lastRightKeydownTime > keyUpLag) {\n keyPressedRight = true;\n player.startRightMotion();\n }\n lastRightKeydownTime = now;\n nonGameKeyPressed = false;\n break;\n case downKey:\n if (!keyPressedDown && now - lastDownKeydownTime > keyUpLag) {\n keyPressedDown = true;\n player.startDownMotion();\n }\n lastDownKeydownTime = now;\n nonGameKeyPressed = false;\n break;\n case upKey:\n if (!keyPressedUp && now - lastUpKeydownTime > keyUpLag) {\n keyPressedUp = true;\n player.startUpMotion();\n }\n lastUpKeydownTime = now;\n nonGameKeyPressed = false;\n break;\n }\n // return necessary to tell the browser whether it should handle the\n // key separately; don't want game keys being passed back to the\n // browser\n return nonGameKeyPressed;\n });\n}", "handleInput(keyCode) {\n\n switch (keyCode) {\n case 'left':\n if (this.x - 100 >= 0) {\n this.x -= 100;\n }\n break;\n case 'right':\n if (this.x + 100 <= 400) {\n this.x += 100;\n }\n break;\n case 'up':\n if (this.y - 80 >= -80) {\n this.y -= 80;\n }\n break;\n case 'down':\n if (this.y + 80 <= 440) {\n this.y += 80;\n }\n break;\n }\n }", "handleInput(key){\n switch (key) {\n case 'left':\n this.x -= this.speed + 50; \n break;\n case 'up':\n this.y -= this.speed + 40; \n break;\n case 'right':\n this.x += this.speed + 50;\n break;\n case 'down':\n this.y += this.speed + 40;\n break;\n }\n }", "function keydown(ev){\n\tswitch(ev.keyCode){\n\t\tcase 87: // 'w' key\n\t\t\tcamera_z -= 0.5;\n\t\t\tbreak;\n\t\tcase 65: // 'a' key\n\t\t\tcamera_x -= 0.5;\n\t\t\tbreak;\n\t\tcase 83: // 's' key\n\t\t\tcamera_z += 0.5;\n\t\t\tbreak;\n\t\tcase 68: // 'd' key\n\t\t\tcamera_x += 0.5;\n\t\t\tbreak;\n\t\tcase 37: // left arrow key\n\t\t\tcamera_rotate -= 0.01;\n\t\t\tbreak;\n\t\tcase 39: // right arrow key\n\t\t\tcamera_rotate += 0.01;\n\t\t\tbreak;\n\t\tcase 82: // 'r' key (reset camera)\n\t\t\tcamera_x = 0.0;\n\t\t\tcamera_y = 2.5;\n\t\t\tcamera_z = 25.0;\n\t\t\tcamera_rotate = 4.71239;\n\t\t\tchairs_moving = false;\n\t\t\tchair_move_amount = 0;\n\t\t\ttable_rotate = 0;\n\t\t\tsky_channel = true;\n\t\t\tbreak;\n\t\tcase 32: // space key\n\t\t\tsky_channel = !sky_channel\n\t\t\tbreak;\n\t\tcase 74: // 'j' key\n\t\t\ttable_rotate -= 0.4;\n\t\t\tbreak;\n\t\tcase 76: // 'l' key\n\t\t\ttable_rotate += 0.4;\n\t\t\tbreak;\n\t\tcase 17: // Left control\n\t\t\tchairs_moving = !chairs_moving;\n\t\t\tif(!chairs_moving){\n\t\t\t\tchair_move_amount = 0;\n\t\t\t}\n\t\t\tbreak;\n\t}\n}", "function handleKeyDown(event) {\r\n keysPressed[event.keyCode] = true;\r\n // Disable the defeault effect of this key press (ie down arrow doesn't scroll down)\r\n event.preventDefault();\r\n}", "function doKeyDown(evt) {\n var keyCode = evt.keyCode; // code for the key that was pressed\n \n if (keyCode >=34 && keyCode <= 40) {\n evt.preventDefault(); // Stop page from scrolling for arrow keys, home, end, pageup, pagedown.\n }\n if (evt.shiftKey) \n shiftBeingHeld = true;\n \n switch( keyCode ) {\n case 37: eyeX -= 10; break; // left arrow\n case 38: eyeY += 10;\n break; // up arrow\n case 39: eyeX += 10; break; // right arrow\n case 40: eyeY -= 10; break; // down arrow\n case 36: atX = origAtX;\n atY = origAtY;\n atZ = origAtZ;\n eyeX = origEyeX;\n eyeY = origEyeY;\n eyeZ = origEyeZ; break; // home\n case 82:\n case 114: rotationTurnedOn = !rotationTurnedOn; // the letter R\n }\n \n display(); \n}", "handleKeyPress(e) {\n if ((e.keyCode === 13 && this.state.fieldsString.length) || e.keyCode === 9) {\n e.preventDefault();\n this.handleSelection();\n this.handleBlur();\n } else if (e.keyCode === 38) {\n e.preventDefault();\n this.higherSuggestion();\n } else if (e.keyCode === 40) {\n e.preventDefault();\n this.lowerSuggestion();\n } else if (e.keyCode === 27) {\n e.preventDefault();\n this.handleBlur();\n } else {\n this.updateFieldKv(e);\n }\n }", "function handleKey(e) {\n if (e.key.includes(\"Arrow\")) {\n e.preventDefault(); // Prevent default only on Arrow keys\n draw({ key: e.key }); // Passing key is equal to key pressed\n }\n}", "handleKeyDown(ev) {\n const {vimMode} = this.props;\n const _handleKeyDown = vimMode ? this._handleKeyDownVim : this._handleKeyDown;\n\n if (ev.target.tagName === 'INPUT' || ev.metaKey || ev.ctrlKey) {\n return;\n }\n if (_handleKeyDown(ev.key, ev.shiftKey, ev.altKey)) {\n ev.preventDefault();\n ev.stopPropagation();\n }\n }", "function DoKeyDown (e) {\n\tif (e.keyCode === 8)\n\t{\n\t\t//Backspace - prevent going back a page\n\t\te.preventDefault();\n\t}\n\telse if (e.keyCode === 87)\n\t{\n\t\twKey = true;\n\t}\n\telse if (e.keyCode === 65)\n\t{\n\t\taKey = true;\n\t}\n\telse if (e.keyCode === 83)\n\t{\n\t\tsKey = true;\n\t}\n\telse if (e.keyCode === 68)\n\t{\n\t\tdKey = true;\n\t}\n\t\n\t//console.log(e.keyCode);\n}", "keyUp(_keycode) {}" ]
[ "0.7755275", "0.7531081", "0.72528416", "0.71958774", "0.7193752", "0.71915567", "0.7183363", "0.71574026", "0.712335", "0.71116465", "0.7088707", "0.7052036", "0.7050431", "0.7047419", "0.7047419", "0.70428956", "0.703125", "0.7002367", "0.69746387", "0.6955946", "0.69537616", "0.69381726", "0.69215024", "0.69156647", "0.6914845", "0.6866768", "0.68276054", "0.6797279", "0.6796711", "0.6781865", "0.6780861", "0.67792004", "0.6768412", "0.67554975", "0.67357016", "0.6733425", "0.67314833", "0.6709673", "0.6700927", "0.6699199", "0.6690547", "0.66885287", "0.6681362", "0.6679974", "0.6675799", "0.66665256", "0.6666277", "0.666264", "0.6633726", "0.66284674", "0.6626215", "0.6611086", "0.65943336", "0.6590648", "0.6590557", "0.6582895", "0.6577372", "0.657583", "0.6574945", "0.6571494", "0.6569788", "0.65565777", "0.6546837", "0.65426236", "0.65421456", "0.65402734", "0.65353745", "0.6530931", "0.65276605", "0.65242493", "0.6521663", "0.651974", "0.65187544", "0.65073967", "0.65073967", "0.6506491", "0.65015894", "0.6501079", "0.65003824", "0.64979297", "0.6496578", "0.64944285", "0.6494013", "0.6492051", "0.64869654", "0.6486888", "0.64784956", "0.6476682", "0.64708924", "0.64707047", "0.6470142", "0.6463534", "0.6452732", "0.6451125", "0.6449831", "0.6440489", "0.644022", "0.64364827", "0.6429483", "0.6425211", "0.64162636" ]
0.0
-1
Handle a key from the keypress event
function handleCharBinding(cm, e, ch) { return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "HandleKeyDown(event) {}", "function handleKeyPress({ key }) {\n dispatch(playerTyped(key.toLowerCase()));\n }", "handleInput(keycode) {\n if (keycode !== undefined && player.moves === true) {\n key = keycode;\n }\n }", "handleKeyPress(kEvent) {\n switch (kEvent.keyCode) {\n case Phaser.KeyCode.BACKSPACE:\n this.deleteChar();\n break;\n case Phaser.KeyCode.LEFT:\n case Phaser.KeyCode.RIGHT:\n case Phaser.KeyCode.UP:\n case Phaser.KeyCode.DOWN:\n console.warn('CMD NAV NOT IMPLEMENTED');\n break;\n case Phaser.KeyCode.SPACEBAR:\n this.addTextToCommand(' ');\n break;\n case Phaser.KeyCode.ENTER:\n this.submitCommand();\n break;\n case Phaser.KeyCode.TAB:\n console.warn('CMD AUTOCOMPLETE NOT IMPLEMENTED');\n break;\n default:\n this.addTextToCommand(kEvent);\n break;\n }\n }", "function canvasHandleKeyPress(e){\r\n\tvar key = e.which;\r\n\tif(useStates){\r\n\t\tStates.current().input.handleKeyPress(e);\r\n\t}\r\n\tgInput.handleKeyPress(e);\r\n}", "function handleKey(event) { //function to create input when key is pressed\n\t\tvar pressedKey = event.key;\n\t\tmakeSound(pressedKey);\n\t\tbuttonAnimation(pressedKey);\n\t\tsetTimeout(buttonAnimation,500);\n\t\t// console.log(pressedKey);\n}", "function keyup_handler(event)\n{\n\tgame.handle_key(event.code, false);\n}", "function keyPressHandler(event)\n\t{\n\t\t// Make sure it's not the same event firing over and over again\n\t\tif (keyPressEvent == event) {\n\t\t\treturn;\n\t\t} else {\n\t\t\tkeyPressEvent = event;\n\t\t}\n\n\t\t// Get character that was typed\n\t\tvar charCode = event.which;\n\t\tif (charCode == KEYCODE_RETURN)\t// If return, clear and get out\n\t\t{\n\t\t\tclearTypingBuffer();\n\t\t\tclearTypingTimer();\n\t\t\treturn;\n\t\t}\n\n\t\t// Clear timer if still running, and start it again\n\t\tclearTypingTimer();\n\t\ttypingTimer = setTimeout(clearTypingBuffer, typingTimeout);\n\n\t\t// Add new character to typing buffer\n\t\tvar char = String.fromCharCode(charCode);\n\t\ttypingBuffer.push(char);\n\n\t\t// Check typed text for shortcuts\n\t\tcheckShortcuts(char, typingBuffer, event.target);\n\t}", "function keyHandler(e){\n\tvar keyCode = String(e.keyCode);\n\tupdateScore(keyCode);\n\tvar p1 = d.getElementById(\"keypressed\");\n\t//p1.innerHTML = e.keyCode;\n\tvar track = map_key_track[keyCode];\n \tstaticCircles.playedNote(track, new Date().getTime());\n \tplaySound(track);\n\t\n}", "_keypressHandler(chunk, key)\n\t\t{\n\t\t\tif(key)\n\t\t\t{\n\t\t\t\tif(key.name == \"return\")\n\t\t\t\t{\n\t\t\t\t\tSCli.log(\"\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif((key.ctrl && key.name == \"c\") || (key.name == \"escape\"))\n\t\t\t\t{\n\t\t\t\t\tSCli.log(\"Monitoring stopped.\");\n\t\t\t\t\tprocess.exit();\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function keyPressed() {\n if (handler.active === handler.nameplate) {\n doorbell.keyPressed();\n }\n}", "function canvasHandleKeyDown(e){\r\n\tvar key = e.keyCode;\r\n\t//println(key);\r\n\tif(useStates){\r\n\t\tStates.current().input.handleKeyDown(e);\r\n\t}\r\n\tgInput.handleKeyDown(e);\r\n}", "function handleKeyPress(event) {\n\n var action = getSwitcherAction(event.keyCode);\n\n switch (action) {\n case Config.GOING_UP:\n case Config.GOING_DOWN:\n moveListFocus(action);\n break;\n case Config.ESCAPING:\n $(Config.LIST_SWITCHER).hide();\n break;\n case Config.SWITCHING:\n switchToSelectedList();\n break;\n }\n }", "keyDown(_keycode) {}", "handleKeyDown (event) {\n }", "function onKeyPress(e) {\n const pressed = e.keyCode;\n\n switch(pressed) {\n case 82: // R\n handleRestart();\n break;\n case 83: // S\n handleStartMenu();\n break;\n case 27:\n // Esc\n handlePause();\n break;\n }\n}", "function pressKey(event) {\n currentKey = event.which;\n}", "function onKeyPress(event) {\n\t\n\tswitch (event.key) {\n\t\t\n\t\t// Light Keys\n\t\tcase \"ArrowDown\":\n\t\tcase \"ArrowUp\":\n\t\tcase \"ArrowRight\":\n\t\tcase \"ArrowLeft\":\n\t\tcase \"+\":\n\t\tcase \"-\":\n\t\t\tlightEventHandler(event);\n\t\t\tbreak;\n\n\t\t// Camera keys\n\t\tcase \"w\":\n\t\tcase \"s\":\n\t\tcase \"d\":\n\t\tcase \"a\":\n\t\tcase \"q\":\n\t\tcase \"e\":\n\t\t\tSC.keyPress(event); // pass the listener event to the camera (Required for SphericalCamera Module)\n\t\t\tupdateMVP(); // re-generate the MVP matrix and update it\n\t\t\tbreak;\n\t}\n\n\trender(); // draw with the new view\n}", "handleKeyPress(e) {\n if((this.gameOver() === 'won') || (this.gameOver() === 'loose')) {\n if (e.key === ' ') {\n this.restartGame();\n }\n } \n else {\n if ((e.keyCode >= 65) && (e.keyCode <= 90)) {\n this.handleKeyClick(e.key.toUpperCase());\n }\n }\n }", "handleKeyDown({ key }) {\n switch (key) {\n case \"Enter\":\n this.addTodoToState(this._inputEl.value);\n break;\n default:\n break;\n }\n }", "function onkey(event) {\n\n if (!(event.metaKey || event.altKey || event.ctrlKey)) {\n event.preventDefault();\n }\n\n if (event.charCode == 'z'.charCodeAt(0)) { // z\n controls.zeroSensor();\n } else if (event.charCode == 'f'.charCodeAt(0)) { // f\n effect.setFullScreen( true );\n } else if (event.charCode == 'w'.charCodeAt(0)) { // w - move a row up\n animator.changeRow( -1 );\n currentRow -= 1;\n } else if (event.charCode == 's'.charCodeAt(0)) { // s - move a row down\n animator.changeRow( 1 );\n currentRow += 1;\n } else if (event.charCode == 'a'.charCodeAt(0)) { // a - spin row left\n animator.spinRow( -1 );\n } else if (event.charCode == 'd'.charCodeAt(0)) { // d - spin row right\n animator.spinRow( 1 );\n }\n}", "function keyDownHandler(event) {\n keyHandler(true, event);\n}", "function handleKeyDown(event) {\r\n // storing the pressed state for individual key\r\n currentlyPressedKeys[event.keyCode] = true;\r\n}", "_handleKeyEvent(event) {\n const keyManager = this._keyManager;\n switch (event.keyCode) {\n case LEFT_ARROW:\n case RIGHT_ARROW:\n if (this._isHorizontal()) {\n event.preventDefault();\n keyManager.setFocusOrigin('keyboard');\n keyManager.onKeydown(event);\n }\n break;\n case UP_ARROW:\n case DOWN_ARROW:\n if (!this._isHorizontal()) {\n event.preventDefault();\n keyManager.setFocusOrigin('keyboard');\n keyManager.onKeydown(event);\n }\n break;\n case ESCAPE:\n if (!hasModifierKey(event)) {\n event.preventDefault();\n this._menuStack.close(this, 2 /* currentItem */);\n }\n break;\n case TAB:\n this._menuStack.closeAll();\n break;\n default:\n keyManager.onKeydown(event);\n }\n }", "function handleKeyDown(event) {\n wgl.listOfPressedKeys[event.keyCode] = true;\n // console.log(\"keydown - keyCode=%d, charCode=%d\", event.keyCode, event.charCode);\n }", "function keyPressed(event) {\n const digits = \"0123456789\";\n const operators = \"+-x*/\";\n if (digits.indexOf(event.key) !== -1) {\n digitPressed(event.key);\n } else if (operators.indexOf(event.key) !== -1) {\n operatorPressed(event.key);\n } else if (event.key === \"=\" || event.key === \"Enter\") {\n computeResult();\n } else if (event.key === \"c\" || event.key === \"C\") {\n clearDisplay();\n } else if (event.key === \".\") {\n addDecimal();\n } else if (event.key === \"m\" || event.key === \"M\") {\n flipSign();\n } else if (event.key === \"Backspace\") {\n deleteLastDigit();\n }\n}", "function keydown_handler(event)\n{\n\tif (event.defaultPrevented) return;\n\tif (game.handle_key(event.code, true)) return;\n\n\t// cancel the default action to avoid it being handled twice\n\tevent.preventDefault();\n}", "function handle_keypress(e) {\n var ch = (typeof e.which == \"number\") ? e.which : e.keyCode\n console.log(\"got char code:\", ch)\n if (ch == 97) { // 'a'\n grow_type_span()\n } else if (ch == 115) { // 's'\n shrink_type_span()\n } else if (ch == 113) { // 'q'\n remove_type_span()\n }\n}", "handleKeySignal(signal) {\n this.handleKeyPress(signal.event);\n }", "function processKeyPress(keycode) {\n if (keycode === 65) {\n playNote('a')\n }\n if (keycode === 83) {\n playNote('c')\n }\n if (keycode === 68) {\n playNote('d')\n }\n if (keycode === 70) {\n playNote('f')\n }\n}", "function handleKeyDown(event) {\n switch (event.key) {\n case \"Escape\":\n closeSuggestions();\n break;\n case \"ArrowDown\":\n highlightNext();\n break;\n case \"ArrowUp\":\n highlightPrev();\n break;\n case \"Enter\":\n selectItem();\n }\n}", "function handleKey(e) {\n if (e.key.includes(\"Arrow\")) {\n e.preventDefault();\n draw({ key: e.key }); // Here the key object is being deconstructing that its value is the key that the event had\n console.log(e.key);\n console.log(\"HANDLE KEYY!!\")\n };\n}", "function onKeyDown(e) {\n // do not handle key events when not in input mode\n if (!imode) {\n return;\n }\n\n // only handle special keys here\n specialKey(e);\n }", "function keyPressed() {\n}", "function handleKey(event) {\n if (event.key.includes('Arrow')) {\n event.preventDefault();\n draw({ key: event.key });\n // console.log(event.key);\n // console.log('handling key');\n }\n}", "function keyPress (key) {\n if(typeof(key) == \"string\"){\n var value = key\n } else if (typeof(key) == \"object\"){\n var value = key.innerText;\n }\n\n if(!isNaN(parseInt(value))){\n //If the key is a number, act accordingly\n update(numberPressed(value));\n } else {\n //If the key is not a number, act accordingly\n functionPressed(value);\n }\n}", "function keyPress(event) {\n if (event.key === \"Enter\") {\n guess();\n }\n }", "function keyPressed() {\n if (gameView == VIEW_GAME) {\n //Ingame\n if (keyCode == UP_ARROW) {\n console.log(\"up\")\n }\n if (keyCode == DOWN_ARROW) {\n console.log(\"down\")\n }\n if (keyCode == LEFT_ARROW) {\n console.log(\"left\")\n }\n if (keyCode == RIGHT_ARROW) {\n console.log(\"right\")\n }\n if (key == ' ') {\n console.log(\"Space\");\n shakeTimer = 0.1;\n }\n\n if (key == 'p') {\n console.log(\"Pressed P key\")\n submitScore();\n }\n\n if (key == 'e') {\n console.log(\"Pressed E key\")\n\n spawnExplosion(camera.mouseX, camera.mouseY, 3);\n }\n }\n\n\n if (keyCode == ESCAPE) {\n gameView = VIEW_MAIN_MENU;\n }\n}", "keyUp(_keycode) {}", "function handleKey(key){\n //I send the submission only if I'm not on an input text and there's a displayed paper and I'm not already submitting\n if(document.activeElement.type !== \"text\" && display && !voteSubmission){\n arraySubmission(key);\n }\n }", "keypressInput(e) {\n // console.log(e);\n let keycode = event.key; // also for cross-browser compatible\n (this.acceptMoves) && this.ea.publish('keyPressed', keycode);\n }", "keypress ( target, keyText ) {\n target.dispatchEvent(_keyboardEventFor('keypress', Editor.KeyCode(keyText)));\n }", "function keydown(event) {\n keys[event.code] = event;\n }", "function keyPressHandler(e) {\r\n if (e.which === 117) rocket1.moveUp(10);\r\n if (e.which === 100) rocket1.moveDown(10);\r\n if (e.which === 114) rocket1.moveRight(10);\r\n if (e.which === 108) rocket1.moveLeft(10);\r\n if (e.which === 32) {\r\n soundFiring();\r\n rocket1.addBullet(rocket1.x, rocket1.y + rocket1.height / 2);\r\n }\r\n if (e.which === 48) {\r\n clearInterval(animate);\r\n }\r\n if (e.which === 49) {\r\n clearInterval(animate);\r\n animate = setInterval(animation, 100);\r\n }\r\n }", "function processKeyPress(event){\n if (!validKeys.includes(event.keyCode)) {\n return;\n }\n // prevent default browser mapping of keys\n event.preventDefault();\n\n let isShifted = event.shiftKey;\n let element = undefined;\n \n if (isShifted) {\n let shiftedKey = shiftedKeys[event.keyCode];\n element = document.querySelector(`[data-key=\"${shiftedKey}\"]`);\n } else {\n element = document.querySelector(`[data-key=\"${event.keyCode}\"]`);\n }\n let mouseDown = new Event('mousedown');\n element.dispatchEvent(mouseDown);\n // init mouse up and delay 100 ms, keyup seems to fire faster than mouseup so when using keyboard you can barely see calculator key animations\n setTimeout(() => {\n let mouseUp = new Event('mouseup');\n element.dispatchEvent(mouseUp);\n }, 100);\n }", "handleKeyDown(kCode) {\n console.log(\"handleKeyDown \" + this.id + \" \" + kCode)\n }", "function keyDown(evt) {\n var c = (evt.keyCode) ? evt.keyCode : evt.charCode;\n switch(c) {\n case 37: // left\n case 63234:\n dx = 1; break;\n case 39: // right\n case 63235:\n dx = -1; break;\n case 40: // down\n case 63233:\n dy = -1; break;\n case 38: // up\n case 63232:\n dy = 1; break;\n case 32: // fire\n if (Torpedo.x) {\n playSound('notAvail');\n message('Not loaded new torpedo yet!');\n mainPanel(\"#779\");\n } else Torpedo.fire();\n break;\n case 16: // shift\n withShift = 1; break;\n case 27: // esc\n gameRunning = score = 0;\n IntroOutro.endAnimDest(0 , 1, 1);\n }\n}", "function handleKeyDown(event) {\n console.log(\"Key down \", event.key, \" code \", event.code);\n if (event.key == \"ArrowDown\" || event.key == \"ArrowUp\" || event.key == \"ArrowLeft\" || event.key == \"ArrowRight\") {\n event.preventDefault();\n }\n \n currentlyPressedKeys[event.key] = true;\n\n //if key = o, add one particle\n if (currentlyPressedKeys[\"o\"]) {\n particleNum = particleNum + 1;\n }\n //if key = p, add five particles\n if (currentlyPressedKeys[\"p\"]) {\n particleNum = particleNum + 5;\n }\n //if key = r, remove all particles\n if (currentlyPressedKeys[\"r\"]) {\n particles = [];\n particleNum = 0;\n }\n //if key = n, reset particles on screen to 1\n if (currentlyPressedKeys[\"n\"]) {\n particles = [];\n particleNum = 1; \n }\n}", "function handleKeyDown(event) {\n currentlyPressedKeys[event.keyCode] = true;\n }", "function handle (key, velocity) {\r\n\r\n console.log('got \"keypress\"', key);\r\n\r\n if (key === \"B\") {\r\n orb.color(\"blue\");\r\n }\r\n\r\n if (key === \"R\") {\r\n orb.color(\"red\");\r\n }\r\n\r\n if (key === \"S\") {\r\n startCalibration();\r\n }\r\n\r\n if (key === \"F\") {\r\n stopCalibration(configureLocator);\r\n }\r\n\r\n if (key === \"&\") {\r\n roll(velocity, 0);\r\n }\r\n\r\n if (key === \"'\") {\r\n roll(velocity, 90);\r\n }\r\n\r\n if (key === \"(\") {\r\n roll(velocity, 180);\r\n }\r\n\r\n if (key === \"%\") {\r\n roll(velocity, 270);\r\n }\r\n}", "function computeKey(event){\n if(event.code == 'KeyV')\n scene.changeActiveCamera();\n else if(event.code == 'Space' && !scene.endedGame) //barra espaciadora\n scene.pauseGame();\n else if(!scene.pausedGame)\n scene.computeKey(event);\n}", "function keydown() {\n switch (d3.event.keyCode) {\n case 8: // backspace\n {\n break;\n }\n case 46: { // delete\n delete_node = true;\n break;\n }\n case 16: { //shift\n should_modify = true;\n break;\n }\n case 17: { //control\n drawing_line = true;\n }\n\n }\n}", "function handleKey(e){\n if(e.key.includes('Arrow')){\n e.preventDefault();\n console.log(e.key);\n draw({key: e.key});\n console.log('HANDLING KEY');\n }\n}", "function handleKeys(e){\n\tswitch (e.keyCode){\n\t\tcase 67: \t\t\t// 'c'\n\t\t\tcomposeWindowOpener();\n\t\t\tbreak;\n\t\tcase 88: \t\t\t// 'x'\n\t\t\tselectEmail();\n\t\t\tbreak;\n\t\tcase 38: \t\t\t// 'up'\n\t\tcase 74: \t\t\t// 'j'\n\t\t\trowSelector(-1);\n\t\t\tbreak;\n\t\tcase 40: \t\t\t// 'down'\n\t\tcase 75: \t\t\t// 'k'\n\t\t\trowSelector(1);\n\t\t\tbreak;\n\t\tcase 46: \t\t\t// 'del'\n\t\t\tcloseAd_keyEvent();\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tconsole.log(\"not listening to keyCode\",e.keyCode);\n\t}\n}", "handleKeydown(event) {\n if (event.which === 13 || event.which === 27) { // enter or esc\n this.finishUpdate();\n }\n }", "function onKeyPress(event){\n\t\t \n\t\tvar obj = jQuery(event.target);\n\t\tif(obj.is(\"textarea\") || obj.is(\"select\") || obj.is(\"input\"))\n\t\t\treturn(true);\n\t\t\t\n\t\t var keyCode = (event.charCode) ? event.charCode :((event.keyCode) ? event.keyCode :((event.which) ? event.which : 0));\n\t\t \n\t\t switch(keyCode){\n\t\t\t case 39:\t//right key\n\t\t\t\t t.nextItem();\n\t\t\t\t event.preventDefault();\n\t\t\t break;\n\t\t\t case 37:\t//left key\n\t\t\t\t t.prevItem();\n\t\t\t\t event.preventDefault();\n\t\t\t break;\n\t\t }\n\t\t \n\t\tg_objGallery.trigger(t.events.GALLERY_KEYPRESS, keyCode);\n\t}", "keyHandler(event){\n switch(event.which){\n // previous slide\n case 33: // pgup\n case 37: // left\n event.preventDefault();\n this.previous();\n break;\n\n // next slide\n case 32: // spacebar\n case 34: // pgdn\n case 39: // right\n event.preventDefault();\n this.next()\n break;\n\n // autoplay\n case 65: // a\n event.preventDefault();\n this.toggleAutoplay();\n break;\n\n // fullscreen\n case 70: // f\n event.preventDefault();\n this.fullscreen();\n break;\n\n // goto home slide\n case 72: // h\n event.preventDefault();\n this.goto(1);\n break;\n\n // play / pause\n case 80: // p\n event.preventDefault();\n this.playAudio();\n break;\n\n // transcript / table of contents\n case 84: // t\n event.preventDefault();\n this.toggleTranscript();\n break;\n }\n }", "function keypress(ev) {\n if (hasGameEnded(guesses, secret)) {\n return;\n }\n if (ev.key === \"Enter\") {\n makeGuess();\n }\n }", "handleKeyUp(){\n\n }", "function handleKeydown(event)\n {\n\n switch(event.which)\n { \n \n case 13: \n handleEnterKey(event);\n break;\n \t \n case 36:\n event.preventDefault();\n handleInitKey();\n break;\n \n case 46: \n preventPromptErasing(event, true);\n break;\n \t \n case 8: \n case 37: \n preventPromptErasing(event, false);\n break;\n \n case 38: \n event.preventDefault();\n applyCommandHistory(true);\n break;\n \n case 40: \n applyCommandHistory(false);\n event.preventDefault();\n break;\n \n default: \n // As of now, nothing is done in this case.\n break;\n }\n }", "function handleKeyDown(event) { // ko pritisnemo tipko\n // storing the pressed state for individual key\n currentlyPressedKeys[event.keyCode] = true; // tipka z določeno kodo je trenutno pritisnjena\n\n // handling single keypress for switching filters\n if (String.fromCharCode(event.keyCode) == \"F\") { // če pritisnemo tipko za menjavo filtrov\n filter += 1;\n if (filter == 3) {\n filter = 0;\n }\n }\n}", "_handleKeyPress(input){\n switch (typeof input){\n case 'number': return this._handleNumericalKeyPress(input);\n case 'string': return this._handleOperationKeyPress(input);\n }\n }", "checkKeyPress(event){\n if (event.key === 'Enter') {\n this.doThing();\n }\n }", "function keyPress(ev) {\n // submit guess when the user hits enter\n if (ev.key == \"Enter\") {\n guess(text);\n setText('')\n // prevent non-digit guesses\n } else if (!((ev.key == \"0\") ||\n (ev.key == \"1\") ||\n (ev.key == \"2\") ||\n (ev.key == \"3\") ||\n (ev.key == \"4\") ||\n (ev.key == \"5\") ||\n (ev.key == \"6\") ||\n (ev.key == \"7\") ||\n (ev.key == \"8\") ||\n (ev.key == \"9\")\n )) {\n ev.preventDefault();\n }\n }", "function keyPressed() {\n\t// toggle fullscreen mode\n\tif( key === 'f') {\n\t\tfs = fullscreen();\n\t\tfullscreen(!fs);\n\t\treturn;\n\t}\n\n\t// dispatch key events for adventure manager to move from state to \n\tadventureManager.keyPressed(key); \n}", "function keyPressed() {\n // toggle fullscreen mode\n if( key === 'f') {\n fs = fullscreen();\n fullscreen(!fs);\n return;\n }\n\n // dispatch all keys to adventure manager\n adventureManager.keyPressed(key); \n}", "function keyPressed() {\n // toggle fullscreen mode\n if( key === 'f') {\n fs = fullscreen();\n fullscreen(!fs);\n return;\n }\n\n // dispatch all keys to adventure manager\n adventureManager.keyPressed(key); \n}", "handleKeyPress(e) {\n if ((e.keyCode === 13 && this.state.fieldsString.length) || e.keyCode === 9) {\n e.preventDefault();\n this.handleSelection();\n this.handleBlur();\n } else if (e.keyCode === 38) {\n e.preventDefault();\n this.higherSuggestion();\n } else if (e.keyCode === 40) {\n e.preventDefault();\n this.lowerSuggestion();\n } else if (e.keyCode === 27) {\n e.preventDefault();\n this.handleBlur();\n } else {\n this.updateFieldKv(e);\n }\n }", "function keydown(evt) {\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n\r\n switch (keyCode) {\r\n case \"A\".charCodeAt(0):\r\n player.motion = motionType.LEFT;\r\n player.facing = facingDir.LEFT;\r\n break;\r\n\r\n case \"D\".charCodeAt(0):\r\n player.motion = motionType.RIGHT;\r\n\t\t\tplayer.facing = facingDir.RIGHT;\r\n break;\r\n\r\n case \"W\".charCodeAt(0):\r\n if (player.isOnPlatform()||cheating) {\r\n player.verticalSpeed = JUMP_SPEED;\r\n }\r\n break;\r\n\r\n\t\tcase \"C\".charCodeAt(0):\r\n\t\t\tif (!cheating){\r\n\t\t\t\tplayer.rolenode.style.setProperty(\"opacity\", 0.5, null);\r\n\t\t\t\tcheating = true;\r\n\t\t\t\tOLD_BCOUNT = BULLET_COUNT;\r\n\t\t\t\tBULLET_COUNT = Number.POSITIVE_INFINITY;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"V\".charCodeAt(0):\r\n\t\tif (cheating){\r\n\t\t\t\tplayer.rolenode.style.setProperty(\"opacity\", 1, null);\r\n\t\t\t\tcheating = false;\r\n\t\t\t\tBULLET_COUNT = OLD_BCOUNT;\r\n\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"Q\".charCodeAt(0):\r\n\t\t\talert( player.position.x+ \", \"+ (player.position.y - 5) );\r\n\t\t\tbreak;\r\n\r\n\r\n\t\tcase 32:\r\n if (canShoot) shootBullet();\r\n break;\r\n }\r\n}", "function keyHandler(evt){\n keymap[evt.key] = (evt.type == 'keydown');\n}", "function keyEvent(event) {\n console.log(\"KEY: \" + event.name + \"=\" + event.isPressed);\n if (event.name == 'UP'){\n\t\tactivesensor = 'T';\n\t\tled.sync.showMessage(activesensor);\n\t} else if (event.name == 'LEFT'){\n\t\tactivesensor = 'P';\n\t\tled.sync.showMessage(activesensor);\n\t} else if (event.name == 'RIGHT'){\n\t\tactivesensor = 'H';\n\t\tled.sync.showMessage(activesensor);\n\t}\n}", "function handleInput (key) {\n if (keysDown[key] && !wasDown[key]) {\n const historyItem = ['keydown', key]\n /* socket.send(JSON.stringify(historyItem))*/\n wasDown[key] = true\n // play engine sound if we're thrusting\n if (key === 'up' || key === 'down') {\n sounds.engine.play()\n }\n return historyItem\n } else if (!keysDown[key] && wasDown[key]) {\n const historyItem = ['keyup', key]\n /* socket.send(JSON.stringify(historyItem))*/\n wasDown[key] = false\n // Pause engine sound if we aren't holding down other thrust keys\n if (wasDown['up'] === false && wasDown['down'] === false) {\n sounds.engine.pause()\n }\n return historyItem\n }\n}", "onElementKeyPress(event) {}", "onElementKeyPress(event) {}", "function getKey(e){\n if (e == null) { // ie\n keycode = event.keyCode;\n } else { // mozilla\n keycode = e.which;\n }\n key = String.fromCharCode(keycode).toLowerCase();\n\n if(key == 'x'){ hideContentModal(); }\n}", "function keyPressHandler(evt) {\n evt = evt || window.event;\n if (evt) {\n var keyCode = evt.charCode || evt.keyCode;\n charLogged = String.fromCharCode(keyCode);\n stream.push(charLogged);\n }\n }", "function handleKeyDown(e) {\n counter = counter + 1;\n if (counter === 1) {\n socket.emit('typing', name)\n }\n window.clearTimeout(timer);\n}", "function onkey(event) {\r\n event.preventDefault();\r\n\r\n if (vr) {\r\n if (event.keyCode == 90) // z\r\n controls.resetSensor(); //zero rotation\r\n else if (event.keyCode == 70 ) //f or enter\r\n effect.setFullScreen(true) //fullscreen\r\n else if (event.key == 'Enter') {\r\n\r\n console.log('ugh');\r\n onMouseDown();\r\n }\r\n }\r\n\r\n // some controls\r\n if(event.keyCode == 87) // w\r\n camera.position.z -= 0.8;\r\n else if(event.keyCode == 83) // s\r\n camera.position.z += 0.8;\r\n else if(event.keyCode == 65) // a\r\n camera.position.x -= 0.8;\r\n else if(event.keyCode == 68) // d\r\n camera.position.x += 0.8;\r\n}", "onKeyPressed(event){\n switch(event.keyCode){\n case 13: /** ENTER */\n this.command.state = this.command.stateFactory.getFinalizeState(this.command);\n this.command.state.onEpsilon();\n break;\n case 27: /** ESCAPE */\n this.command.state = this.command.stateFactory.getIdleState(this.command);\n break;\n }\n }", "myKeyPress(k) {\n if (k.key === 'Enter') {\n this.sendPost(k)\n }\n }", "_handleKeydown(event) {\n // We don't handle any key bindings with a modifier key.\n if (Object(_angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_14__[\"hasModifierKey\"])(event)) {\n return;\n }\n switch (event.keyCode) {\n case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_14__[\"ENTER\"]:\n case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_14__[\"SPACE\"]:\n if (this.focusIndex !== this.selectedIndex) {\n this.selectFocusedIndex.emit(this.focusIndex);\n this._itemSelected(event);\n }\n break;\n default:\n this._keyManager.onKeydown(event);\n }\n }", "function keypressChatHandler(\n/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/\n /**\n * The event object. */\n event\n)\n/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/\n{\n /*\n * We have no action for key press combinations with the Alt key. */\n if (event.altKey) {\n return;\n }\n /*\n * Plain key presses (no Alt or Ctrl key combinations). */\n if (!event.ctrlKey) {\n switch (event.which || event.keyCode) {\n case 13: /* 'Enter key' */\n app.log(2, 'Enter key pressed in chat handler');\n event.preventDefault();\n sendChat();\n break;\n } /* switch (event.which) */\n }\n}", "function keyPress(e) {\n var x = e || window.event;\n var key = x.keyCode || x.which;\n if (key == 13 || key == 3) {\n //runs this function when enter is pressed\n newEntry();\n }\n if (key == 38) {\n console.log(\"hi\");\n //document.getElementById(\"chatbox\").value = lastUserMessage;\n }\n}", "function cust_KeyDown(evnt) {\n //f_log(evnt.keyCode)\n}", "static trackKeypress(_event) {\n _event.preventDefault();\n Setup.keyPressed[_event.keyCode] = (_event.type == \"keydown\");\n }", "function keyPressDown(event){\n\n let key = (96 <= event.keyCode && event.keyCode <= 105)? event.keyCode - 48 : event.keyCode;\n if(key >= 16 && key <= 18){\n\n if(pressedModifiers.indexOf(key) === -1){\n\n pressedModifiers.push(key);\n }\n if(event.data && event.data.modifierFunc){\n\n event.data.modifierFunc(event);\n }\n\n } else {\n\n if(event.data && event.data.keyFunc){\n\n event.data.keyFunc(event);\n }\n }\n if(event.data && event.data.func){\n\n event.data.func(event);\n }\n for (var handler in waitingForInput) {\n if (waitingForInput.hasOwnProperty(handler)) {\n waitingForInput[handler](event);\n }\n }\n\n}", "function KeyDetect(event)\r\n {\r\n var key=event.key; //storing the value in variable.\r\n \r\n Play(key); //Passing the value to Play function();\r\n Ani(key);\r\n }", "function keyPressed(){\n\tgameManager.keyPressed();\n}", "function handlerUserInput() {\n\tdocument.addEventListener('keyup', function(event) {\n\t\tconsole.log(event);\n\t\tconsole.log(event.key); //k\n\t});\n}", "function handleKeyEvent(event) {\n if (isEventModifier(event)) {\n return;\n }\n\n if (ignoreInputEvents && isInputEvent(event)) {\n return;\n }\n\n const eventName = getKeyEventName(event);\n const listeners = __subscriptions[eventName.toLowerCase()] || [];\n\n if (typeof __monitor === 'function') {\n const matched = listeners.length > 0;\n __monitor(eventName, matched, event);\n }\n\n if (listeners.length) {\n event.preventDefault();\n }\n\n // flag to tell if execution should continue;\n let propagate = true;\n //\n for (let i = listeners.length - 1; i >= 0; i--) {\n if (listeners[i]) {\n propagate = listeners[i](event);\n }\n if (propagate === false) {\n break;\n }\n }\n // listeners.map(listener => listener());\n }", "function keyup(evt) {\r\n // Get the key code\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n\r\n switch (keyCode) {\r\n case \"A\".charCodeAt(0):\r\n if (player.motion == motionType.LEFT) player.motion = motionType.NONE;\r\n break;\r\n\r\n case \"D\".charCodeAt(0):\r\n if (player.motion == motionType.RIGHT) player.motion = motionType.NONE;\r\n break;\r\n }\r\n}", "function keyup(evt) {\r\n // Get the key code\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n\r\n switch (keyCode) {\r\n case \"A\".charCodeAt(0):\r\n if (player.motion == motionType.LEFT) player.motion = motionType.NONE;\r\n break;\r\n\r\n case \"D\".charCodeAt(0):\r\n if (player.motion == motionType.RIGHT) player.motion = motionType.NONE;\r\n break;\r\n }\r\n}", "function processKeys(key) {\n var pressedKey = key.keyCode? key.keyCode : key.charCode;\n // TODO: make this work on IE?\n// alert (pressedKey);\n if (32 === pressedKey) {\n togglePause();\n } else if (37 === pressedKey) {\n userLeft();\n } else if (39 === pressedKey) {\n userRight();\n } else if (38 === pressedKey) {\n userUp();\n } else if (40 === pressedKey) {\n userDown();\n } else if (13 === pressedKey) {\n dismissDialog();\n }\n }", "function keyPress(e) {\n var x = e || window.event;\n var key = x.keyCode || x.which;\n if (key == 13 || key == 3) {\n //runs this function when enter is pressed\n newEntry();\n }\n if (key == 38) {\n console.log('hi');\n //document.getElementById(\"chatbox\").value = lastUserMessage;\n }\n }", "function handleKeyDown(e) {\n\t\t//cross browser issues exist\n\t\tif(!e){ var e = window.event; }\n\t\tswitch(e.keyCode) {\n\t\t\tcase KEYCODE_SPACE:\tshootHeld = true; return false;\n\t\t\tcase KEYCODE_A:\n\t\t\tcase KEYCODE_LEFT:\tlfHeld = true; return false;\n\t\t\tcase KEYCODE_D:\n\t\t\tcase KEYCODE_RIGHT: rtHeld = true; return false;\n\t\t\tcase KEYCODE_W:\n\t\t\tcase KEYCODE_UP:\tfwdHeld = true; return false;\n\t\t\tcase KEYCODE_ENTER:\t if(canvas.onclick == handleClick){ handleClick(); }return false;\n\t\t}\n\t}", "function keydown(evt) {\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\n\n switch (keyCode) {\n case \"N\".charCodeAt(0):\n player.motion = motionType.LEFT;\n break;\n\n case \"M\".charCodeAt(0):\n player.motion = motionType.RIGHT;\n break;\n\t\t\t\n\n // Add your code here\n\t\t\n\t\t\t\n case \"Z\".charCodeAt(0):\n if (player.isOnPlatform()) {\n player.verticalSpeed = JUMP_SPEED;\n }\n break;\n\t\t\n\t\tcase 32: // spacebar = shoot\n\t\t\tif (canShoot) shootBullet();\n\t\t\tbreak;\n }\n}", "function onKeyPress(evt) {\n // Keys with modifiers are ignored\n if (evt.altKey || evt.ctrlKey || evt.metaKey) {\n return;\n }\n\n switch (evt.charCode || evt.keyCode) {\n case 43: // +\n zoom(1, window.innerWidth / 2, window.innerHeight / 2);\n break;\n case 45: // -\n zoom(-1, window.innerWidth / 2, window.innerHeight / 2);\n break;\n case 61: // =\n player.moveToCurrent();\n break;\n case 70: // F\n case 102: // f\n player.showAll();\n break;\n case 84: // T\n case 116: // t\n toggleFrameList();\n break;\n case 82: // R\n rotate(-1);\n break;\n case 114: // r\n rotate(1);\n break;\n }\n\n evt.stopPropagation();\n evt.preventDefault();\n }", "function handleKey(event) {\r\n\r\n\tvar i = gGamerPos.i;\r\n\tvar j = gGamerPos.j;\r\n\tconsole.log('ev', event);\r\n\r\n\tswitch (event.key) {\r\n\t\tcase 'ArrowLeft':\r\n\t\t\tif (i === 5 && j === 0) moveTo(5, 9)\r\n\t\t\telse moveTo(i, j - 1);\r\n\t\t\tbreak;\r\n\t\tcase 'ArrowRight':\r\n\t\t\tif (i === 5 && j === 11) moveTo(5, 0)\r\n\t\t\telse moveTo(i, j + 1);\r\n\t\t\tbreak;\r\n\t\tcase 'ArrowUp':\r\n\t\t\tif (i === 0 && j === 5) moveTo(9, 5)\r\n\t\t\telse moveTo(i - 1, j);\r\n\t\t\tbreak;\r\n\t\tcase 'ArrowDown':\r\n\t\t\tif (i === 9 && j === 5) moveTo(0, 5)\r\n\t\t\telse moveTo(i + 1, j);\r\n\t\t\tbreak;\r\n\t}\r\n\r\n}", "function keysHandle(e) {\n e.preventDefault;\n switch (e.keyCode) {\n case 83:\n if (!gameStarted) {\n displayCards();\n }\n break;\n case 82:\n if (gameStarted) {\n displayCards();\n }\n break;\n case 32:\n if (gameStarted) {\n if (pausePressed) {\n e.preventDefault();\n startTimer();\n pausePressed = false;\n } else {\n e.preventDefault();\n pause();\n pausePressed = true;\n }\n }\n break;\n }\n}", "function _keypress(e) {\n\t\tif (data.gallery.active && (e.keyCode == 37 || e.keyCode == 39)) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\t\n\t\t\tdata.$arrows.filter((e.keyCode == 37) ? \".previous\" : \".next\").trigger(\"click\");\n\t\t} else if (e.keyCode == 27) {\n\t\t\tdata.$boxer.find(\".boxer-close\").trigger(\"click\");\n\t\t}\n\t}", "handleInput(key){\n switch (key) {\n case 'left':\n this.x -= this.speed + 50; \n break;\n case 'up':\n this.y -= this.speed + 40; \n break;\n case 'right':\n this.x += this.speed + 50;\n break;\n case 'down':\n this.y += this.speed + 40;\n break;\n }\n }" ]
[ "0.7767834", "0.765871", "0.758574", "0.74911857", "0.741585", "0.7402115", "0.7374124", "0.737354", "0.73173136", "0.72986954", "0.7289434", "0.7274268", "0.7264864", "0.72491187", "0.72488683", "0.7228675", "0.7217789", "0.7216279", "0.7157265", "0.71438694", "0.71438676", "0.7134785", "0.712706", "0.7110779", "0.70695454", "0.7067178", "0.70669395", "0.7062987", "0.70587474", "0.70423096", "0.7031838", "0.7031549", "0.70293766", "0.6986781", "0.6982183", "0.696029", "0.69530886", "0.6940413", "0.6938857", "0.69366395", "0.69295424", "0.6929136", "0.6916569", "0.6896396", "0.68941325", "0.6893118", "0.6892102", "0.68663687", "0.6863035", "0.68607587", "0.6859004", "0.6846162", "0.6842958", "0.68403196", "0.6839352", "0.68244034", "0.6811399", "0.68090755", "0.6802174", "0.6797437", "0.6789361", "0.6783331", "0.6781955", "0.6779752", "0.67748827", "0.67722505", "0.67722505", "0.6768603", "0.6764213", "0.6763551", "0.676182", "0.6760336", "0.6750504", "0.6750504", "0.6747182", "0.67461866", "0.6745518", "0.6736278", "0.67358255", "0.673377", "0.67251784", "0.6724226", "0.67113817", "0.6709387", "0.67075956", "0.6705128", "0.670475", "0.67038643", "0.67025256", "0.6696131", "0.6691924", "0.6691924", "0.66916806", "0.66885024", "0.66878664", "0.66865957", "0.6681279", "0.6680106", "0.66768056", "0.6674199", "0.66679996" ]
0.0
-1
A mouse down can be a single click, double click, triple click, start of selection drag, start of text drag, new cursor (ctrlclick), rectangle drag (altdrag), or xwin middleclickpaste. Or it might be a click on something we should not interfere with, such as a scrollbar or widget.
function onMouseDown(e) { var cm = this, display = cm.display; if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return } display.input.ensurePolled(); display.shift = e.shiftKey; if (eventInWidget(display, e)) { if (!webkit) { // Briefly turn off draggability, to allow widgets to do // normal dragging things. display.scroller.draggable = false; setTimeout(function () { return display.scroller.draggable = true; }, 100); } return } if (clickInGutter(cm, e)) { return } var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single"; window.focus(); // #3261: make sure, that we're not starting a second selection if (button == 1 && cm.state.selectingText) { cm.state.selectingText(e); } if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return } if (button == 1) { if (pos) { leftButtonDown(cm, pos, repeat, e); } else if (e_target(e) == display.scroller) { e_preventDefault(e); } } else if (button == 2) { if (pos) { extendSelection(cm.doc, pos); } setTimeout(function () { return display.input.focus(); }, 20); } else if (button == 3) { if (captureRightClick) { cm.display.input.onContextMenu(e); } else { delayBlurEvent(cm); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n win(cm).focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { cm.display.input.onContextMenu(e); }\n else { delayBlurEvent(cm); }\n }\n }", "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n win(cm).focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { cm.display.input.onContextMenu(e); }\n else { delayBlurEvent(cm); }\n }\n }", "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { onContextMenu(cm, e); }\n else { delayBlurEvent(cm); }\n }\n}", "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { onContextMenu(cm, e); }\n else { delayBlurEvent(cm); }\n }\n}", "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { onContextMenu(cm, e); }\n else { delayBlurEvent(cm); }\n }\n}", "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { onContextMenu(cm, e); }\n else { delayBlurEvent(cm); }\n }\n}", "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { onContextMenu(cm, e); }\n else { delayBlurEvent(cm); }\n }\n}", "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { onContextMenu(cm, e); }\n else { delayBlurEvent(cm); }\n }\n}", "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { onContextMenu(cm, e); }\n else { delayBlurEvent(cm); }\n }\n}", "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { onContextMenu(cm, e); }\n else { delayBlurEvent(cm); }\n }\n}", "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { onContextMenu(cm, e); }\n else { delayBlurEvent(cm); }\n }\n}", "function onMouseDown(e) {\n var cm = this,\n display = cm.display;\n\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) {\n return;\n }\n\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () {\n return display.scroller.draggable = true;\n }, 100);\n }\n\n return;\n }\n\n if (clickInGutter(cm, e)) {\n return;\n }\n\n var pos = posFromMouse(cm, e),\n button = e_button(e),\n repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus(); // #3261: make sure, that we're not starting a second selection\n\n if (button == 1 && cm.state.selectingText) {\n cm.state.selectingText(e);\n }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) {\n return;\n }\n\n if (button == 1) {\n if (pos) {\n leftButtonDown(cm, pos, repeat, e);\n } else if (e_target(e) == display.scroller) {\n e_preventDefault(e);\n }\n } else if (button == 2) {\n if (pos) {\n extendSelection(cm.doc, pos);\n }\n\n setTimeout(function () {\n return display.input.focus();\n }, 20);\n } else if (button == 3) {\n if (captureRightClick) {\n cm.display.input.onContextMenu(e);\n } else {\n delayBlurEvent(cm);\n }\n }\n }", "mouseDown(x, y, _isLeftButton) {}", "function onMouseDown(e) {\r\n var cm = this, display = cm.display;\r\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\r\n display.input.ensurePolled();\r\n display.shift = e.shiftKey;\r\n\r\n if (eventInWidget(display, e)) {\r\n if (!webkit) {\r\n // Briefly turn off draggability, to allow widgets to do\r\n // normal dragging things.\r\n display.scroller.draggable = false;\r\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\r\n }\r\n return\r\n }\r\n if (clickInGutter(cm, e)) { return }\r\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\r\n window.focus();\r\n\r\n // #3261: make sure, that we're not starting a second selection\r\n if (button == 1 && cm.state.selectingText)\r\n { cm.state.selectingText(e); }\r\n\r\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\r\n\r\n if (button == 1) {\r\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\r\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\r\n } else if (button == 2) {\r\n if (pos) { extendSelection(cm.doc, pos); }\r\n setTimeout(function () { return display.input.focus(); }, 20);\r\n } else if (button == 3) {\r\n if (captureRightClick) { onContextMenu(cm, e); }\r\n else { delayBlurEvent(cm); }\r\n }\r\n}", "function down(evt){mouseDown(getMousePos(evt));}", "function down(evt){mouseDown(getMousePos(evt));}", "function onMouseDown(e) {\n\t\t var cm = this, display = cm.display;\n\t\t if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n\t\t display.input.ensurePolled();\n\t\t display.shift = e.shiftKey;\n\n\t\t if (eventInWidget(display, e)) {\n\t\t if (!webkit) {\n\t\t // Briefly turn off draggability, to allow widgets to do\n\t\t // normal dragging things.\n\t\t display.scroller.draggable = false;\n\t\t setTimeout(function () { return display.scroller.draggable = true; }, 100);\n\t\t }\n\t\t return\n\t\t }\n\t\t if (clickInGutter(cm, e)) { return }\n\t\t var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n\t\t win(cm).focus();\n\n\t\t // #3261: make sure, that we're not starting a second selection\n\t\t if (button == 1 && cm.state.selectingText)\n\t\t { cm.state.selectingText(e); }\n\n\t\t if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n\t\t if (button == 1) {\n\t\t if (pos) { leftButtonDown(cm, pos, repeat, e); }\n\t\t else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n\t\t } else if (button == 2) {\n\t\t if (pos) { extendSelection(cm.doc, pos); }\n\t\t setTimeout(function () { return display.input.focus(); }, 20);\n\t\t } else if (button == 3) {\n\t\t if (captureRightClick) { cm.display.input.onContextMenu(e); }\n\t\t else { delayBlurEvent(cm); }\n\t\t }\n\t\t }", "function mouseDown(e)\n{\n\tmouseClickDown = true;\n\tmouseX = e.clientX;\n\tmouseY = e.clientY;\n}", "function mousedown(e){\n\t\t// console.log(e);\n\t\tmouseIsDown = true;\n\t}", "function mousedown() {\n \"use strict\";\n mouseclicked = !mouseclicked;\n}", "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n var button = e_button(e);\n if (button == 3 && captureRightClick ? contextMenuInGutter(cm, e) : clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { onContextMenu(cm, e); }\n else { delayBlurEvent(cm); }\n }\n}", "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n var button = e_button(e);\n if (button == 3 && captureRightClick ? contextMenuInGutter(cm, e) : clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { onContextMenu(cm, e); }\n else { delayBlurEvent(cm); }\n }\n}", "function mousedown(e) {\n // Ignore non-primary buttons\n if (!isPrimaryButton(e)) { return; }\n\n // Ignore form and interactive elements\n if (isIgnoreTag(e)) { return; }\n\n on(document, mouseevents.move, mousemove, e);\n on(document, mouseevents.cancel, mouseend, e);\n }", "function mousedown(e) {\n // Ignore non-primary buttons\n if (!isPrimaryButton(e)) { return; }\n\n // Ignore form and interactive elements\n if (isIgnoreTag(e)) { return; }\n\n on(document, mouseevents.move, mousemove, e);\n on(document, mouseevents.cancel, mouseend, e);\n }", "function onMouseDown(e) {\n\t var cm = this, display = cm.display;\n\t if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) return;\n\t display.shift = e.shiftKey;\n\t\n\t if (eventInWidget(display, e)) {\n\t if (!webkit) {\n\t // Briefly turn off draggability, to allow widgets to do\n\t // normal dragging things.\n\t display.scroller.draggable = false;\n\t setTimeout(function(){display.scroller.draggable = true;}, 100);\n\t }\n\t return;\n\t }\n\t if (clickInGutter(cm, e)) return;\n\t var start = posFromMouse(cm, e);\n\t window.focus();\n\t\n\t switch (e_button(e)) {\n\t case 1:\n\t // #3261: make sure, that we're not starting a second selection\n\t if (cm.state.selectingText)\n\t cm.state.selectingText(e);\n\t else if (start)\n\t leftButtonDown(cm, e, start);\n\t else if (e_target(e) == display.scroller)\n\t e_preventDefault(e);\n\t break;\n\t case 2:\n\t if (webkit) cm.state.lastMiddleDown = +new Date;\n\t if (start) extendSelection(cm.doc, start);\n\t setTimeout(function() {display.input.focus();}, 20);\n\t e_preventDefault(e);\n\t break;\n\t case 3:\n\t if (captureRightClick) onContextMenu(cm, e);\n\t else delayBlurEvent(cm);\n\t break;\n\t }\n\t }", "function _corexitOnMouseDown(event) {\r\n\t// Update the options. Need to do it here, because in mouse up it's too late\r\n\t//chrome.extension.sendRequest({command : \"getOptions\"}, getOptions);\r\n\t// Mark if the source click is inside a text box\r\n\tif (!event.target.nodeName)\r\n\t\tgClickInTextBox = false;\r\n\telse\r\n\t\tgClickInTextBox = (event.target.nodeName == \"INPUT\" || event.target.nodeName == \"TEXTAREA\");\r\n}", "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) return;\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function(){display.scroller.draggable = true;}, 100);\n }\n return;\n }\n if (clickInGutter(cm, e)) return;\n var start = posFromMouse(cm, e);\n window.focus();\n\n switch (e_button(e)) {\n case 1:\n // #3261: make sure, that we're not starting a second selection\n if (cm.state.selectingText)\n cm.state.selectingText(e);\n else if (start)\n leftButtonDown(cm, e, start);\n else if (e_target(e) == display.scroller)\n e_preventDefault(e);\n break;\n case 2:\n if (webkit) cm.state.lastMiddleDown = +new Date;\n if (start) extendSelection(cm.doc, start);\n setTimeout(function() {display.input.focus();}, 20);\n e_preventDefault(e);\n break;\n case 3:\n if (captureRightClick) onContextMenu(cm, e);\n else delayBlurEvent(cm);\n break;\n }\n }", "function onMouseDown(e) {\n\t\t var cm = this, display = cm.display;\n\t\t if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) return;\n\t\t display.shift = e.shiftKey;\n\t\t\n\t\t if (eventInWidget(display, e)) {\n\t\t if (!webkit) {\n\t\t // Briefly turn off draggability, to allow widgets to do\n\t\t // normal dragging things.\n\t\t display.scroller.draggable = false;\n\t\t setTimeout(function(){display.scroller.draggable = true;}, 100);\n\t\t }\n\t\t return;\n\t\t }\n\t\t if (clickInGutter(cm, e)) return;\n\t\t var start = posFromMouse(cm, e);\n\t\t window.focus();\n\t\t\n\t\t switch (e_button(e)) {\n\t\t case 1:\n\t\t // #3261: make sure, that we're not starting a second selection\n\t\t if (cm.state.selectingText)\n\t\t cm.state.selectingText(e);\n\t\t else if (start)\n\t\t leftButtonDown(cm, e, start);\n\t\t else if (e_target(e) == display.scroller)\n\t\t e_preventDefault(e);\n\t\t break;\n\t\t case 2:\n\t\t if (webkit) cm.state.lastMiddleDown = +new Date;\n\t\t if (start) extendSelection(cm.doc, start);\n\t\t setTimeout(function() {display.input.focus();}, 20);\n\t\t e_preventDefault(e);\n\t\t break;\n\t\t case 3:\n\t\t if (captureRightClick) onContextMenu(cm, e);\n\t\t else delayBlurEvent(cm);\n\t\t break;\n\t\t }\n\t\t }", "function mouseDown(x, y, button) {\r\n\tif (button == 0 || button == 2) {\t// If the user clicks the right or left mouse button...\r\n\t\tmouseClick = true;\r\n\t}\r\n\t//*** Your Code Here\r\n}", "function onMouseDown(e) {\n var cm = this, display = cm.display\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled()\n display.shift = e.shiftKey\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false\n setTimeout(function () { return display.scroller.draggable = true; }, 100)\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var start = posFromMouse(cm, e)\n window.focus()\n\n switch (e_button(e)) {\n case 1:\n // #3261: make sure, that we're not starting a second selection\n if (cm.state.selectingText)\n { cm.state.selectingText(e) }\n else if (start)\n { leftButtonDown(cm, e, start) }\n else if (e_target(e) == display.scroller)\n { e_preventDefault(e) }\n break\n case 2:\n if (webkit) { cm.state.lastMiddleDown = +new Date }\n if (start) { extendSelection(cm.doc, start) }\n setTimeout(function () { return display.input.focus(); }, 20)\n e_preventDefault(e)\n break\n case 3:\n if (captureRightClick) { onContextMenu(cm, e) }\n else { delayBlurEvent(cm) }\n break\n }\n}", "function onMouseDown(e) {\n var cm = this, display = cm.display\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled()\n display.shift = e.shiftKey\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false\n setTimeout(function () { return display.scroller.draggable = true; }, 100)\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var start = posFromMouse(cm, e)\n window.focus()\n\n switch (e_button(e)) {\n case 1:\n // #3261: make sure, that we're not starting a second selection\n if (cm.state.selectingText)\n { cm.state.selectingText(e) }\n else if (start)\n { leftButtonDown(cm, e, start) }\n else if (e_target(e) == display.scroller)\n { e_preventDefault(e) }\n break\n case 2:\n if (webkit) { cm.state.lastMiddleDown = +new Date }\n if (start) { extendSelection(cm.doc, start) }\n setTimeout(function () { return display.input.focus(); }, 20)\n e_preventDefault(e)\n break\n case 3:\n if (captureRightClick) { onContextMenu(cm, e) }\n else { delayBlurEvent(cm) }\n break\n }\n}", "function mouseDown(e) {\n mousePress(e.button, true);\n}", "function mousedown(e){\n\t\t// Ignore non-primary buttons\n\t\tif (!isPrimaryButton(e)) { return; }\n\n\t\t// Ignore form and interactive elements\n\t\tif (isIgnoreTag(e)) { return; }\n\n\t\ton(document, mouseevents.move, mousemove, e);\n\t\ton(document, mouseevents.cancel, mouseend, e);\n\t}", "function onMouseDown(e) {\n\t var cm = this, display = cm.display;\n\t if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) return;\n\t display.shift = e.shiftKey;\n\n\t if (eventInWidget(display, e)) {\n\t if (!webkit) {\n\t // Briefly turn off draggability, to allow widgets to do\n\t // normal dragging things.\n\t display.scroller.draggable = false;\n\t setTimeout(function(){display.scroller.draggable = true;}, 100);\n\t }\n\t return;\n\t }\n\t if (clickInGutter(cm, e)) return;\n\t var start = posFromMouse(cm, e);\n\t window.focus();\n\n\t switch (e_button(e)) {\n\t case 1:\n\t // #3261: make sure, that we're not starting a second selection\n\t if (cm.state.selectingText)\n\t cm.state.selectingText(e);\n\t else if (start)\n\t leftButtonDown(cm, e, start);\n\t else if (e_target(e) == display.scroller)\n\t e_preventDefault(e);\n\t break;\n\t case 2:\n\t if (webkit) cm.state.lastMiddleDown = +new Date;\n\t if (start) extendSelection(cm.doc, start);\n\t setTimeout(function() {display.input.focus();}, 20);\n\t e_preventDefault(e);\n\t break;\n\t case 3:\n\t if (captureRightClick) onContextMenu(cm, e);\n\t else delayBlurEvent(cm);\n\t break;\n\t }\n\t }", "function onMouseDown(e) {\n\t var cm = this, display = cm.display;\n\t if (display.activeTouch && display.input.supportsTouch() || signalDOMEvent(cm, e)) return;\n\t display.shift = e.shiftKey;\n\n\t if (eventInWidget(display, e)) {\n\t if (!webkit) {\n\t // Briefly turn off draggability, to allow widgets to do\n\t // normal dragging things.\n\t display.scroller.draggable = false;\n\t setTimeout(function(){display.scroller.draggable = true;}, 100);\n\t }\n\t return;\n\t }\n\t if (clickInGutter(cm, e)) return;\n\t var start = posFromMouse(cm, e);\n\t window.focus();\n\n\t switch (e_button(e)) {\n\t case 1:\n\t // #3261: make sure, that we're not starting a second selection\n\t if (cm.state.selectingText)\n\t cm.state.selectingText(e);\n\t else if (start)\n\t leftButtonDown(cm, e, start);\n\t else if (e_target(e) == display.scroller)\n\t e_preventDefault(e);\n\t break;\n\t case 2:\n\t if (webkit) cm.state.lastMiddleDown = +new Date;\n\t if (start) extendSelection(cm.doc, start);\n\t setTimeout(function() {display.input.focus();}, 20);\n\t e_preventDefault(e);\n\t break;\n\t case 3:\n\t if (captureRightClick) onContextMenu(cm, e);\n\t else delayBlurEvent(cm);\n\t break;\n\t }\n\t }", "onMouseDown(event) {\n this._mouseDownTimeStamp = event.timeStamp;\n // If we have selection, we want the context menu on right click even if the\n // terminal is in mouse mode.\n if (event.button === 2 && this.hasSelection) {\n return;\n }\n // Only action the primary button\n if (event.button !== 0) {\n return;\n }\n // Allow selection when using a specific modifier key, even when disabled\n if (!this._enabled) {\n if (!this.shouldForceSelection(event)) {\n return;\n }\n // Don't send the mouse down event to the current process, we want to select\n event.stopPropagation();\n }\n // Tell the browser not to start a regular selection\n event.preventDefault();\n // Reset drag scroll state\n this._dragScrollAmount = 0;\n if (this._enabled && event.shiftKey) {\n this._onIncrementalClick(event);\n }\n else {\n if (event.detail === 1) {\n this._onSingleClick(event);\n }\n else if (event.detail === 2) {\n this._onDoubleClick(event);\n }\n else if (event.detail === 3) {\n this._onTripleClick(event);\n }\n }\n this._addMouseDownListeners();\n this.refresh(true);\n }", "function onMouseDown(e) {\n if (signalDOMEvent(this, e)) return;\n var cm = this, display = cm.display;\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function(){display.scroller.draggable = true;}, 100);\n }\n return;\n }\n if (clickInGutter(cm, e)) return;\n var start = posFromMouse(cm, e);\n window.focus();\n\n switch (e_button(e)) {\n case 1:\n if (start)\n leftButtonDown(cm, e, start);\n else if (e_target(e) == display.scroller)\n e_preventDefault(e);\n break;\n case 2:\n if (webkit) cm.state.lastMiddleDown = +new Date;\n if (start) extendSelection(cm.doc, start);\n setTimeout(bind(focusInput, cm), 20);\n e_preventDefault(e);\n break;\n case 3:\n if (captureRightClick) onContextMenu(cm, e);\n break;\n }\n }", "function onMouseDown(e) {\n if (signalDOMEvent(this, e)) return;\n var cm = this, display = cm.display;\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function(){display.scroller.draggable = true;}, 100);\n }\n return;\n }\n if (clickInGutter(cm, e)) return;\n var start = posFromMouse(cm, e);\n window.focus();\n\n switch (e_button(e)) {\n case 1:\n if (start)\n leftButtonDown(cm, e, start);\n else if (e_target(e) == display.scroller)\n e_preventDefault(e);\n break;\n case 2:\n if (webkit) cm.state.lastMiddleDown = +new Date;\n if (start) extendSelection(cm.doc, start);\n setTimeout(bind(focusInput, cm), 20);\n e_preventDefault(e);\n break;\n case 3:\n if (captureRightClick) onContextMenu(cm, e);\n break;\n }\n }", "function onMouseDown(e) {\n if (signalDOMEvent(this, e)) return;\n var cm = this, display = cm.display;\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function(){display.scroller.draggable = true;}, 100);\n }\n return;\n }\n if (clickInGutter(cm, e)) return;\n var start = posFromMouse(cm, e);\n window.focus();\n\n switch (e_button(e)) {\n case 1:\n if (start)\n leftButtonDown(cm, e, start);\n else if (e_target(e) == display.scroller)\n e_preventDefault(e);\n break;\n case 2:\n if (webkit) cm.state.lastMiddleDown = +new Date;\n if (start) extendSelection(cm.doc, start);\n setTimeout(bind(focusInput, cm), 20);\n e_preventDefault(e);\n break;\n case 3:\n if (captureRightClick) onContextMenu(cm, e);\n break;\n }\n }", "function onMouseDown(e) {\n if (signalDOMEvent(this, e)) return;\n var cm = this, display = cm.display;\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function(){display.scroller.draggable = true;}, 100);\n }\n return;\n }\n if (clickInGutter(cm, e)) return;\n var start = posFromMouse(cm, e);\n window.focus();\n\n switch (e_button(e)) {\n case 1:\n if (start)\n leftButtonDown(cm, e, start);\n else if (e_target(e) == display.scroller)\n e_preventDefault(e);\n break;\n case 2:\n if (webkit) cm.state.lastMiddleDown = +new Date;\n if (start) extendSelection(cm.doc, start);\n setTimeout(bind(focusInput, cm), 20);\n e_preventDefault(e);\n break;\n case 3:\n if (captureRightClick) onContextMenu(cm, e);\n break;\n }\n }", "function onMouseDown(e) {\n if (signalDOMEvent(this, e)) return;\n var cm = this, display = cm.display;\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function(){display.scroller.draggable = true;}, 100);\n }\n return;\n }\n if (clickInGutter(cm, e)) return;\n var start = posFromMouse(cm, e);\n window.focus();\n\n switch (e_button(e)) {\n case 1:\n if (start)\n leftButtonDown(cm, e, start);\n else if (e_target(e) == display.scroller)\n e_preventDefault(e);\n break;\n case 2:\n if (webkit) cm.state.lastMiddleDown = +new Date;\n if (start) extendSelection(cm.doc, start);\n setTimeout(bind(focusInput, cm), 20);\n e_preventDefault(e);\n break;\n case 3:\n if (captureRightClick) onContextMenu(cm, e);\n break;\n }\n }", "function onMouseDown(e) {\n if (signalDOMEvent(this, e)) return;\n var cm = this, display = cm.display;\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function(){display.scroller.draggable = true;}, 100);\n }\n return;\n }\n if (clickInGutter(cm, e)) return;\n var start = posFromMouse(cm, e);\n window.focus();\n\n switch (e_button(e)) {\n case 1:\n if (start)\n leftButtonDown(cm, e, start);\n else if (e_target(e) == display.scroller)\n e_preventDefault(e);\n break;\n case 2:\n if (webkit) cm.state.lastMiddleDown = +new Date;\n if (start) extendSelection(cm.doc, start);\n setTimeout(bind(focusInput, cm), 20);\n e_preventDefault(e);\n break;\n case 3:\n if (captureRightClick) onContextMenu(cm, e);\n break;\n }\n }", "function onMouseDown(e) {\r\n if (signalDOMEvent(this, e)) return;\r\n var cm = this, display = cm.display;\r\n display.shift = e.shiftKey;\r\n\r\n if (eventInWidget(display, e)) {\r\n if (!webkit) {\r\n // Briefly turn off draggability, to allow widgets to do\r\n // normal dragging things.\r\n display.scroller.draggable = false;\r\n setTimeout(function(){display.scroller.draggable = true;}, 100);\r\n }\r\n return;\r\n }\r\n if (clickInGutter(cm, e)) return;\r\n var start = posFromMouse(cm, e);\r\n window.focus();\r\n\r\n switch (e_button(e)) {\r\n case 1:\r\n if (start)\r\n leftButtonDown(cm, e, start);\r\n else if (e_target(e) == display.scroller)\r\n e_preventDefault(e);\r\n break;\r\n case 2:\r\n if (webkit) cm.state.lastMiddleDown = +new Date;\r\n if (start) extendSelection(cm.doc, start);\r\n setTimeout(bind(focusInput, cm), 20);\r\n e_preventDefault(e);\r\n break;\r\n case 3:\r\n if (captureRightClick) onContextMenu(cm, e);\r\n break;\r\n }\r\n }", "function on_down(event){\n \tif (mode =='EDIT'){\n //EDIT MODE\n \t\tmouseDown = true;\n \t\tonMouseDownPosition = [event.clientX, event.clientY];\n \t\tonMouseDownTheta = theta;\n \t\tonMouseDownPhi = phi;\n\n \t\tif (cursorMode =='edit'){\n handleCursorEdit();\n \t\t} else if (cursorMode == 'pan'){\n handleCursorPan();\n \t\t}\n \t} else{\n //PLAY MODE\n \t\t domElement.style.cursor = \"default\";\n \t}\n window.addEventListener( \"mousemove\", on_move );\n }", "mouseDown(pt) {}", "mouseDown(pt) {}", "function mousedown(e){\n\t\tvar data;\n\n\t\tif (!isLeftButton(e)) { return; }\n\n\t\tdata = {\n\t\t\ttarget: e.target,\n\t\t\tstartX: e.pageX,\n\t\t\tstartY: e.pageY,\n\t\t\ttimeStamp: e.timeStamp\n\t\t};\n\n\t\tadd(document, mouseevents.move, mousemove, data);\n\t\tadd(document, mouseevents.cancel, mouseend, data);\n\t}", "function mousedown(e){\n\t\tvar data;\n\n\t\tif (!isLeftButton(e)) { return; }\n\n\t\tdata = {\n\t\t\ttarget: e.target,\n\t\t\tstartX: e.pageX,\n\t\t\tstartY: e.pageY,\n\t\t\ttimeStamp: e.timeStamp\n\t\t};\n\n\t\tadd(document, mouseevents.move, mousemove, data);\n\t\tadd(document, mouseevents.cancel, mouseend, data);\n\t}", "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (display.activeTouch && display.input.supportsTouch() || signalDOMEvent(cm, e)) return;\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function(){display.scroller.draggable = true;}, 100);\n }\n return;\n }\n if (clickInGutter(cm, e)) return;\n var start = posFromMouse(cm, e);\n window.focus();\n\n switch (e_button(e)) {\n case 1:\n if (start)\n leftButtonDown(cm, e, start);\n else if (e_target(e) == display.scroller)\n e_preventDefault(e);\n break;\n case 2:\n if (webkit) cm.state.lastMiddleDown = +new Date;\n if (start) extendSelection(cm.doc, start);\n setTimeout(function() {display.input.focus();}, 20);\n e_preventDefault(e);\n break;\n case 3:\n if (captureRightClick) onContextMenu(cm, e);\n else delayBlurEvent(cm);\n break;\n }\n }", "function Edit_MouseDown(event)\n{\n\t//interactions blocked?\n\tif (__SIMULATOR.UserInteractionBlocked())\n\t{\n\t\t//block the event (will forward to designer, if possible)\n\t\tBrowser_BlockEvent(event);\n\t}\n\telse\n\t{\n\t\t//get event type\n\t\tvar evtType = Browser_GetMouseDownEventType(event);\n\t\t//valid?\n\t\tif (evtType)\n\t\t{\n\t\t\t//in touch browser? event was touch start?\n\t\t\tif (__BROWSER_IS_TOUCH_ENABLED && evtType == __BROWSER_EVENT_MOUSEDOWN && Brower_TouchIsDoubleClick(event))\n\t\t\t{\n\t\t\t\t//convert touchstarts to double clicks\n\t\t\t\tevtType = __BROWSER_EVENT_DOUBLECLICK;\n\t\t\t}\n\t\t\t//get the html\n\t\t\tvar theHTML = Get_HTMLObject(Browser_GetEventSourceElement(event));\n\t\t\t//update creation point\n\t\t\tPopupMenu_UpdateCreationPoint(event);\n\t\t\t//block the event unless its left click, we want to keep the matchcode\n\t\t\tevent.cancelBubble = true;\n\t\t\t//has propagation?\n\t\t\tif (event.stopPropagation)\n\t\t\t{\n\t\t\t\t//stop it as well\n\t\t\t\tevent.stopPropagation();\n\t\t\t}\n\t\t\t//matchcode not showing?\n\t\t\tif (!theHTML.STATES_MATCHCODE)\n\t\t\t{\n\t\t\t\t//destroy menus\n\t\t\t\tPopups_TriggerCloseAll();\n\t\t\t}\n\t\t\t//check event\n\t\t\tswitch (evtType)\n\t\t\t{\n\t\t\t\tcase __BROWSER_EVENT_DOUBLECLICK:\n\t\t\t\t\t//trigger event\n\t\t\t\t\t__SIMULATOR.ProcessEvent(new Event_Event(theHTML.InterpreterObject, __NEMESIS_EVENT_DBLCLICK, theHTML.InterpreterObject.GetData()));\n\t\t\t\t\tbreak;\n\t\t\t\tcase __BROWSER_EVENT_MOUSERIGHT:\n\t\t\t\t\t//has prevent default?\n\t\t\t\t\tif (event.preventDefault)\n\t\t\t\t\t{\n\t\t\t\t\t\t//trigger it\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t\tevent.returnValue = false;\n\t\t\t\t\t//trigger an event\n\t\t\t\t\t__SIMULATOR.ProcessEvent(new Event_Event(theHTML.InterpreterObject, __NEMESIS_EVENT_RIGHTCLICK, []));\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}", "doubleClick(x, y, _isLeftButton) {}", "function down(e){\n\tif((document.layers && e.which!=1) || (document.all && event.button!=1)) return true; // Enables the right mousebutton\n\tgetMouse(e);\n\tstartY = (mouseY - dragT);\n\t\n\t// If click on up-arrow\n\tif(mouseX >= upL && (mouseX <= (upL + upW)) && mouseY >= upT && (mouseY <= (upT + upH)))\n\t{\n\t\tclickUp = true;\n\t\treturn scrollUp();\n\t}\t\n\t// Else if click on down-arrow\n\telse if(mouseX >= downL && (mouseX <= (downL + downW)) && mouseY >= downT && (mouseY <= (downT + downH)))\n\t{\n\t\tclickDown = true;\n\t\treturn scrollDown();\n\t}\n\t// Else if click on scrollbar\n\telse if(mouseX >= dragL && (mouseX <= (dragL + dragW)) && mouseY >= dragT && (mouseY <= (dragT + dragH)))\n\t{\n\t\tclickDrag = true;\n\t\treturn false;\n\t}\n\telse if(mouseX >= dragL && (mouseX <= (dragL + dragW)) && mouseY >= rulerT && (mouseY <= (rulerT + scrollH))){\n\t\t// If click above drag\n\t\tif(mouseY < dragT){\n\t\t\tclickAbove = true;\n\t\t\tclickUp = true;\n\t\t\treturn scrollUp();\n\t\t}\n\t\t// Else click below drag\n\t\telse{\n\t\t\tclickBelow = true;\n\t\t\tclickDown = true;\n\t\t\treturn scrollDown();\n\t\t}\n\t}\n\t// If no scrolling is to take place\n\telse{\n\t\t//alert('mouse donw do not process by the scroll bar.');\n\t\treturn true;\n\t}\n}", "mouseDown(e) {\n this._modifiers(e);\n const _leftClick = Event.isLeftClick(e);\n this.status.button1 = _leftClick;\n this.status.button2 = !_leftClick;\n return this.handleMouseDown(e);\n }", "mouseDown(e) {\n this._modifiers(e);\n const _leftClick = Event.isLeftClick(e);\n this.status.button1 = _leftClick;\n this.status.button2 = !_leftClick;\n return this.handleMouseDown(e);\n }", "function mouse_down_handler(e) {\n e.preventDefault(); //Prevents the default action from happening (e.g. navigation)\n mouse.down = true; //Sets the mouse object's \"down\" value to true\n }", "function handleMouseDown()\r\n{\r\n _mouse_down = true;\r\n}", "function mouseDown(event) {\r\n this.hasMouseDown = true;\r\n }", "function mouseUpEvent(e) {\n\tswitch (e.button) {\n\t\tcase 0:\n\t\t\tleft_click_drag_flag = false;\t\t\t\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tright_click_drag_flag = false;\n\t\t\tbreak;\n\t}\n}", "function down(e){\r\n\tif((document.layers && e.which!=1) || (document.all && event.button!=1)) return true; // Enables the right mousebutton\r\n\tgetMouse(e);\r\n\tstartY = (mouseY - dragT);\r\n\t\r\n\t// If click on up-arrow\r\n\tif(mouseX >= upL && (mouseX <= (upL + upW)) && mouseY >= upT && (mouseY <= (upT + upH))){\r\n\t\tclickUp = true;\r\n\t\treturn scrollUp();\r\n\t}\t\r\n\t// Else if click on down-arrow\r\n\telse if(mouseX >= downL && (mouseX <= (downL + downW)) && mouseY >= downT && (mouseY <= (downT + downH))){\r\n\t\tclickDown = true;\r\n\t\treturn scrollDown();\r\n\t}\r\n\t// Else if click on scrollbar\r\n\telse if(mouseX >= dragL && (mouseX <= (dragL + dragW)) && mouseY >= dragT && (mouseY <= (dragT + dragH))){\r\n\t\tclickDrag = true;\r\n\t\treturn false;\r\n\t}\r\n\telse if(mouseX >= dragL && (mouseX <= (dragL + dragW)) && mouseY >= rulerT && (mouseY <= (rulerT + scrollH))){\r\n\t\t// If click above drag\r\n\t\tif(mouseY < dragT){\r\n\t\t\tclickAbove = true;\r\n\t\t\tclickUp = true;\r\n\t\t\treturn scrollUp();\r\n\t\t}\r\n\t\t// Else click below drag\r\n\t\telse{\r\n\t\t\tclickBelow = true;\r\n\t\t\tclickDown = true;\r\n\t\t\treturn scrollDown();\r\n\t\t}\r\n\t}\r\n\t// If no scrolling is to take place\r\n\telse{\r\n\t\treturn true;\r\n\t}\r\n}", "function mouseDownEvent(eb){\r\n dragging = eb\r\n}", "function onMouseDown(event) { }", "onMouseDown(e) {}", "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 }", "function onMouseDown(event) {\n if (scope.enabled === false) return;\n event.preventDefault();\n\n switch (event.button) {\n case scope.mouseButtons.ORBIT:\n if (scope.enableRotate === false) return;\n handleMouseDownRotate(event);\n state = STATE.ROTATE;\n break;\n\n case scope.mouseButtons.ZOOM:\n if (scope.enableZoom === false) return;\n handleMouseDownDolly(event);\n state = STATE.DOLLY;\n break;\n\n case scope.mouseButtons.PAN:\n if (scope.enablePan === false) return;\n handleMouseDownPan(event);\n state = STATE.PAN;\n break;\n }\n\n if (state !== STATE.NONE) {\n document.addEventListener('mousemove', onMouseMove, false);\n document.addEventListener('mouseup', onMouseUp, false);\n scope.dispatchEvent(startEvent);\n }\n }", "function onMouseDown(event) {\n if (scope.enabled === false) return;\n event.preventDefault();\n\n switch (event.button) {\n case scope.mouseButtons.ORBIT:\n if (scope.enableRotate === false) return;\n handleMouseDownRotate(event);\n state = STATE.ROTATE;\n break;\n\n case scope.mouseButtons.ZOOM:\n if (scope.enableZoom === false) return;\n handleMouseDownDolly(event);\n state = STATE.DOLLY;\n break;\n\n case scope.mouseButtons.PAN:\n if (scope.enablePan === false) return;\n handleMouseDownPan(event);\n state = STATE.PAN;\n break;\n }\n\n if (state !== STATE.NONE) {\n document.addEventListener('mousemove', onMouseMove, false);\n document.addEventListener('mouseup', onMouseUp, false);\n scope.dispatchEvent(startEvent);\n }\n }", "function isButtonDown(mouseEvent) {\n return (typeof mouseEvent.buttons === 'undefined' ? mouseEvent.which : mouseEvent.buttons);\n }", "function mouseDown(mousePos) {\n\t}", "function mouseDown(mousePos) {\n\t}", "function onMouseDown(evt) {\n if (evt.button === DRAG_BUTTON) {\n dragButtonIsDown = true;\n dragging = false;\n dragClientX = evt.clientX;\n dragClientY = evt.clientY;\n } else if (evt.button === TOC_BUTTON) {\n toggleFrameList();\n }\n evt.stopPropagation();\n evt.preventDefault();\n }", "function onMouseDown(event) {\n\n if (scope.enabled === false) return\n\n event.preventDefault()\n\n switch (event.button) {\n\n case scope.mouseButtons.ORBIT:\n\n if (scope.enableRotate === false) return\n\n handleMouseDownRotate(event)\n\n state = STATE.ROTATE\n\n break\n\n case scope.mouseButtons.ZOOM:\n\n if (scope.enableZoom === false) return\n\n handleMouseDownDolly(event)\n\n state = STATE.DOLLY\n\n break\n\n case scope.mouseButtons.PAN:\n\n if (scope.enablePan === false) return\n\n handleMouseDownPan(event)\n\n state = STATE.PAN\n\n break\n\n }\n\n if (state !== STATE.NONE) {\n\n document.addEventListener('mousemove', onMouseMove, false)\n document.addEventListener('mouseup', onMouseUp, false)\n\n scope.dispatchEvent(startEvent)\n\n }\n\n }", "function mouseReleased() {\r\n mouseIsDown = false;\r\n}", "function mouseDown() {\n console.log(\"Mouse Down\");\n mouseDownPress = true;\n}", "_evtMousedown(event) {\n if (this.isHidden || !this._editor) {\n return;\n }\n if (Private.nonstandardClick(event)) {\n this.reset();\n return;\n }\n let target = event.target;\n while (target !== document.documentElement) {\n // If the user has made a selection, emit its value and reset the widget.\n if (target.classList.contains(ITEM_CLASS)) {\n event.preventDefault();\n event.stopPropagation();\n event.stopImmediatePropagation();\n this._selected.emit(target.getAttribute('data-value'));\n this.reset();\n return;\n }\n // If the mouse event happened anywhere else in the widget, bail.\n if (target === this.node) {\n event.preventDefault();\n event.stopPropagation();\n event.stopImmediatePropagation();\n return;\n }\n target = target.parentElement;\n }\n this.reset();\n }", "function onMouseDown(event) {\n if (scope.enabled == false) return;\n event.preventDefault();\n\n if (event.button === scope.mouseButtons.ORBIT) {\n if (scope.enableRotate === false) return;\n handleMouseDownRotate(event);\n state = STATE.ROTATE;\n } else if (event.button === scope.mouseButtons.ZOOM) {\n if (scope.enableZoom === false) return;\n handleMouseDownDolly(event);\n state = STATE.DOLLY;\n } else if (event.button === scope.mouseButtons.PAN) {\n if (scope.enablePan === false) return;\n handleMouseDownPan(event);\n state = STATE.PAN;\n }\n\n if (state !== STATE.NONE) {\n scope.domElement.addEventListener('mousemove', onMouseMove, false);\n scope.domElement.addEventListener('mouseup', onMouseUp, false);\n scope.dispatchEvent(startEvent);\n }\n }", "_evtDblClick(event) { }", "_MouseDown(x, y){\n this.mousedown = true;\n this.originX = x;\n this.originY = y;\n }", "function onMouseDown(event) {\n\n if (scope.enabled === false) return;\n\n event.preventDefault();\n\n if (event.button === scope.mouseButtons.ORBIT) {\n\n if (scope.enableRotate === false) return;\n\n handleMouseDownRotate(event);\n\n state = STATE.ROTATE;\n\n } else if (event.button === scope.mouseButtons.ZOOM) {\n\n if (scope.enableZoom === false) return;\n\n handleMouseDownDolly(event);\n\n state = STATE.DOLLY;\n\n } else if (event.button === scope.mouseButtons.PAN) {\n\n if (scope.enablePan === false) return;\n\n handleMouseDownPan(event);\n\n state = STATE.PAN;\n\n }\n\n if (state !== STATE.NONE) {\n\n document.addEventListener('mousemove', onMouseMove, false);\n document.addEventListener('mouseup', onMouseUp, false);\n\n scope.dispatchEvent(startEvent);\n\n }\n\n }", "function onMouseDown(event) {\n\n\t\tif (scope.enabled === false) return;\n\n\t\tevent.preventDefault();\n\n\t\tswitch (event.button) {\n\n\t\t\tcase scope.mouseButtons.ORBIT:\n\n\t\t\t\tif (scope.enableRotate === false) return;\n\n\t\t\t\thandleMouseDownRotate(event);\n\n\t\t\t\tstate = STATE.ROTATE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase scope.mouseButtons.ZOOM:\n\n\t\t\t\tif (scope.enableZoom === false) return;\n\n\t\t\t\thandleMouseDownDolly(event);\n\n\t\t\t\tstate = STATE.DOLLY;\n\n\t\t\t\tbreak;\n\n\t\t\tcase scope.mouseButtons.PAN:\n\n\t\t\t\tif (scope.enablePan === false) return;\n\n\t\t\t\thandleMouseDownPan(event);\n\n\t\t\t\tstate = STATE.PAN;\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tif (state !== STATE.NONE) {\n\n\t\t\tdocument.addEventListener('mousemove', onMouseMove, false);\n\t\t\tdocument.addEventListener('mouseup', onMouseUp, false);\n\n\t\t\tscope.dispatchEvent(startEvent);\n\t\t}\n\t}", "function onMouseDown(event) {\n\n\t\tif (scope.enabled === false) return;\n\n\t\tevent.preventDefault();\n\n\t\tswitch (event.button) {\n\n\t\t\tcase scope.mouseButtons.ORBIT:\n\n\t\t\t\tif (scope.enableRotate === false) return;\n\n\t\t\t\thandleMouseDownRotate(event);\n\n\t\t\t\tstate = STATE.ROTATE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase scope.mouseButtons.ZOOM:\n\n\t\t\t\tif (scope.enableZoom === false) return;\n\n\t\t\t\thandleMouseDownDolly(event);\n\n\t\t\t\tstate = STATE.DOLLY;\n\n\t\t\t\tbreak;\n\n\t\t\tcase scope.mouseButtons.PAN:\n\n\t\t\t\tif (scope.enablePan === false) return;\n\n\t\t\t\thandleMouseDownPan(event);\n\n\t\t\t\tstate = STATE.PAN;\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tif (state !== STATE.NONE) {\n\n\t\t\tdocument.addEventListener('mousemove', onMouseMove, false);\n\t\t\tdocument.addEventListener('mouseup', onMouseUp, false);\n\n\t\t\tscope.dispatchEvent(startEvent);\n\t\t}\n\t}", "on_mousedown(e, localX, localY) {\n\n }", "function mouseDownHandler(event){\n\t\t\tif(!event.isLeftClick()) return;\n\t\t\t\n\t\t\tsetSelectionPos(selection.first, event);\t\t\t\t\n\t\t\tif(selectionInterval != null){\n\t\t\t\tclearInterval(selectionInterval);\n\t\t\t}\n\t\t\tlastMousePos.pageX = null;\n\t\t\tselectionInterval = setInterval(updateSelection, 1000/options.selection.fps);\n\t\t\t\n\t\t\t$(document).observe('mouseup', mouseUpHandler);\n\t\t}", "function onMouseDown(event) {\n\n\t\tif (scope.enabled === false) return;\n\n\t\tevent.preventDefault();\n\n\t\tif (event.button === scope.mouseButtons.ORBIT) {\n\n\t\t\tif (scope.enableRotate === false) return;\n\n\t\t\thandleMouseDownRotate(event);\n\n\t\t\tstate = STATE.ROTATE;\n\n\t\t} else if (event.button === scope.mouseButtons.ZOOM) {\n\n\t\t\tif (scope.enableZoom === false) return;\n\n\t\t\thandleMouseDownDolly(event);\n\n\t\t\tstate = STATE.DOLLY;\n\n\t\t} else if (event.button === scope.mouseButtons.PAN) {\n\n\t\t\tif (scope.enablePan === false) return;\n\n\t\t\thandleMouseDownPan(event);\n\n\t\t\tstate = STATE.PAN;\n\n\t\t}\n\n\t\tif (state !== STATE.NONE) {\n\n\t\t\tdocument.addEventListener('mousemove', onMouseMove, false);\n\t\t\tdocument.addEventListener('mouseup', onMouseUp, false);\n\n\t\t\tscope.dispatchEvent(startEvent);\n\n\t\t}\n\n\t}", "function onMouseDown( event ) {\n\n if ( scope.enabled === false ) return;\n\n event.preventDefault();\n\n if ( event.button === scope.mouseButtons.ORBIT ) {\n\n if ( scope.enableRotate === false ) return;\n\n handleMouseDownRotate( event );\n\n state = STATE.ROTATE;\n\n } else if ( event.button === scope.mouseButtons.ZOOM ) {\n\n if ( scope.enableZoom === false ) return;\n\n handleMouseDownDolly( event );\n\n state = STATE.DOLLY;\n\n } else if ( event.button === scope.mouseButtons.PAN ) {\n\n if ( scope.enablePan === false ) return;\n\n handleMouseDownPan( event );\n\n state = STATE.PAN;\n\n }\n\n if ( state !== STATE.NONE ) {\n\n document.addEventListener( 'mousemove', onMouseMove, false );\n document.addEventListener( 'mouseup', onMouseUp, false );\n\n scope.dispatchEvent( startEvent );\n\n }\n\n }", "static _HandleButtonDown(e) {\n if (!Mouse._button_down.includes(e.button))\n Mouse._button_down.push(e.button)\n }", "onMouseDown(event) {\n // only dragging with left mouse button\n if (event.button !== 0) {\n return;\n }\n\n this.onPointerDown(false, event);\n }" ]
[ "0.7091538", "0.7091538", "0.70911586", "0.70911586", "0.70911586", "0.70911586", "0.70911586", "0.70911586", "0.70911586", "0.70911586", "0.70911586", "0.70908904", "0.7087665", "0.70814776", "0.7055789", "0.7055789", "0.70555824", "0.70399", "0.70170754", "0.6998677", "0.6998235", "0.6998235", "0.6993468", "0.6993468", "0.69810635", "0.6980913", "0.69761866", "0.6963361", "0.69553465", "0.6942524", "0.6942524", "0.6926933", "0.6918164", "0.6915232", "0.69125605", "0.6889044", "0.68622214", "0.68622214", "0.68622214", "0.68622214", "0.68622214", "0.68622214", "0.6854434", "0.68369585", "0.68194747", "0.68194747", "0.6811257", "0.6811257", "0.68044186", "0.6780896", "0.67717427", "0.6762502", "0.67213756", "0.67213756", "0.6719147", "0.67142624", "0.66796553", "0.66702724", "0.66483235", "0.663218", "0.6590248", "0.6579084", "0.6578134", "0.6578134", "0.6550467", "0.65490955", "0.6526832", "0.6526677", "0.6526677", "0.65140826", "0.65115774", "0.65107507", "0.65092766", "0.64965093", "0.6471452", "0.6462898", "0.64583904", "0.64550537", "0.64504826", "0.64504826", "0.64465266", "0.64335114", "0.64334893", "0.64325804", "0.6428326", "0.6426832" ]
0.70232
32
Start a text drag. When it ends, see if any dragging actually happen, and treat as a click if it didn't.
function leftButtonStartDrag(cm, event, pos, behavior) { var display = cm.display, moved = false; var dragEnd = operation(cm, function (e) { if (webkit) { display.scroller.draggable = false; } cm.state.draggingText = false; off(display.wrapper.ownerDocument, "mouseup", dragEnd); off(display.wrapper.ownerDocument, "mousemove", mouseMove); off(display.scroller, "dragstart", dragStart); off(display.scroller, "drop", dragEnd); if (!moved) { e_preventDefault(e); if (!behavior.addNew) { extendSelection(cm.doc, pos, null, null, behavior.extend); } // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081) if (webkit || ie && ie_version == 9) { setTimeout(function () {display.wrapper.ownerDocument.body.focus(); display.input.focus();}, 20); } else { display.input.focus(); } } }); var mouseMove = function(e2) { moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10; }; var dragStart = function () { return moved = true; }; // Let the drag handler handle this. if (webkit) { display.scroller.draggable = true; } cm.state.draggingText = dragEnd; dragEnd.copy = !behavior.moveOnDrag; // IE's approach to draggable if (display.scroller.dragDrop) { display.scroller.dragDrop(); } on(display.wrapper.ownerDocument, "mouseup", dragEnd); on(display.wrapper.ownerDocument, "mousemove", mouseMove); on(display.scroller, "dragstart", dragStart); on(display.scroller, "drop", dragEnd); delayBlurEvent(cm); setTimeout(function () { return display.input.focus(); }, 20); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startDragText(evt)\r\n{\r\n\r\n if(ActiveElem&&!DraggingObj) //---prevents dragging conflicts on other draggable elements---\r\n {\r\n if(evt.target.parentNode.getAttribute(\"id\")==\"activeText\")\r\n {\r\n if(evt.target.parentNode.parentNode.getAttribute(\"class\")==\"dragTargetObj\") //---text elem w/ tspan--\r\n objDragTarget = evt.target.parentNode.parentNode\r\n\r\n }\r\n if(objDragTarget)\r\n {\r\n\r\n addNoSelectAtText()\r\n var pnt = objDragTarget.ownerSVGElement.createSVGPoint();\r\n pnt.x = evt.clientX;\r\n pnt.y = evt.clientY;\r\n //---elements in different(svg) viewports, and/or transformed ---\r\n var sCTM = objDragTarget.getScreenCTM();\r\n var Pnt = pnt.matrixTransform(sCTM.inverse());\r\n\r\n //---used for align of projection/zoom on end drag---\r\n ActiveElemStartTrans =[SVGx, SVGy]\r\n\r\n objTransformRequestObj = activeElem.ownerSVGElement.createSVGTransform()\r\n\r\n //---attach new or existing transform to element, init its transform list---\r\n var myTransListAnim = activeElem.transform\r\n objTransList = myTransListAnim.baseVal\r\n\r\n ObjStartX = Pnt.x\r\n ObjStartY = Pnt.y\r\n\r\n DraggingObj = true\r\n\r\n }\r\n }\r\n else\r\n DraggingObj = false\r\n\r\n}", "function dragtaskStart(ev) {\n ev.dataTransfer.setData(\"text/plain\", ev.target.id);\n}", "function checkTextDrag() {\n var ann = gd.layout.annotations[0];\n var x0 = ann.x;\n var y0 = ann.y;\n var ax0 = ann.ax;\n var ay0 = ann.ay;\n\n var bboxInitial = textBox().getBoundingClientRect();\n\n return dragAndReplot(textDrag(), 50, -50)\n .then(function() {\n var bbox = textBox().getBoundingClientRect();\n expect(bbox.left).toBeWithin(bboxInitial.left + 50, 1);\n expect(bbox.top).toBeWithin(bboxInitial.top - 50, 1);\n\n ann = gd.layout.annotations[0];\n\n expect(ann.x).toBe(x0);\n expect(ann.y).toBe(y0);\n expect(ann.ax).toBeWithin(ax0 + 50, 1);\n expect(ann.ay).toBeWithin(ay0 - 50, 1);\n });\n }", "createDragText (highlightedText) {\n this.isDragReleased[highlightedText.stepNumber] = true\n const highDragText = this.game.add.text(\n this.game.input.x,\n this.game.input.y,\n this.dialogSteps[highlightedText.stepNumber].dragText,\n {\n font: '14px Arial',\n fill: '#bfedf5'\n }\n )\n highDragText.lineSpacing = -8\n highDragText.inputEnabled = true\n highDragText.input.useHandCursor = true\n highDragText.input.enableDrag(true)\n highDragText.anchor.setTo(0.5, 0.5)\n highDragText.setShadow(0, 0, 'rgb(0, 0, 0)', 4)\n highDragText.events.onDragStop.add(() => {\n // check if it's in the yes or no zone\n this.dragStopHandler(highDragText, highlightedText)\n })\n }", "function dragStart(e) {\n e.dataTransfer.setData('text/plain', e.target.id);\n this.classList.add('hold');\n setTimeout(() => this.classList.add('invisible'), 0);\n}", "function dragStart(e) {\n e.dataTransfer.setData('text', e.target.id);\n setTimeout(() => {\n e.target.classList.add('invisible');\n }, 0);\n}", "function dragStart(event) {\n event.dataTransfer.setData(\"Text\", event.target.id);\n //document.getElementById(\"demo\").innerHTML = \"Started to drag the letter\";\n $(\"#demo\").attr(\"value\", event.target.id); //pass id as demo value, to check font value when drop\n }", "startDrag(x, y) {}", "function onTextDown(txt) {\n textDown(txt)\n draw()\n}", "function handleMouseDown(e) {\n e.preventDefault();\n startX = parseInt(e.clientX - offsetX);\n // console.log(startX);\n startY = parseInt(e.clientY - offsetY);\n // console.log(startY);\n\n // Put your mousedown stuff here\n // for (var i = 0; i < texts.length; i++) {\n // if (textHittest(startX, startY, i)) {\n selectedText = currentIndex;\n // }\n // }\n}", "function dragstart_handler(e) {\r\n e.dataTransfer.setData(\"text/plain\", e.target.dataset.jsDraggable);\r\n}", "function dragStart() {\n\t\tconsole.log('started draggin');\n\t}", "function onDragStart(event) {\r\n event.dataTransfer.setData('text/plain', event.target.id);\r\n }", "onDragStart({dataTransfer: dt, currentTarget: t}) { dt.setData('text', t.src) }", "startDrag(event) {\n event.dataTransfer.setData(\"text\", event.target.id);\n }", "function bindDrag(evt)\n{\n \n if(navigator.userAgent.indexOf(\"Firefox\") != -1 ||navigator.userAgent.indexOf(\"Safari\") != -1){\n if(evt.detail=='2')\n\t{\n\tstartMove(evt);\n\tchangeCursor('move');\n\t\n\tdocument.getElementById('fontSel').addEventListener('click', function() {\n\tchangeCursor('text');\n\tendMove();\n\t}, false);\n\t}\n\n }else{\n\n\tstartMove(evt);\n\tchangeCursor('move');\n\t\n\tdocument.getElementById('fontSel').addEventListener('click', function() {\n\tchangeCursor('text');\n\tendMove();\n\t}, false);\n\t\n\t}\n}", "function setDragTextData(event) {\n isDragAndDropSupported = true;\n event.dataTransfer.setData(\"text\", \"pspdfkit/text:\" + event.target.innerText);\n event.dataTransfer.setDragImage &&\n event.dataTransfer.setDragImage(event.target, 0, 0);\n event.stopPropagation();\n}", "function _corexitOnMouseUp(event) {\r\n\tvar selection = window.getSelection();\r\n\tvar selectedText = selection ? selection.toString() : \"\";\r\n\r\n //unselect\r\n //selection.collapseToStart();\r\n\r\n\t//if (selectedText.length != 0) {\r\n chrome.extension.sendRequest({command : \"sendText\", text : selectedText});\r\n\t//}\r\n \r\n\t//gClickInTextBox = false;\r\n \r\n}", "function doDrag(e) {\n e.stopImmediatePropagation();\n divCont.style.position = \"absolute\";\n // Change the width of the text input based on the mouse movement\n divCont.style.width = startWidth + _self._ratio * (e.clientX - startX) + \"px\";\n var textArea = divCont.querySelector(\"textarea\");\n textArea.style.height = \"1px\";\n textArea.style.height = textArea.scrollHeight + \"px\";\n\n }", "function dragStart(ev) {\n ev.dataTransfer.effectAllowed='move';\n ev.dataTransfer.setData(\"text\", ev.target.getAttribute('id'));\n ev.dataTransfer.setDragImage(ev.target,0,0);\n return true;\n}", "function onTextUp(txt) {\n textUp(txt)\n draw()\n}", "function dragStart(e){\n\te.dataTransfer.setData('text', e.target.id);\n}", "function dragStart(event) {\r\n event.dataTransfer.setData(\"Text\", event.target.id);\r\n}", "function dragStart(event) {\n //console.log(event)\n event.dataTransfer.setData(\"choice\", event.target.id);\n event.dataTransfer.setData(\"letter\", event.target.innerHTML);\n}", "function handleMouseDown(e) {\n $(\"#submitTextOnCanvas\").css(\"background\",\"green\");\n $(\"#submitTextOnCanvas\").css(\"color\",\"white\");\n $(\"#hint\").html(\"Then click 'Save'\");\n e.preventDefault();\n text_startX = parseInt(e.clientX - text_canvas.offset().left);\n text_startY = parseInt(e.clientY - text_canvas.offset().top);\n // Put your mousedown stuff here\n for (var i = 0; i < texts.length; i++) {\n if (textHittest(text_startX, text_startY, i)) {\n console.log(\"text-e\");\n \n selectedText = i;\n }\n }\n }", "dragStart(e) {\n if (!this.dragState) return;\n // set _drag to true, to bypass the click event above\n this._drag = true;\n }", "function click() {\n d3_eventCancel();\n w.on(\"click.drag\", null);\n }", "function dragMessage(ev) {\n ev.dataTransfer.setData(\"text\", ev.target.innerText);\n}", "function start(event, Dt, Op) {\n\n // Mark the handle as 'active' so it can be styled.\n if (Dt.handles.length === 1) {\n Dt.handles[0].data('grab').addClass(clsList[4]);\n }\n\n // A drag should never propagate up to the 'tap' event.\n event.stopPropagation();\n\n // Attach the move event.\n attach(actions.move, doc, move, {\n start: event\n\t\t\t\t, base: Dt.base\n\t\t\t\t, target: Dt.target\n\t\t\t\t, handles: Dt.handles\n\t\t\t\t, positions: [Dt.handles[0].data('pct')\n\t\t\t\t\t , Dt.handles[Dt.handles.length - 1].data('pct')]\n\t\t\t\t, point: Op['orientation'] ? 'pointY' : 'pointX'\n\t\t\t\t, size: Op['orientation'] ? Dt.base.height() : Dt.base.width()\n });\n\n // Unbind all movement when the drag ends.\n attach(actions.end, doc, end, {\n target: Dt.target\n\t\t\t\t, handles: Dt.handles\n });\n\n // Text selection isn't an issue on touch devices,\n // so adding additional callbacks isn't required.\n if (event.cursor) {\n\n // Prevent the 'I' cursor and extend the range-drag cursor.\n body.css('cursor', $(event.target).css('cursor'));\n\n // Mark the target with a dragging state.\n if (Dt.handles.length > 1) {\n Dt.target.addClass(clsList[20]);\n }\n\n // Prevent text selection when dragging the handles.\n body.on('selectstart' + namespace, function () {\n return false;\n });\n }\n }", "function handleTextClick(event) {\n if (isDragAndDropSupported || !instance) {\n return;\n }\n\n const target = event.target;\n const pageIndex = instance.viewState.currentPageIndex;\n const pageInfo = instance.pageInfoForIndex(pageIndex);\n\n insertTextAnnotation(\n new PSPDFKit.Geometry.Rect({\n width: 220,\n height: 217,\n left: pageInfo.width / 2 - 220 / 2,\n top: pageInfo.height / 2 - 217 / 2,\n }),\n target.innerText,\n pageIndex,\n 26\n );\n}", "function win_drag_start(ftWin){draggingShape = true;}", "function dragStart(event) {\r\n\tevent.dataTransfer.setData(\"text\",event.target.id);\r\n}", "function singleTouchWord() {\n try {\n var range = document.caretRangeFromPoint(android.selection.lastTouchPoint.x, android.selection.lastTouchPoint.y);\n\n range.expand(\"word\");\n\n var preSelectionRange = range.cloneRange();\n preSelectionRange.selectNodeContents(document.getElementsByTagName('body')[0]);\n preSelectionRange.setEnd(range.startContainer, range.startOffset);\n\n// Get start/end position\n var start = preSelectionRange.toString().length;\n var end = start + range.toString().length;\n\n\n window.TextSelection.onSingleTouchWord(start, end);\n } catch (e) {\n window.TextSelection.jsError(\"Single touch error\\n\" + e);\n }\n}", "function dragStart(event) {\n event.dataTransfer.setData(\"text\", event.target.id); // or \"text/plain\" but just \"text\" would also be fine since we are not setting any other type/format for data value\n}", "function Dragging_DetectActionStart(event)\n{\n\t//interactions blocked?\n\tif (__SIMULATOR.UserInteractionBlocked())\n\t{\n\t\t//block the event (will forward to designer, if possible)\n\t\tBrowser_BlockEvent(event);\n\t}\n\telse\n\t{\n\t\t//not during gestures\n\t\tif (!__GESTURES.IsBusy())\n\t\t{\n\t\t\t//get the source element\n\t\t\tvar srcElement = Browser_GetEventSourceElement(event);\n\t\t\t//get the html\n\t\t\tvar theHTML = Get_HTMLObject(srcElement);\n\t\t\t//valid?\n\t\t\tif (theHTML)\n\t\t\t{\n\t\t\t\t//the object we will drag\n\t\t\t\tvar intObject = null;\n\t\t\t\tvar data = null;\n\t\t\t\t//switch according to class\n\t\t\t\tswitch (theHTML.InterpreterObject.DataObject.Class)\n\t\t\t\t{\n\t\t\t\t\tcase __NEMESIS_CLASS_LINK:\n\t\t\t\t\tcase __NEMESIS_CLASS_LABEL:\n\t\t\t\t\tcase __NEMESIS_CLASS_UNKNOWN:\n\t\t\t\t\t\t//attempt to replace the object\n\t\t\t\t\t\tvar replacementObject = Label_ProcessEventForwarding(theHTML.InterpreterObject, __NEMESIS_EVENT_DRAGDROP);\n\t\t\t\t\t\t//found a link\n\t\t\t\t\t\tif (replacementObject)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//we use this\n\t\t\t\t\t\t\tintObject = replacementObject;\n\t\t\t\t\t\t\t//drag it directly\n\t\t\t\t\t\t\ttheHTML = intObject.HTML;\n\t\t\t\t\t\t\t//get data\n\t\t\t\t\t\t\tdata = intObject.GetData();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase __NEMESIS_CLASS_TREE_VIEW:\n\t\t\t\t\t\t//memorise the interpreter object\n\t\t\t\t\t\tintObject = theHTML.InterpreterObject;\n\t\t\t\t\t\t//ask for the html data\n\t\t\t\t\t\tvar treeViewDragData = Treeview_DraggingOverTree(srcElement);\n\t\t\t\t\t\t//valid?\n\t\t\t\t\t\tif (treeViewDragData)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//set it\n\t\t\t\t\t\t\ttheHTML = treeViewDragData.Branch;\n\t\t\t\t\t\t\tdata = treeViewDragData.Exception;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//ignore this\n\t\t\t\t\t\t\tintObject = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t//got element to drag?\n\t\t\t\tif (intObject)\n\t\t\t\t{\n\t\t\t\t\t//begin drag operation\n\t\t\t\t\tDragging_Start(event);\n\t\t\t\t\t//store clone our drag element\n\t\t\t\t\t__DRAG_DATA.DraggingClone = theHTML.cloneNode(true);\n\t\t\t\t\t//indicate that we currently arent visible\n\t\t\t\t\t__DRAG_DATA.IsShowing = false;\n\t\t\t\t\t//get its rect\n\t\t\t\t\tvar rect = Position_GetDisplayRect(theHTML);\n\t\t\t\t\t//set special properties\n\t\t\t\t\t__DRAG_DATA.DraggingClone.style.width = rect.width + \"px\";\n\t\t\t\t\t__DRAG_DATA.DraggingClone.style.height = rect.height + \"px\";\n\t\t\t\t\t__DRAG_DATA.DraggingClone_InitialPosition = { x: rect.left / __SIMULATOR.Scale + __SIMULATOR.Interpreter.DisplayPanel.scrollLeft, y: rect.top / __SIMULATOR.Scale + __SIMULATOR.Interpreter.DisplayPanel.scrollTop };\n\t\t\t\t\t__DRAG_DATA.DraggingClone.style.border = __DRAGGING_CLONE_BORDER;\n\t\t\t\t\t__DRAG_DATA.DraggingClone.style.position = \"absolute\";\n\t\t\t\t\t__DRAG_DATA.DraggingClone.style.zIndex = __ZINDEX_POPUP;\n\t\t\t\t\tBrowser_SetOpacity(__DRAG_DATA.DraggingClone, 50);\n\t\t\t\t\t//update its position\n\t\t\t\t\t__DRAG_DATA.DraggingClone.style.left = __DRAG_DATA.DraggingClone_InitialPosition.x + \"px\";\n\t\t\t\t\t__DRAG_DATA.DraggingClone.style.top = __DRAG_DATA.DraggingClone_InitialPosition.y + \"px\";\n\t\t\t\t\t//setup drag action\n\t\t\t\t\t__DRAG_DATA.DragActionSource = { InterpreterObject: intObject, Data: data };\n\t\t\t\t\t//setup start time\n\t\t\t\t\t__DRAG_DATA.StartTime = new Date().getTime();\n\t\t\t\t\t//set up listeners\n\t\t\t\t\t__DRAG_DATA.OnMove = Dragging_DetectActionMove;\n\t\t\t\t\t__DRAG_DATA.OnEnd = Dragging_DetectActionEnd;\n\t\t\t\t\t__DRAG_DATA.OnWheel = Dragging_DetectActionWheel;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function dragStarted () {\n d3.select(this).raise()\n d3.select(this).attr('cursor', 'grabbing')\n }", "function handleDragStart(){\n this.isMouseDown = true\n}", "setupRectDragging(rect, shared_state) {\n this.setupGroupDragging(rect, shared_state, rect);\n this.setupGroupDragging(this.text, shared_state, rect, true);\n \n this.text.click((e) => e.preventDefault());\n var edit_text_if_not_just_dropped = () => { if (!rect.just_dropped) this.editText(shared_state) };\n rect.click(edit_text_if_not_just_dropped);\n this.text.click(edit_text_if_not_just_dropped);\n }", "function dragStart(ev) {\n\n\tvar quizDivs = getElementsByClassName(\"answer\");\n\tfor (var i = 0; i < quizDivs.length; i++) {\n\t\tquizDivs[i].style.cursor = \"move\";\n\t}\n\tev.dataTransfer.setData(\"Text\",ev.target.id);\n}", "function start ( event, data ) {\n\n\t\t// Mark the handle as 'active' so it can be styled.\n\t\tif( data.handles.length === 1 ) {\n\t\t\tdata.handles[0].children().addClass(Classes[15]);\n\t\t}\n\n\t\t// A drag should never propagate up to the 'tap' event.\n\t\tevent.stopPropagation();\n\n\t\t// Attach the move event.\n\t\tattach ( actions.move, doc, move, {\n\t\t\tstart: event.calcPoint,\n\t\t\thandles: data.handles,\n\t\t\tpositions: [\n\t\t\t\t$Locations[0],\n\t\t\t\t$Locations[$Handles.length - 1]\n\t\t\t]\n\t\t});\n\n\t\t// Unbind all movement when the drag ends.\n\t\tattach ( actions.end, doc, end, null );\n\n\t\t// Text selection isn't an issue on touch devices,\n\t\t// so adding cursor styles can be skipped.\n\t\tif ( event.cursor ) {\n\n\t\t\t// Prevent the 'I' cursor and extend the range-drag cursor.\n\t\t\t$('body').css('cursor', $(event.target).css('cursor'));\n\n\t\t\t// Mark the target with a dragging state.\n\t\t\tif ( $Handles.length > 1 ) {\n\t\t\t\t$Target.addClass(Classes[12]);\n\t\t\t}\n\n\t\t\t// Prevent text selection when dragging the handles.\n\t\t\t$('body').on('selectstart' + namespace, false);\n\t\t}\n\t}", "_dragHandler() {\n if (!this._settings.draggable) return;\n\n if (!this._settings.selectableContent) {\n this._startDrag();\n } else {\n setTimeout(() => this._startDrag(), this._settings.timeToSelect);\n }\n }", "function leftButtonStartDrag(cm, e, start, modifier) {\n var display = cm.display, startTime = +new Date;\n var dragEnd = operation(cm, function(e2) {\n if (webkit) display.scroller.draggable = false;\n cm.state.draggingText = false;\n off(document, \"mouseup\", dragEnd);\n off(display.scroller, \"drop\", dragEnd);\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2);\n if (!modifier && +new Date - 200 < startTime)\n extendSelection(cm.doc, start);\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if (webkit || ie && ie_version == 9)\n setTimeout(function() {document.body.focus(); display.input.focus();}, 20);\n else\n display.input.focus();\n }\n });\n // Let the drag handler handle this.\n if (webkit) display.scroller.draggable = true;\n cm.state.draggingText = dragEnd;\n // IE's approach to draggable\n if (display.scroller.dragDrop) display.scroller.dragDrop();\n on(document, \"mouseup\", dragEnd);\n on(display.scroller, \"drop\", dragEnd);\n }", "function startClicked() {\r\n // get original text in the text area (if any) and hold it in a global variable\r\n if (!!document.getElementById(\"text-area\").value) {\r\n originalText = document.getElementById(\"text-area\").value;\r\n } else {\r\n originalText = '';\r\n }\r\n\r\n // empty the text area, enable the stop button and disable the start button, animation select,\r\n document.getElementById(\"text-area\").value = '';\r\n document.getElementById(\"stop\").disabled = false;\r\n document.getElementById(\"start\").disabled = true;\r\n document.getElementById(\"animation\").disabled = true;\r\n\r\n // get user selections and animate according to them\r\n animate();\r\n}", "function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n if (cm.state.delayingBlurEvent) {\n if (cm.hasFocus()) { cm.state.delayingBlurEvent = false; }\n else { delayBlurEvent(cm); }\n }\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if ((webkit && !safari) || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n cm.state.delayingBlurEvent = true;\n setTimeout(function () { return display.input.focus(); }, 20);\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n }", "function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n if (cm.state.delayingBlurEvent) {\n if (cm.hasFocus()) { cm.state.delayingBlurEvent = false; }\n else { delayBlurEvent(cm); }\n }\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if ((webkit && !safari) || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n cm.state.delayingBlurEvent = true;\n setTimeout(function () { return display.input.focus(); }, 20);\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n }", "function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n if (cm.state.delayingBlurEvent) {\n if (cm.hasFocus()) { cm.state.delayingBlurEvent = false; }\n else { delayBlurEvent(cm); }\n }\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if ((webkit && !safari) || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n cm.state.delayingBlurEvent = true;\n setTimeout(function () { return display.input.focus(); }, 20);\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n }", "function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n if (cm.state.delayingBlurEvent) {\n if (cm.hasFocus()) { cm.state.delayingBlurEvent = false; }\n else { delayBlurEvent(cm); }\n }\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if ((webkit && !safari) || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n cm.state.delayingBlurEvent = true;\n setTimeout(function () { return display.input.focus(); }, 20);\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n }", "function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n if (cm.state.delayingBlurEvent) {\n if (cm.hasFocus()) { cm.state.delayingBlurEvent = false; }\n else { delayBlurEvent(cm); }\n }\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if ((webkit && !safari) || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n cm.state.delayingBlurEvent = true;\n setTimeout(function () { return display.input.focus(); }, 20);\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n }", "function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n if (cm.state.delayingBlurEvent) {\n if (cm.hasFocus()) { cm.state.delayingBlurEvent = false; }\n else { delayBlurEvent(cm); }\n }\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if ((webkit && !safari) || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n cm.state.delayingBlurEvent = true;\n setTimeout(function () { return display.input.focus(); }, 20);\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n }", "function isDragStarted() {\n return dndT != 0;\n }", "function _initCleanText_1(){\r\n\t\t\tclicking = true;\r\n\t\t}", "function leftButtonStartDrag(cm, e, start, modifier) {\n var display = cm.display, startTime = +new Date;\n var dragEnd = operation(cm, function(e2) {\n if (webkit) display.scroller.draggable = false;\n cm.state.draggingText = false;\n off(document, \"mouseup\", dragEnd);\n off(display.scroller, \"drop\", dragEnd);\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2);\n if (!modifier && +new Date - 200 < startTime)\n extendSelection(cm.doc, start);\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if (webkit || ie && ie_version == 9)\n setTimeout(function() {document.body.focus(); display.input.focus();}, 20);\n else\n display.input.focus();\n }\n });\n // Let the drag handler handle this.\n if (webkit) display.scroller.draggable = true;\n cm.state.draggingText = dragEnd;\n dragEnd.copy = mac ? e.altKey : e.ctrlKey\n // IE's approach to draggable\n if (display.scroller.dragDrop) display.scroller.dragDrop();\n on(document, \"mouseup\", dragEnd);\n on(display.scroller, \"drop\", dragEnd);\n }", "function drag(ev) {\n ev.dataTransfer.setData(\"Text\", ev.target.id);\n}", "startTextMode() {\n if (this.getCurrentState() !== states.TEXT) {\n this._state = states.TEXT;\n\n this._getModule(modules.TEXT).start({\n mousedown: this._onFabricMouseDown.bind(this),\n select: this._onFabricSelect.bind(this),\n selectClear: this._onFabricSelectClear.bind(this),\n dbclick: this._onDBClick.bind(this),\n remove: this._handlers.removedObject\n });\n }\n }", "function drag(ev) \n{\n ev.dataTransfer.setData(\"text\", ev.target.id);\n //$('#'+ev.target.id).draggable( {cursor: 'move'} );\n}", "_onDragStart() {\n this._isDragged = true;\n }", "function onDrag(event) {\n\t\tevent.preventDefault && event.preventDefault() || (event.returnValue = false);\n\n\t\tonDrag.x = event.clientX;\n\t\tonDrag.y = event.clientY;\n\n\t\tif (!event.dataTransfer.getData(\"Text\")) {\n\t\t\tobject.style.display = \"block\";\n\n\t\t\tobject.style.left = event.clientX + documentElement.scrollLeft + \"px\";\n\t\t\tobject.style.top = event.clientY + documentElement.scrollTop + \"px\";\n\n\t\t\tonDrop.active = true;\n\t\t} else {\n\t\t\tonDrop.active = false;\n\t\t}\n\t}", "function handleDragStart(e) {\n _('app_status').innerHTML = \"Dragging the element \" + e\n .target\n .getAttribute('id');\n e.dataTransfer.dropEffect = \"move\";\n e\n .dataTransfer\n .setData(\"text\", e.target.getAttribute('id'));\n }", "function handleDragStart(e){\n dragSrcEl = this;\n e.dataTransfer.effectAllowed = 'move';\n e.dataTransfer.setData('text/html', this.innerHTML);\n}", "doTextOperation(){let root=this,selection=root.selection;if(root.toggled&&null!==root.toggledCommand){document.execCommand(root.toggledCommand,!1,root.toggledCommand||\"\")}else if(null!==root.command){root.dispatchEvent(new CustomEvent(root.command+\"-button\",{bubbles:!0,cancelable:!0,composed:!0,detail:root}));document.execCommand(root.command,!1,root.commandVal||\"\");root.selection=selection}}", "function dragBegin(ths, e) {\n splitter = ths;\n document.onmousemove = drag;\n document.onmouseup = dragEnd;\n return false;\n }", "function renderArduinoCodeStart(e) {\n //console.log('handleDragStart');\n if(e !== null) {\n //e.dataTransfer = e.originalEvent.dataTransfer;\n e.dataTransfer.setData('text/html', 'This text may be dragged');\n }\n}", "function file_drag_start(){\n\n\tdrag_flag();\n\n}", "function end(ev) {\nev.dataTransfer.clearData(\"text\");\n}", "function dragStep(ev) {\n ev.dataTransfer.setData(\"text\", $(ev.target).text());\n ev.dataTransfer.setData(\"id\", ev.target.id.split('_')[1]);\n}", "changeDragState(isDragging){\n this.enableTextSelection(!isDragging);\n this.enableGarbage(isDragging);\n this.isDragging = isDragging;\n }", "function mousePressed() {\n // if player is playing\n if (state === \"PLAY\" || state === \"END\") {\n if (textBox.update) {\n // textBox.fullText();\n } else {\n //\n if (textBox.bufferText != null) {\n textBox.insertBuffer();\n } else {\n textBox.hide();\n }\n // if player is holding an item, drop it when clicking\n if (usingItem) {\n dropItem();\n }\n }\n }\n}", "function startDrag (e) {\n //we are capturing the event object and using it to set some information about what is being dragged\n //in this case we are saying that we are storing some text and it is the id of element being moved\n //We need to set this, this iswhy it wasn't working earlier\n //Set the drag's format and data. Use the event target's id for the data\n e.dataTransfer.setData('text', e.target.dataset.audiosrc);\n console.log(\"dragging\");\n console.log(e.dataTransfer.getData('text'));\n }", "function drag(){\n console.log(\"Being dragged around\");\n}", "function startShapeDrag(e) {\n e.dataTransfer.setData('text', this.id);\n }", "function drag(ev) {// credit to https://www.w3schools.com/HTML/html5_draganddrop.asp\n ev.dataTransfer.setData(\"text\", ev.target.id);\n}", "function leftButtonStartDrag(cm, e, start, modifier) {\n\t var display = cm.display, startTime = +new Date;\n\t var dragEnd = operation(cm, function(e2) {\n\t if (webkit) display.scroller.draggable = false;\n\t cm.state.draggingText = false;\n\t off(document, \"mouseup\", dragEnd);\n\t off(display.scroller, \"drop\", dragEnd);\n\t if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n\t e_preventDefault(e2);\n\t if (!modifier && +new Date - 200 < startTime)\n\t extendSelection(cm.doc, start);\n\t // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n\t if (webkit || ie && ie_version == 9)\n\t setTimeout(function() {document.body.focus(); display.input.focus();}, 20);\n\t else\n\t display.input.focus();\n\t }\n\t });\n\t // Let the drag handler handle this.\n\t if (webkit) display.scroller.draggable = true;\n\t cm.state.draggingText = dragEnd;\n\t // IE's approach to draggable\n\t if (display.scroller.dragDrop) display.scroller.dragDrop();\n\t on(document, \"mouseup\", dragEnd);\n\t on(display.scroller, \"drop\", dragEnd);\n\t }", "function leftButtonStartDrag(cm, e, start, modifier) {\n\t var display = cm.display, startTime = +new Date;\n\t var dragEnd = operation(cm, function(e2) {\n\t if (webkit) display.scroller.draggable = false;\n\t cm.state.draggingText = false;\n\t off(document, \"mouseup\", dragEnd);\n\t off(display.scroller, \"drop\", dragEnd);\n\t if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n\t e_preventDefault(e2);\n\t if (!modifier && +new Date - 200 < startTime)\n\t extendSelection(cm.doc, start);\n\t // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n\t if (webkit || ie && ie_version == 9)\n\t setTimeout(function() {document.body.focus(); display.input.focus();}, 20);\n\t else\n\t display.input.focus();\n\t }\n\t });\n\t // Let the drag handler handle this.\n\t if (webkit) display.scroller.draggable = true;\n\t cm.state.draggingText = dragEnd;\n\t // IE's approach to draggable\n\t if (display.scroller.dragDrop) display.scroller.dragDrop();\n\t on(document, \"mouseup\", dragEnd);\n\t on(display.scroller, \"drop\", dragEnd);\n\t }", "function leftButtonStartDrag(cm, e, start, modifier) {\n var display = cm.display, startTime = +new Date\n var dragEnd = operation(cm, function (e2) {\n if (webkit) { display.scroller.draggable = false }\n cm.state.draggingText = false\n off(document, \"mouseup\", dragEnd)\n off(display.scroller, \"drop\", dragEnd)\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2)\n if (!modifier && +new Date - 200 < startTime)\n { extendSelection(cm.doc, start) }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if (webkit || ie && ie_version == 9)\n { setTimeout(function () {document.body.focus(); display.input.focus()}, 20) }\n else\n { display.input.focus() }\n }\n })\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true }\n cm.state.draggingText = dragEnd\n dragEnd.copy = mac ? e.altKey : e.ctrlKey\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop() }\n on(document, \"mouseup\", dragEnd)\n on(display.scroller, \"drop\", dragEnd)\n}", "function start() {\r\n\r\n // Setup annyang\r\n if (annyang) {\r\n annyang.addCommands(speech);\r\n annyang.start();\r\n }\r\n // Hide title screen\r\n $titleScreen.hide()\r\n // Hide\r\n $clearScreen.hide();\r\n\r\n\r\n // Make box droppable\r\n $droppableBox.droppable({\r\n drop: function(ev, ui) {\r\n // Identifies words in droppable box\r\n outputArray.push(ui.draggable[0].textContent);\r\n let id = parseInt(ui.draggable[0].id);\r\n idArray.push(id);\r\n wordObjects[id].textPosition();\r\n clearScreen();\r\n\r\n }\r\n })\r\n resetDroppableBox();\r\n\r\n // Make words draggable\r\n $(\".draggableBox\").draggable({\r\n //start..\r\n start: function(event, ui) {},\r\n //stop..\r\n stop: function(event, ui) {},\r\n drag: function(event, ui) {}\r\n });\r\n\r\n\r\n // Loop\r\n //\r\n // Animation for words\r\n function loop() {\r\n\r\n for (let i = 0; i < wordObjects.length; i++) {\r\n wordObjects[i].move();\r\n }\r\n requestAnimationFrame(loop);\r\n }\r\n requestAnimationFrame(loop);\r\n}", "function handleMouseMove(e) {\n if (selectedText < 0) {\n return;\n }\n e.preventDefault();\n var mouseX = parseInt(e.clientX - text_canvas.offset().left);\n var mouseY = parseInt(e.clientY - text_canvas.offset().top);\n\n // Put your mousemove stuff here\n var dx = mouseX - text_startX;\n var dy = mouseY - text_startY;\n text_startX = mouseX;\n text_startY = mouseY;\n\n var text = texts[selectedText];\n text.x += dx;\n text.y += dy;\n drawText(text_ctx);\n }", "function leftButtonStartDrag(cm, e, start, modifier) {\n var display = cm.display;\n var dragEnd = operation(cm, function(e2) {\n if (webkit) display.scroller.draggable = false;\n cm.state.draggingText = false;\n off(document, \"mouseup\", dragEnd);\n off(display.scroller, \"drop\", dragEnd);\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2);\n if (!modifier)\n extendSelection(cm.doc, start);\n focusInput(cm);\n // Work around unexplainable focus problem in IE9 (#2127)\n if (ie && ie_version == 9)\n setTimeout(function() {document.body.focus(); focusInput(cm);}, 20);\n }\n });\n // Let the drag handler handle this.\n if (webkit) display.scroller.draggable = true;\n cm.state.draggingText = dragEnd;\n // IE's approach to draggable\n if (display.scroller.dragDrop) display.scroller.dragDrop();\n on(document, \"mouseup\", dragEnd);\n on(display.scroller, \"drop\", dragEnd);\n }", "function leftButtonStartDrag(cm, e, start, modifier) {\n var display = cm.display;\n var dragEnd = operation(cm, function(e2) {\n if (webkit) display.scroller.draggable = false;\n cm.state.draggingText = false;\n off(document, \"mouseup\", dragEnd);\n off(display.scroller, \"drop\", dragEnd);\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2);\n if (!modifier)\n extendSelection(cm.doc, start);\n focusInput(cm);\n // Work around unexplainable focus problem in IE9 (#2127)\n if (ie && ie_version == 9)\n setTimeout(function() {document.body.focus(); focusInput(cm);}, 20);\n }\n });\n // Let the drag handler handle this.\n if (webkit) display.scroller.draggable = true;\n cm.state.draggingText = dragEnd;\n // IE's approach to draggable\n if (display.scroller.dragDrop) display.scroller.dragDrop();\n on(document, \"mouseup\", dragEnd);\n on(display.scroller, \"drop\", dragEnd);\n }", "function leftButtonStartDrag(cm, e, start, modifier) {\n var display = cm.display;\n var dragEnd = operation(cm, function(e2) {\n if (webkit) display.scroller.draggable = false;\n cm.state.draggingText = false;\n off(document, \"mouseup\", dragEnd);\n off(display.scroller, \"drop\", dragEnd);\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2);\n if (!modifier)\n extendSelection(cm.doc, start);\n focusInput(cm);\n // Work around unexplainable focus problem in IE9 (#2127)\n if (ie && ie_version == 9)\n setTimeout(function() {document.body.focus(); focusInput(cm);}, 20);\n }\n });\n // Let the drag handler handle this.\n if (webkit) display.scroller.draggable = true;\n cm.state.draggingText = dragEnd;\n // IE's approach to draggable\n if (display.scroller.dragDrop) display.scroller.dragDrop();\n on(document, \"mouseup\", dragEnd);\n on(display.scroller, \"drop\", dragEnd);\n }", "function leftButtonStartDrag(cm, e, start, modifier) {\n var display = cm.display;\n var dragEnd = operation(cm, function(e2) {\n if (webkit) display.scroller.draggable = false;\n cm.state.draggingText = false;\n off(document, \"mouseup\", dragEnd);\n off(display.scroller, \"drop\", dragEnd);\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2);\n if (!modifier)\n extendSelection(cm.doc, start);\n focusInput(cm);\n // Work around unexplainable focus problem in IE9 (#2127)\n if (ie && ie_version == 9)\n setTimeout(function() {document.body.focus(); focusInput(cm);}, 20);\n }\n });\n // Let the drag handler handle this.\n if (webkit) display.scroller.draggable = true;\n cm.state.draggingText = dragEnd;\n // IE's approach to draggable\n if (display.scroller.dragDrop) display.scroller.dragDrop();\n on(document, \"mouseup\", dragEnd);\n on(display.scroller, \"drop\", dragEnd);\n }", "function leftButtonStartDrag(cm, e, start, modifier) {\n var display = cm.display;\n var dragEnd = operation(cm, function(e2) {\n if (webkit) display.scroller.draggable = false;\n cm.state.draggingText = false;\n off(document, \"mouseup\", dragEnd);\n off(display.scroller, \"drop\", dragEnd);\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2);\n if (!modifier)\n extendSelection(cm.doc, start);\n focusInput(cm);\n // Work around unexplainable focus problem in IE9 (#2127)\n if (ie && ie_version == 9)\n setTimeout(function() {document.body.focus(); focusInput(cm);}, 20);\n }\n });\n // Let the drag handler handle this.\n if (webkit) display.scroller.draggable = true;\n cm.state.draggingText = dragEnd;\n // IE's approach to draggable\n if (display.scroller.dragDrop) display.scroller.dragDrop();\n on(document, \"mouseup\", dragEnd);\n on(display.scroller, \"drop\", dragEnd);\n }", "function leftButtonStartDrag(cm, e, start, modifier) {\n var display = cm.display;\n var dragEnd = operation(cm, function(e2) {\n if (webkit) display.scroller.draggable = false;\n cm.state.draggingText = false;\n off(document, \"mouseup\", dragEnd);\n off(display.scroller, \"drop\", dragEnd);\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2);\n if (!modifier)\n extendSelection(cm.doc, start);\n focusInput(cm);\n // Work around unexplainable focus problem in IE9 (#2127)\n if (ie && ie_version == 9)\n setTimeout(function() {document.body.focus(); focusInput(cm);}, 20);\n }\n });\n // Let the drag handler handle this.\n if (webkit) display.scroller.draggable = true;\n cm.state.draggingText = dragEnd;\n // IE's approach to draggable\n if (display.scroller.dragDrop) display.scroller.dragDrop();\n on(document, \"mouseup\", dragEnd);\n on(display.scroller, \"drop\", dragEnd);\n }", "function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display,\n moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) {\n display.scroller.draggable = false;\n }\n\n cm.state.draggingText = false;\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n\n if (!moved) {\n e_preventDefault(e);\n\n if (!behavior.addNew) {\n extendSelection(cm.doc, pos, null, null, behavior.extend);\n } // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n\n\n if (webkit && !safari || ie && ie_version == 9) {\n setTimeout(function () {\n display.wrapper.ownerDocument.body.focus({\n preventScroll: true\n });\n display.input.focus();\n }, 20);\n } else {\n display.input.focus();\n }\n }\n });\n\n var mouseMove = function mouseMove(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n\n var dragStart = function dragStart() {\n return moved = true;\n }; // Let the drag handler handle this.\n\n\n if (webkit) {\n display.scroller.draggable = true;\n }\n\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag; // IE's approach to draggable\n\n if (display.scroller.dragDrop) {\n display.scroller.dragDrop();\n }\n\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n delayBlurEvent(cm);\n setTimeout(function () {\n return display.input.focus();\n }, 20);\n }", "_onDragStart(event) {\n super._onDragStart(event);\n canvas.app.view.oncontextmenu = ev => this._onRightClick(event);\n let data = this._getNewDataFromEvent(event);\n let drawing = new FurnaceDrawing(data);\n drawing.draw();\n drawing._controlled = true;\n event.data.object = this.preview.addChild(drawing);\n // You can place a text by simply clicking, no need to drag it first.\n if (drawing.type == CONST.DRAWING_TYPES.TEXT)\n event.data.createState = 2;\n event.data.createTime = Date.now();\n }", "function leftButtonStartDrag(cm, event, pos, behavior) {\n\t\t var display = cm.display, moved = false;\n\t\t var dragEnd = operation(cm, function (e) {\n\t\t if (webkit) { display.scroller.draggable = false; }\n\t\t cm.state.draggingText = false;\n\t\t if (cm.state.delayingBlurEvent) {\n\t\t if (cm.hasFocus()) { cm.state.delayingBlurEvent = false; }\n\t\t else { delayBlurEvent(cm); }\n\t\t }\n\t\t off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n\t\t off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n\t\t off(display.scroller, \"dragstart\", dragStart);\n\t\t off(display.scroller, \"drop\", dragEnd);\n\t\t if (!moved) {\n\t\t e_preventDefault(e);\n\t\t if (!behavior.addNew)\n\t\t { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n\t\t // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n\t\t if ((webkit && !safari) || ie && ie_version == 9)\n\t\t { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); }\n\t\t else\n\t\t { display.input.focus(); }\n\t\t }\n\t\t });\n\t\t var mouseMove = function(e2) {\n\t\t moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n\t\t };\n\t\t var dragStart = function () { return moved = true; };\n\t\t // Let the drag handler handle this.\n\t\t if (webkit) { display.scroller.draggable = true; }\n\t\t cm.state.draggingText = dragEnd;\n\t\t dragEnd.copy = !behavior.moveOnDrag;\n\t\t on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n\t\t on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n\t\t on(display.scroller, \"dragstart\", dragStart);\n\t\t on(display.scroller, \"drop\", dragEnd);\n\n\t\t cm.state.delayingBlurEvent = true;\n\t\t setTimeout(function () { return display.input.focus(); }, 20);\n\t\t // IE's approach to draggable\n\t\t if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n\t\t }", "function drag(ev) {\n ev.dataTransfer.setData(\"text\", ev.target.id);\n}", "function drag(ev) {\n ev.dataTransfer.setData(\"text\", ev.target.id);\n}", "function leftButtonStartDrag(cm, e, start, modifier) {\n\t var display = cm.display, startTime = +new Date;\n\t var dragEnd = operation(cm, function(e2) {\n\t if (webkit) display.scroller.draggable = false;\n\t cm.state.draggingText = false;\n\t off(document, \"mouseup\", dragEnd);\n\t off(display.scroller, \"drop\", dragEnd);\n\t if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n\t e_preventDefault(e2);\n\t if (!modifier && +new Date - 200 < startTime)\n\t extendSelection(cm.doc, start);\n\t // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n\t if (webkit || ie && ie_version == 9)\n\t setTimeout(function() {document.body.focus(); display.input.focus();}, 20);\n\t else\n\t display.input.focus();\n\t }\n\t });\n\t // Let the drag handler handle this.\n\t if (webkit) display.scroller.draggable = true;\n\t cm.state.draggingText = dragEnd;\n\t dragEnd.copy = mac ? e.altKey : e.ctrlKey\n\t // IE's approach to draggable\n\t if (display.scroller.dragDrop) display.scroller.dragDrop();\n\t on(document, \"mouseup\", dragEnd);\n\t on(display.scroller, \"drop\", dragEnd);\n\t }", "function editOnDragStart(){this._internalDrag=true;this.setMode('drag');}", "function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if (webkit || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus(); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n delayBlurEvent(cm);\n setTimeout(function () { return display.input.focus(); }, 20);\n}", "function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if (webkit || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus(); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n delayBlurEvent(cm);\n setTimeout(function () { return display.input.focus(); }, 20);\n}", "function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if (webkit || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus(); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n delayBlurEvent(cm);\n setTimeout(function () { return display.input.focus(); }, 20);\n}", "function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if (webkit || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus(); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n delayBlurEvent(cm);\n setTimeout(function () { return display.input.focus(); }, 20);\n}", "function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if (webkit || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus(); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n delayBlurEvent(cm);\n setTimeout(function () { return display.input.focus(); }, 20);\n}", "function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if (webkit || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus(); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n delayBlurEvent(cm);\n setTimeout(function () { return display.input.focus(); }, 20);\n}", "_bindMouse() {\n const div = this.textLayerDiv;\n let expandDivsTimer = null;\n\n div.addEventListener(\"mousedown\", evt => {\n if (this.enhanceTextSelection && this.textLayerRenderTask) {\n this.textLayerRenderTask.expandTextDivs(true);\n if (\n (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) &&\n expandDivsTimer\n ) {\n clearTimeout(expandDivsTimer);\n expandDivsTimer = null;\n }\n return;\n }\n\n const end = div.querySelector(\".endOfContent\");\n if (!end) {\n return;\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n // On non-Firefox browsers, the selection will feel better if the height\n // of the `endOfContent` div is adjusted to start at mouse click\n // location. This avoids flickering when the selection moves up.\n // However it does not work when selection is started on empty space.\n let adjustTop = evt.target !== div;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n adjustTop =\n adjustTop &&\n window\n .getComputedStyle(end)\n .getPropertyValue(\"-moz-user-select\") !== \"none\";\n }\n if (adjustTop) {\n const divBounds = div.getBoundingClientRect();\n const r = Math.max(0, (evt.pageY - divBounds.top) / divBounds.height);\n end.style.top = (r * 100).toFixed(2) + \"%\";\n }\n }\n end.classList.add(\"active\");\n });\n\n div.addEventListener(\"mouseup\", () => {\n if (this.enhanceTextSelection && this.textLayerRenderTask) {\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n expandDivsTimer = setTimeout(() => {\n if (this.textLayerRenderTask) {\n this.textLayerRenderTask.expandTextDivs(false);\n }\n expandDivsTimer = null;\n }, EXPAND_DIVS_TIMEOUT);\n } else {\n this.textLayerRenderTask.expandTextDivs(false);\n }\n return;\n }\n\n const end = div.querySelector(\".endOfContent\");\n if (!end) {\n return;\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n end.style.top = \"\";\n }\n end.classList.remove(\"active\");\n });\n }", "function beginDrag(ev){\n\tcurrentChoice = ev.target.id;\n\tconsole.log(\"Current choice is:\" + currentChoice);\n\tdrag(ev);\n}", "function drag(ev) {\n ev.dataTransfer.setData(\"text\", ev.target.id);\n}", "function drag(ev) {\n ev.dataTransfer.setData(\"text\", ev.target.id);\n}", "function drag(ev) {\n ev.dataTransfer.setData(\"text\", ev.target.id);\n}", "function dragStart () {\n d3.event.sourceEvent.stopPropagation();\n}" ]
[ "0.6689381", "0.64861673", "0.6454419", "0.6442164", "0.63774365", "0.62934095", "0.622602", "0.6050684", "0.6036101", "0.6016681", "0.6009714", "0.6001581", "0.59893286", "0.59748036", "0.5961804", "0.5918658", "0.5912148", "0.58981645", "0.58869565", "0.58803177", "0.5859681", "0.5855703", "0.58483815", "0.58414716", "0.58405155", "0.58281314", "0.5800175", "0.57745564", "0.57658654", "0.57369876", "0.5694501", "0.56893677", "0.5682695", "0.5679215", "0.5668125", "0.5667503", "0.56633294", "0.565017", "0.5647211", "0.5638589", "0.5614507", "0.5599019", "0.559095", "0.55741024", "0.55741024", "0.55741024", "0.55741024", "0.55741024", "0.55741024", "0.55622333", "0.55466837", "0.5544709", "0.5540436", "0.5539199", "0.55357224", "0.5528119", "0.5527857", "0.5514938", "0.5512435", "0.55118495", "0.55110765", "0.5507874", "0.5501962", "0.5497025", "0.5487112", "0.54842806", "0.5482935", "0.5481083", "0.54754007", "0.5473372", "0.54675", "0.5465452", "0.5465452", "0.5465442", "0.546037", "0.5458945", "0.54581565", "0.54581565", "0.54581565", "0.54581565", "0.54581565", "0.54581565", "0.5456068", "0.54532224", "0.5446255", "0.5431537", "0.5431537", "0.54294497", "0.54161084", "0.54149044", "0.54149044", "0.54149044", "0.54149044", "0.54149044", "0.54149044", "0.5407807", "0.5403774", "0.5403398", "0.5403398", "0.5403398", "0.5399811" ]
0.0
-1
Normal selection, as opposed to text dragging.
function leftButtonSelect(cm, event, start, behavior) { var display = cm.display, doc = cm.doc; e_preventDefault(event); var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges; if (behavior.addNew && !behavior.extend) { ourIndex = doc.sel.contains(start); if (ourIndex > -1) { ourRange = ranges[ourIndex]; } else { ourRange = new Range(start, start); } } else { ourRange = doc.sel.primary(); ourIndex = doc.sel.primIndex; } if (behavior.unit == "rectangle") { if (!behavior.addNew) { ourRange = new Range(start, start); } start = posFromMouse(cm, event, true, true); ourIndex = -1; } else { var range$$1 = rangeForUnit(cm, start, behavior.unit); if (behavior.extend) { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); } else { ourRange = range$$1; } } if (!behavior.addNew) { ourIndex = 0; setSelection(doc, new Selection([ourRange], 0), sel_mouse); startSel = doc.sel; } else if (ourIndex == -1) { ourIndex = ranges.length; setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex), {scroll: false, origin: "*mouse"}); } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) { setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0), {scroll: false, origin: "*mouse"}); startSel = doc.sel; } else { replaceOneSelection(doc, ourIndex, ourRange, sel_mouse); } var lastPos = start; function extendTo(pos) { if (cmp(lastPos, pos) == 0) { return } lastPos = pos; if (behavior.unit == "rectangle") { var ranges = [], tabSize = cm.options.tabSize; var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize); var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize); var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol); for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line)); line <= end; line++) { var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize); if (left == right) { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); } else if (text.length > leftPos) { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); } } if (!ranges.length) { ranges.push(new Range(start, start)); } setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), {origin: "*mouse", scroll: false}); cm.scrollIntoView(pos); } else { var oldRange = ourRange; var range$$1 = rangeForUnit(cm, pos, behavior.unit); var anchor = oldRange.anchor, head; if (cmp(range$$1.anchor, anchor) > 0) { head = range$$1.head; anchor = minPos(oldRange.from(), range$$1.anchor); } else { head = range$$1.anchor; anchor = maxPos(oldRange.to(), range$$1.head); } var ranges$1 = startSel.ranges.slice(0); ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head)); setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse); } } var editorSize = display.wrapper.getBoundingClientRect(); // Used to ensure timeout re-tries don't fire when another extend // happened in the meantime (clearTimeout isn't reliable -- at // least on Chrome, the timeouts still happen even when cleared, // if the clear happens after their scheduled firing time). var counter = 0; function extend(e) { var curCount = ++counter; var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle"); if (!cur) { return } if (cmp(cur, lastPos) != 0) { cm.curOp.focus = activeElt(); extendTo(cur); var visible = visibleLines(display, doc); if (cur.line >= visible.to || cur.line < visible.from) { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); } } else { var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0; if (outside) { setTimeout(operation(cm, function () { if (counter != curCount) { return } display.scroller.scrollTop += outside; extend(e); }), 50); } } } function done(e) { cm.state.selectingText = false; counter = Infinity; e_preventDefault(e); display.input.focus(); off(display.wrapper.ownerDocument, "mousemove", move); off(display.wrapper.ownerDocument, "mouseup", up); doc.history.lastSelOrigin = null; } var move = operation(cm, function (e) { if (e.buttons === 0 || !e_button(e)) { done(e); } else { extend(e); } }); var up = operation(cm, done); cm.state.selectingText = up; on(display.wrapper.ownerDocument, "mousemove", move); on(display.wrapper.ownerDocument, "mouseup", up); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "unselectText_() {\n try {\n this.win.getSelection().removeAllRanges();\n } catch (e) {\n // Selection API not supported.\n }\n }", "clearSelection() {\n this._clearSelection();\n }", "cut() {\n if (this.owner.isReadOnlyMode || this.selection.isEmpty) {\n return;\n }\n this.selection.copySelectedContent(true);\n }", "function normalizeSelection() {\n\t\t\t// Normalize selection for example <b>a</b><i>|a</i> becomes <b>a|</b><i>a</i> except for Ctrl+A since it selects everything\n\t\t\teditor.on('keyup focusin mouseup', function(e) {\n\t\t\t\tif (e.keyCode != 65 || !VK.metaKeyPressed(e)) {\n\t\t\t\t\tselection.normalize();\n\t\t\t\t}\n\t\t\t}, true);\n\t\t}", "function normalizeSelection() {\n\t\t\t// Normalize selection for example <b>a</b><i>|a</i> becomes <b>a|</b><i>a</i> except for Ctrl+A since it selects everything\n\t\t\teditor.on('keyup focusin mouseup', function(e) {\n\t\t\t\tif (e.keyCode != 65 || !VK.metaKeyPressed(e)) {\n\t\t\t\t\tselection.normalize();\n\t\t\t\t}\n\t\t\t}, true);\n\t\t}", "function normalizeSelection() {\n\t\t\t// Normalize selection for example <b>a</b><i>|a</i> becomes <b>a|</b><i>a</i> except for Ctrl+A since it selects everything\n\t\t\teditor.on('keyup focusin mouseup', function(e) {\n\t\t\t\tif (e.keyCode != 65 || !VK.metaKeyPressed(e)) {\n\t\t\t\t\tselection.normalize();\n\t\t\t\t}\n\t\t\t}, true);\n\t\t}", "function unblockTextSelection() {\n _document2['default'].onselectstart = function () {\n return true;\n };\n}", "function unblockTextSelection() {\n _document2['default'].onselectstart = function () {\n return true;\n };\n}", "function removeAllSelections() {\r\n\tvar pos = getCaretPosition();\r\n\twindow.getSelection().removeAllRanges();\r\n\tsetCaretPosition(pos);\r\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 unselectText() {\n window.getSelection().empty();\n}", "function unblockTextSelection() {\n document.onselectstart = function () {\n return true;\n };\n }", "resetSelection() {\n if (!this.isSelectionEmpty()) {\n this._resetSelection();\n this._fireChangeSelection();\n }\n }", "function disable_text_selection() {\n \n if ( typeof document.body.onselectstart != 'undefined' ){\n document.body.onselectstart = function(){ return false; };\n } else if ( typeof document.body.style.MozUserSelect != 'undefined' ) {\n document.body.style.MozUserSelect = 'none';\n } else if ( typeof document.body.style.webkitUserSelect != 'undefined' ) {\n document.body.style.webkitUserSelect = 'none';\n } else {\n document.body.onmousedown = function(){ return false; };\n }\n\n document.body.style.cursor = 'default';\n \n }", "function _corexitOnMouseUp(event) {\r\n\tvar selection = window.getSelection();\r\n\tvar selectedText = selection ? selection.toString() : \"\";\r\n\r\n //unselect\r\n //selection.collapseToStart();\r\n\r\n\t//if (selectedText.length != 0) {\r\n chrome.extension.sendRequest({command : \"sendText\", text : selectedText});\r\n\t//}\r\n \r\n\t//gClickInTextBox = false;\r\n \r\n}", "function disableTextSelection() {\n // jQuery doesn't support the element.text attribute in MSIE 8\n // http://stackoverflow.com/questions/2692770/style-style-textcss-appendtohead-does-not-work-in-ie\n var $style = $('<style id=\"__dragtable_disable_text_selection__\" type=\"text/css\">body { -ms-user-select:none;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;user-select:none; }</style>');\n $(document.head).append($style);\n $(document.body).attr('onselectstart', 'return false;').attr('unselectable', 'on');\n if (window.getSelection) {\n window.getSelection().removeAllRanges();\n } else {\n document.selection.empty(); // MSIE http://msdn.microsoft.com/en-us/library/ms535869%28v=VS.85%29.aspx\n }\n }", "function unblockTextSelection() {\n document.onselectstart = function () {\n return true;\n };\n}", "function removeTextSelection() {\n\n if (window.getSelection) {\n\n window.getSelection().removeAllRanges();\n\n } else if (document.selection) {\n\n document.selection.empty();\n\n }\n\n}", "function fixTextSelection( dom_element )\n {\n //chrome, opera, and safari select PRE text correctly \n if ($.chili.selection.active && ($.browser.msie || $.browser.mozilla)) \n {\n var element = null;\n $(dom_element)\n .parents()\n .filter(\"pre\")\n .bind(\"mousedown\", resetSelectedTextElement)\n .bind(\"mouseup\", displaySelectedTextDialog)\n ;\n }\n }", "function removeTextSelections() {\n if (document.selection) document.selection.empty();\n else if (window.getSelection) window.getSelection().removeAllRanges();\n}", "selectIt() {\n var index = 1,\n text,\n modIndex,\n modLength;\n text = this.selected.text;\n modIndex = this.mod.indexOf(text);\n modLength = this.mod.slice(0, modIndex).length;\n var modEnd = this.mod.slice(modIndex + text.length, this.mod.length);\n if (this.modded) {\n index = this.selected.start + modLength;\n } else {\n index = this.selected.start - modLength;\n }\n this.el.focus();\n // el.selectionStart = index;\n // el.selectionEnd = selected.text.length + index;\n var ending = this.selected.text.length + index;\n this.setSelectionRange(this.el, index, ending);\n }", "function removeSelectionHighlight() {\r\n hideSelectionRect();\r\n hideRotIndicator();\r\n }", "function clearSelection()\n{\n if (window.getSelection) {window.getSelection().removeAllRanges();}\n else if (document.selection) {document.selection.empty();}\n}", "resetSelection () {\n this.currentSelection = null\n }", "clearSelection() {\n this.selectionStart = undefined;\n this.selectionEnd = undefined;\n this.isSelectAllActive = false;\n this.selectionStartLength = 0;\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 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}", "deselectAll() {\n if (document.selection) {\n document.selection.empty();\n } else if (window.getSelection) {\n window.getSelection().removeAllRanges();\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 }", "function selectText(element) {\n\n if (document.body.createTextRange) {\n var range = document.body.createTextRange();\n range.moveToElementText(element);\n range.select();\n } else if (window.getSelection) {\n var selection = window.getSelection();\n var range = document.createRange();\n range.selectNode(element);\n selection.removeAllRanges();\n selection.addRange(range);\n }\n }", "select() {\n this.getInput().select();\n }", "function blockTextSelection() {\n _document2['default'].body.focus();\n _document2['default'].onselectstart = function () {\n return false;\n };\n}", "function blockTextSelection() {\n _document2['default'].body.focus();\n _document2['default'].onselectstart = function () {\n return false;\n };\n}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function selectText() {\n if (document.body.createTextRange) {\n const range = document.body.createTextRange();\n range.moveToElementText(target);\n range.select();\n } else if (window.getSelection) {\n const selection = window.getSelection();\n const range = document.createRange();\n range.selectNodeContents(target);\n selection.removeAllRanges();\n selection.addRange(range);\n } else {\n console.warn(\"Could not select text in node: Unsupported browser.\");\n }\n}", "function select() {\n const text = document.querySelector('#source');\n\n text.focus();\n text.setSelectionRange(0, text.value.length);\n}", "function unblockTextSelection() {\n global_document__WEBPACK_IMPORTED_MODULE_1___default.a.onselectstart = function () {\n return true;\n };\n}", "function unblockTextSelection() {\n global_document__WEBPACK_IMPORTED_MODULE_1___default.a.onselectstart = function () {\n return true;\n };\n}", "function removeGhostSelection() {\n\t\t\teditor.on('Undo Redo SetContent', function(e) {\n\t\t\t\tif (!e.initial) {\n\t\t\t\t\teditor.execCommand('mceRepaint');\n\t\t\t\t}\n\t\t\t});\n\t\t}", "clearSelection() {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this.refresh();\n this._onSelectionChange.fire();\n }", "function unblockTextSelection() {\n global_document__WEBPACK_IMPORTED_MODULE_7___default.a.onselectstart = function () {\n return true;\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 clearSelection () {\n if (document.selection) {\n document.selection.empty();\n } else if (window.getSelection) {\n window.getSelection().removeAllRanges();\n }\n}", "function r(e,t){e.selection.isCollapsed()&&e.selection.selectLine();for(var n=e.selection.surround(t),o=0,s=n.length;o<s;o++)b.dom.lineBreaks(n[o]).remove(),u(n[o]);// rethink restoring selection\n// composer.selection.selectNode(element, wysihtml5.browser.displaysCaretInEmptyContentEditableCorrectly());\n}", "select() {\n\t\tthis.inputView.select();\n\t}", "_resetSelection() {\n this.__selectedRangeArr = [];\n this.__anchorSelectionIndex = -1;\n this.__leadSelectionIndex = -1;\n }", "function allowTextSelection() {\n var styles='*,p,div{user-select:text !important;-moz-user-select:text !important;-webkit-user-select:text !important;}';\n jQuery('head').append(jQuery('<style />').html(styles));\n \n window.console && console.log('allowTextSelection');\n \n var allowNormal = function(){\n return true;\n };\n \n window.console && console.log('Elements unbound: '+\n jQuery('*[onselectstart], *[ondragstart], *[oncontextmenu], #songLyricsDiv'\n ).unbind('contextmenu').unbind('selectstart').unbind('dragstart'\n ).unbind('mousedown').unbind('mouseup').unbind('click'\n ).attr('onselectstart',allowNormal).attr('oncontextmenu',allowNormal\n ).attr('ondragstart',allowNormal).size());\n}", "function SelectionChange() { }", "function SelectionChange() { }", "function selectTextAgain($container)\n {\n if ($.browser.msie) \n {\n $container[0].focus();\n $container[0].select();\n }\n else \n {\n var s = window.getSelection();\n s.removeAllRanges();\n var r = document.createRange();\n r.selectNodeContents( $container[0] );\n s.addRange( r );\n }\n }", "function blockTextSelection() {\n global_document__WEBPACK_IMPORTED_MODULE_1___default.a.body.focus();\n\n global_document__WEBPACK_IMPORTED_MODULE_1___default.a.onselectstart = function () {\n return false;\n };\n}", "function blockTextSelection() {\n global_document__WEBPACK_IMPORTED_MODULE_1___default.a.body.focus();\n\n global_document__WEBPACK_IMPORTED_MODULE_1___default.a.onselectstart = function () {\n return false;\n };\n}", "function blockTextSelection() {\n global_document__WEBPACK_IMPORTED_MODULE_7___default.a.body.focus();\n\n global_document__WEBPACK_IMPORTED_MODULE_7___default.a.onselectstart = function () {\n return false;\n };\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}", "function selectionRestore() {\n if (savedSelection) {\n rangy.restoreSelection(savedSelection);\n savedSelection = false;\n }\n}", "function prepareSelectAllHack() {\r\n if (display.input.selectionStart != null) {\r\n var selected = cm.somethingSelected();\r\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\r\n display.prevInput = selected ? \"\" : \"\\u200b\";\r\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\r\n // Re-set this, in case some other handler touched the\r\n // selection in the meantime.\r\n display.selForContextMenu = cm.doc.sel;\r\n }\r\n }", "function ClearTextSelection() {\n\t//console.log('Clear text selection.');\n\tif ( document.selection ) {\n //console.log('document.selection'); \n\t\tdocument.selection.empty();\n\t} else if ( window.getSelection ) {\n\t\t//console.log('window.getSelection');\n\t\twindow.getSelection().removeAllRanges();\n\t}\n} // END ClearTextSelection.", "function selectText(target) {\n const range = document.createRange();\n range.selectNodeContents(target);\n\n const selection = window.getSelection();\n selection.removeAllRanges();\n selection.addRange(range);\n}", "get isSelection() {\n return true;\n }", "function UISelection(){\n\n }", "function prepareSelectAllHack() {\n if (display.input.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\n display.prevInput = selected ? \"\" : \"\\u200b\";\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (display.input.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\n display.prevInput = selected ? \"\" : \"\\u200b\";\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (display.input.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\n display.prevInput = selected ? \"\" : \"\\u200b\";\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (display.input.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\n display.prevInput = selected ? \"\" : \"\\u200b\";\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (display.input.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\n display.prevInput = selected ? \"\" : \"\\u200b\";\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected()\n var extval = \"\\u200b\" + (selected ? te.value : \"\")\n te.value = \"\\u21da\" // Used to catch context-menu undo\n te.value = extval\n input.prevInput = selected ? \"\" : \"\\u200b\"\n te.selectionStart = 1; te.selectionEnd = extval.length\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected()\n var extval = \"\\u200b\" + (selected ? te.value : \"\")\n te.value = \"\\u21da\" // Used to catch context-menu undo\n te.value = extval\n input.prevInput = selected ? \"\" : \"\\u200b\"\n te.selectionStart = 1; te.selectionEnd = extval.length\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel\n }\n }", "function dontPosSelect() {\n return false;\n }", "function blockTextSelection() {\n document.body.focus();\n\n document.onselectstart = function () {\n return false;\n };\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\r\n if (te.selectionStart != null) {\r\n var selected = cm.somethingSelected();\r\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\r\n te.value = \"\\u21da\"; // Used to catch context-menu undo\r\n te.value = extval;\r\n input.prevInput = selected ? \"\" : \"\\u200b\";\r\n te.selectionStart = 1; te.selectionEnd = extval.length;\r\n // Re-set this, in case some other handler touched the\r\n // selection in the meantime.\r\n display.selForContextMenu = cm.doc.sel;\r\n }\r\n }", "unSelectAll () { this.toggSelAll(false); }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function blockTextSelection() {\n document.body.focus();\n document.onselectstart = function () {\n return false;\n };\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 }", "clearSelection() {\n var _a;\n (_a = this._selectionService) === null || _a === void 0 ? void 0 : _a.clearSelection();\n }", "function selectedText() {\n var selection = window.getSelection();\n return selection.type === 'Range' ? selection : false\n }", "function clearPreviousSelection()\n {\n if ($.browser.msie) \n {\n document.selection.empty();\n }\n else\n {\n window.getSelection().removeAllRanges();\n }\n }", "function prepareSelectAllHack() {\n\t\t if (te.selectionStart != null) {\n\t\t var selected = cm.somethingSelected();\n\t\t var extval = \"\\u200b\" + (selected ? te.value : \"\");\n\t\t te.value = \"\\u21da\"; // Used to catch context-menu undo\n\t\t te.value = extval;\n\t\t input.prevInput = selected ? \"\" : \"\\u200b\";\n\t\t te.selectionStart = 1; te.selectionEnd = extval.length;\n\t\t // Re-set this, in case some other handler touched the\n\t\t // selection in the meantime.\n\t\t display.selForContextMenu = cm.doc.sel;\n\t\t }\n\t\t }", "_textBoxSelectHandler() {\n const that = this;\n\n if (that.disabled) {\n return;\n }\n\n that.selectionStart = that.$.input.selectionStart;\n that.selectionEnd = that.$.input.selectionEnd;\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }" ]
[ "0.74885833", "0.7268716", "0.7257491", "0.72482944", "0.72482944", "0.72482944", "0.7164153", "0.7164153", "0.71332663", "0.7116289", "0.7114912", "0.7097566", "0.7063641", "0.704988", "0.70417166", "0.70114183", "0.7003303", "0.69794875", "0.6955937", "0.6951775", "0.69376177", "0.6917325", "0.69034827", "0.6893554", "0.68930864", "0.6860823", "0.6850448", "0.6835745", "0.68220186", "0.6813771", "0.6804792", "0.6792025", "0.67888826", "0.67888826", "0.67847127", "0.67847127", "0.67847127", "0.67847127", "0.678341", "0.6772614", "0.6757433", "0.6757433", "0.675729", "0.67518824", "0.67478794", "0.6738775", "0.6732941", "0.67096436", "0.6708647", "0.6702884", "0.66908383", "0.66711044", "0.66711044", "0.6663142", "0.66554534", "0.66554534", "0.66522247", "0.66485757", "0.6645641", "0.6641818", "0.6641312", "0.66345656", "0.6628851", "0.66260797", "0.6619729", "0.6619729", "0.6619729", "0.6619729", "0.6619729", "0.661688", "0.661688", "0.66157854", "0.6612882", "0.6603289", "0.6603289", "0.6594249", "0.6585122", "0.6581448", "0.6581448", "0.6581448", "0.6581448", "0.6581448", "0.6581448", "0.6581448", "0.6581448", "0.6581448", "0.6581448", "0.6581448", "0.6573091", "0.65695745", "0.6567821", "0.6567561", "0.65625614", "0.65594006", "0.6556811", "0.6554626", "0.6554626", "0.6554626", "0.6554626", "0.6554626", "0.6554626" ]
0.0
-1
Used when mouseselecting to adjust the anchor to the proper side of a bidi jump depending on the visual position of the head.
function bidiSimplify(cm, range$$1) { var anchor = range$$1.anchor; var head = range$$1.head; var anchorLine = getLine(cm.doc, anchor.line); if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range$$1 } var order = getOrder(anchorLine); if (!order) { return range$$1 } var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index]; if (part.from != anchor.ch && part.to != anchor.ch) { return range$$1 } var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1); if (boundary == 0 || boundary == order.length) { return range$$1 } // Compute the relative visual position of the head compared to the // anchor (<0 is to the left, >0 to the right) var leftSide; if (head.line != anchor.line) { leftSide = (head.line - anchor.line) * (cm.doc.direction == "ltr" ? 1 : -1) > 0; } else { var headIndex = getBidiPartAt(order, head.ch, head.sticky); var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1); if (headIndex == boundary - 1 || headIndex == boundary) { leftSide = dir < 0; } else { leftSide = dir > 0; } } var usePart = order[boundary + (leftSide ? -1 : 0)]; var from = leftSide == (usePart.level == 1); var ch = from ? usePart.from : usePart.to, sticky = from ? "after" : "before"; return anchor.ch == ch && anchor.sticky == sticky ? range$$1 : new Range(new Pos(anchor.line, ch, sticky), head) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setLabelAnchor(d) {\r\n if (d.target.x >= (d.source.x + 20)) return \"start\";\r\n if (d.target.x <= (d.source.x - 20)) return \"end\";\r\n return \"middle\";\r\n }", "function updateAnchorPos() {\n if (!labelSim.selection) return;\n\n labelSim.selection.each(function(d) {\n var bbox = this.getBBox(),\n x = bbox.x + bbox.width/2,\n y = bbox.y + bbox.height/2\n\n d.anchorPos.x = x\n d.anchorPos.y = y\n d.anchorPos.fx = x\n d.anchorPos.fy = y\n\n // If a label position does not exist, set it to be the anchor position\n if (d.labelPos.x == null) {\n d.labelPos.x = x\n d.labelPos.y = y\n }\n })\n }", "setAnchorPostion(anchor, newX, newY) {\n anchor.html.attr(\"cx\", newX).attr(\"cy\", newY);\n }", "function anchorAt(txt,x,y) {\n\ttxt.position=[x-(txt.anchor[0]-txt.position[0]),(txt.position[1]-txt.anchor[1])+y];\n}", "set anchor(value) {}", "function newAnchorLabel() {\n count = ++that.anchor_count;\n anchor_label = strval((count + 1)); //generating footnote number starting at 1 instead of 0\n /* yil original letter generating label code\n anchor_label = '';\n do {\n anchor_label = chr(ord('a') + (count % 26)) + anchor_label;\n count = (int) floor(count / 26);\n } while (count > 0);*/\n return anchor_label;\n }", "function setSelection(cm, anchor, head, bias, checkAtomic) {\n cm.view.goalColumn = null;\n var sel = cm.view.sel;\n // Skip over atomic spans.\n if (checkAtomic || !posEq(anchor, sel.anchor))\n anchor = skipAtomic(cm, anchor, bias, checkAtomic != \"push\");\n if (checkAtomic || !posEq(head, sel.head))\n head = skipAtomic(cm, head, bias, checkAtomic != \"push\");\n\n if (posEq(sel.anchor, anchor) && posEq(sel.head, head)) return;\n\n sel.anchor = anchor; sel.head = head;\n var inv = posLess(head, anchor);\n sel.from = inv ? head : anchor;\n sel.to = inv ? anchor : head;\n\n cm.curOp.updateInput = true;\n cm.curOp.selectionChanged = true;\n }", "function setSelection(cm, anchor, head, bias, checkAtomic) {\n cm.view.goalColumn = null;\n var sel = cm.view.sel;\n // Skip over atomic spans.\n if (checkAtomic || !posEq(anchor, sel.anchor))\n anchor = skipAtomic(cm, anchor, bias, checkAtomic != \"push\");\n if (checkAtomic || !posEq(head, sel.head))\n head = skipAtomic(cm, head, bias, checkAtomic != \"push\");\n\n if (posEq(sel.anchor, anchor) && posEq(sel.head, head)) return;\n\n sel.anchor = anchor; sel.head = head;\n var inv = posLess(head, anchor);\n sel.from = inv ? head : anchor;\n sel.to = inv ? anchor : head;\n\n cm.curOp.updateInput = true;\n cm.curOp.selectionChanged = true;\n }", "function setSelection(cm, anchor, head, bias, checkAtomic) {\n cm.view.goalColumn = null;\n var sel = cm.view.sel;\n // Skip over atomic spans.\n if (checkAtomic || !posEq(anchor, sel.anchor))\n anchor = skipAtomic(cm, anchor, bias, checkAtomic != \"push\");\n if (checkAtomic || !posEq(head, sel.head))\n head = skipAtomic(cm, head, bias, checkAtomic != \"push\");\n\n if (posEq(sel.anchor, anchor) && posEq(sel.head, head)) return;\n\n sel.anchor = anchor; sel.head = head;\n var inv = posLess(head, anchor);\n sel.from = inv ? head : anchor;\n sel.to = inv ? anchor : head;\n\n cm.curOp.updateInput = true;\n cm.curOp.selectionChanged = true;\n }", "function setSelection(doc, anchor, head, bias, checkAtomic) {\n if (!checkAtomic && hasHandler(doc, \"beforeSelectionChange\") || doc.cm && hasHandler(doc.cm, \"beforeSelectionChange\")) {\n var filtered = filterSelectionChange(doc, anchor, head);\n head = filtered.head;\n anchor = filtered.anchor;\n }\n\n var sel = doc.sel;\n sel.goalColumn = null;\n // Skip over atomic spans.\n if (checkAtomic || !posEq(anchor, sel.anchor))\n anchor = skipAtomic(doc, anchor, bias, checkAtomic != \"push\");\n if (checkAtomic || !posEq(head, sel.head))\n head = skipAtomic(doc, head, bias, checkAtomic != \"push\");\n\n if (posEq(sel.anchor, anchor) && posEq(sel.head, head)) return;\n\n sel.anchor = anchor; sel.head = head;\n var inv = posLess(head, anchor);\n sel.from = inv ? head : anchor;\n sel.to = inv ? anchor : head;\n\n if (doc.cm)\n doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged =\n doc.cm.curOp.cursorActivity = true;\n\n signalLater(doc, \"cursorActivity\", doc);\n }", "function setSelection(doc, anchor, head, bias, checkAtomic) {\n if (!checkAtomic && hasHandler(doc, \"beforeSelectionChange\") || doc.cm && hasHandler(doc.cm, \"beforeSelectionChange\")) {\n var filtered = filterSelectionChange(doc, anchor, head);\n head = filtered.head;\n anchor = filtered.anchor;\n }\n\n var sel = doc.sel;\n sel.goalColumn = null;\n if (bias == null) bias = posLess(head, sel.head) ? -1 : 1;\n // Skip over atomic spans.\n if (checkAtomic || !posEq(anchor, sel.anchor))\n anchor = skipAtomic(doc, anchor, bias, checkAtomic != \"push\");\n if (checkAtomic || !posEq(head, sel.head))\n head = skipAtomic(doc, head, bias, checkAtomic != \"push\");\n\n if (posEq(sel.anchor, anchor) && posEq(sel.head, head)) return;\n\n sel.anchor = anchor; sel.head = head;\n var inv = posLess(head, anchor);\n sel.from = inv ? head : anchor;\n sel.to = inv ? anchor : head;\n\n if (doc.cm)\n doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged =\n doc.cm.curOp.cursorActivity = true;\n\n signalLater(doc, \"cursorActivity\", doc);\n }", "function setSelection(doc, anchor, head, bias, checkAtomic) {\n if (!checkAtomic && hasHandler(doc, \"beforeSelectionChange\") || doc.cm && hasHandler(doc.cm, \"beforeSelectionChange\")) {\n var filtered = filterSelectionChange(doc, anchor, head);\n head = filtered.head;\n anchor = filtered.anchor;\n }\n\n var sel = doc.sel;\n sel.goalColumn = null;\n if (bias == null) bias = posLess(head, sel.head) ? -1 : 1;\n // Skip over atomic spans.\n if (checkAtomic || !posEq(anchor, sel.anchor))\n anchor = skipAtomic(doc, anchor, bias, checkAtomic != \"push\");\n if (checkAtomic || !posEq(head, sel.head))\n head = skipAtomic(doc, head, bias, checkAtomic != \"push\");\n\n if (posEq(sel.anchor, anchor) && posEq(sel.head, head)) return;\n\n sel.anchor = anchor; sel.head = head;\n var inv = posLess(head, anchor);\n sel.from = inv ? head : anchor;\n sel.to = inv ? anchor : head;\n\n if (doc.cm)\n doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged =\n doc.cm.curOp.cursorActivity = true;\n\n signalLater(doc, \"cursorActivity\", doc);\n }", "function setSelection(doc, anchor, head, bias, checkAtomic) {\n if (!checkAtomic && hasHandler(doc, \"beforeSelectionChange\") || doc.cm && hasHandler(doc.cm, \"beforeSelectionChange\")) {\n var filtered = filterSelectionChange(doc, anchor, head);\n head = filtered.head;\n anchor = filtered.anchor;\n }\n\n var sel = doc.sel;\n sel.goalColumn = null;\n if (bias == null) bias = posLess(head, sel.head) ? -1 : 1;\n // Skip over atomic spans.\n if (checkAtomic || !posEq(anchor, sel.anchor))\n anchor = skipAtomic(doc, anchor, bias, checkAtomic != \"push\");\n if (checkAtomic || !posEq(head, sel.head))\n head = skipAtomic(doc, head, bias, checkAtomic != \"push\");\n\n if (posEq(sel.anchor, anchor) && posEq(sel.head, head)) return;\n\n sel.anchor = anchor; sel.head = head;\n var inv = posLess(head, anchor);\n sel.from = inv ? head : anchor;\n sel.to = inv ? anchor : head;\n\n if (doc.cm)\n doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged =\n doc.cm.curOp.cursorActivity = true;\n\n signalLater(doc, \"cursorActivity\", doc);\n }", "function alterAnchor(e){\n\t// Prevent native scroll event.\n\te.preventDefault();\n\tvar destination = document.getElementById(e.target.classList[0]);\n\t// Find distance from top of page.\n\tvar body = document.body.getBoundingClientRect().top;\n\t// Find distance from top of element to scroll to.\n\tvar element = destination.getBoundingClientRect().top;\n\t// Find difference.\n\tvar newLoc = element - body - 25;\n\t// Go there.\n\t// window.scrollTo(0, newLoc);\n\tsmoothScroll(-body, newLoc);\n}", "jump() {\n if (this._state !== this.PLAY_STATE) {\n return;\n }\n if (this._jump > 1) {\n this._y -= Math.floor(this._jump * 0.08);\n if (this._y < 0) {\n this._y = 0;\n }\n this._jump = Math.floor(this._jump * 0.92);\n } else {\n this._jump = 0;\n }\n offset = this._jump;\n }", "anchor() {\n this.__anchors++;\n }", "anchor() {\n this.__anchors++;\n }", "anchor() {\n this.__anchors++;\n }", "anchor() {\n this.__anchors++;\n }", "get anchor() { return this.$anchor.pos }", "function swapAnchor (whichLayer, newAnchor) {\n\n\t\t// Layer Transform Group\n\tvar layerTransformGrp = whichLayer.property(\"ADBE Transform Group\");\n\n\t\t// Position Layer Anchor Point\n\tvar theLayerAnchor = layerTransformGrp.property(\"ADBE Anchor Point\");\n\ttheLayerAnchor.setValue(newAnchor);\n\n}", "function Va(e){Qa(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}", "function setLabelAnchor(d) {\n return d.angle > Math.PI ? 'end' : null;\n }", "function UpdateAnchorsHandler() { }", "startDraggingAnchors(element) {\n const mousedown = (mouse, anchor) => {\n this.scalable = true;\n this.mouse = mouse;\n\n if (element.type === \"line\") {\n const P1 = element.bounding.P1;\n const P2 = element.bounding.P2;\n\n this.bound = {\n x1: P1.x + this.props.x,\n y1: P1.y + this.props.y,\n x2: P2.x + this.props.x,\n y2: P2.y + this.props.y,\n\n diffX: Math.abs(P1.x - P2.x),\n diffY: Math.abs(P1.y - P2.y),\n };\n\n this.initialBounds = {\n diffX: this.bound.diffX / this.previousScaleX,\n diffY: this.bound.diffY / this.previousScaleY,\n };\n\n const diffX = Math.abs(P1.x - P2.x) / 2;\n const diffY = Math.abs(P1.y - P2.y) / 2;\n\n const clickedPoint = [P1, P2][anchor - 1];\n const otherPoint = [P2, P1][anchor - 1];\n\n const isClickedPointBiggerX = clickedPoint.x > otherPoint.x;\n const isClickedPointBiggerY = clickedPoint.y > otherPoint.y;\n\n this.isClickedPointBiggerX = isClickedPointBiggerX;\n this.isClickedPointBiggerY = isClickedPointBiggerY;\n\n this.anchorTransition = {\n x: isClickedPointBiggerX ? -diffX : diffX,\n y: isClickedPointBiggerY ? -diffY : diffY,\n };\n\n const initialHalfDiffX = this.initialBounds.diffX / 2;\n const initialHalfDiffY = this.initialBounds.diffY / 2;\n\n const { x1, y1, x2, y2 } = element.props;\n\n this.anchorTransitionPos = {\n x1:\n x1 + (isClickedPointBiggerX ? initialHalfDiffX : -initialHalfDiffX),\n y1:\n y1 + (isClickedPointBiggerY ? initialHalfDiffY : -initialHalfDiffY),\n\n x2:\n x2 + (isClickedPointBiggerX ? initialHalfDiffX : -initialHalfDiffX),\n y2:\n y2 + (isClickedPointBiggerY ? initialHalfDiffY : -initialHalfDiffY),\n\n x: isClickedPointBiggerX ? initialHalfDiffX : -initialHalfDiffX,\n y: isClickedPointBiggerY ? initialHalfDiffY : -initialHalfDiffY,\n };\n } else {\n // NOT line elements\n this.bound = {\n x: element.bounding.minX + this.props.x,\n y: element.bounding.minY + this.props.y,\n width:\n Math.abs(element.bounding.maxX) + Math.abs(element.bounding.minX),\n height:\n Math.abs(element.bounding.maxY) + Math.abs(element.bounding.minY),\n };\n\n this.initialBounds = {\n width: this.bound.width / this.previousScaleX,\n height: this.bound.height / this.previousScaleY,\n };\n\n const halfWidth = this.bound.width / 2;\n const halfHeight = this.bound.height / 2;\n\n const initialHalfWidth = this.initialBounds.width / 2;\n const initialHalfHeight = this.initialBounds.height / 2;\n\n this.anchorTransition = {\n x: anchor % 2 ? -halfWidth : halfWidth,\n y: Math.floor(anchor / 3) ? halfHeight : -halfHeight,\n };\n\n if (element.type === \"polygon\") {\n const newPoints =\n element.props.points &&\n element.props.points\n .split(\" \")\n .map((point) => {\n const [xx, yy] = point.split(\",\");\n\n return {\n x:\n parseFloat(xx) +\n (anchor % 2 ? initialHalfWidth : -initialHalfWidth),\n y:\n parseFloat(yy) +\n (Math.floor(anchor / 3)\n ? -initialHalfHeight\n : initialHalfHeight),\n };\n })\n .reduce((sum, { x, y }) => `${sum} ${x},${y}`, \"\")\n .trim();\n\n this.anchorTransitionPos = {\n points: newPoints,\n x: anchor % 2 ? initialHalfWidth : -initialHalfWidth,\n y: Math.floor(anchor / 3) ? -initialHalfHeight : initialHalfHeight,\n };\n } else {\n this.anchorTransitionPos = {\n x: anchor % 2 ? initialHalfWidth : -initialHalfWidth,\n y: Math.floor(anchor / 3) ? -initialHalfHeight : initialHalfHeight,\n };\n }\n }\n };\n\n const mouseup = () => {\n this.scalable = false;\n\n this.previousScaleX = this.props.scaleX;\n this.previousScaleY = this.props.scaleY;\n\n this.props.x =\n this.props.x +\n this.anchorTransition.x +\n this.anchorTransitionPos.x * this.props.scaleX;\n\n this.props.y =\n this.props.y +\n this.anchorTransition.y +\n this.anchorTransitionPos.y * this.props.scaleY;\n\n if (element.type === \"polygon\") {\n const newPoints =\n element.props.points &&\n element.props.points\n .split(\" \")\n .map((point) => {\n const [xx, yy] = point.split(\",\");\n\n return { x: parseFloat(xx), y: parseFloat(yy) };\n })\n .reduce((sum, { x, y }) => `${sum} ${x},${y}`, \"\")\n .trim();\n\n this.anchorTransitionPos.points = newPoints;\n this.anchorTransitionPos.x = 0;\n this.anchorTransitionPos.y = 0;\n } else if (element.type === \"line\") {\n const { x1, y1, x2, y2 } = element.props;\n\n this.anchorTransitionPos.x1 = x1;\n this.anchorTransitionPos.y1 = y1;\n this.anchorTransitionPos.x2 = x2;\n this.anchorTransitionPos.y2 = y2;\n\n this.anchorTransitionPos.x = 0;\n this.anchorTransitionPos.y = 0;\n } else {\n this.anchorTransitionPos.x = 0;\n this.anchorTransitionPos.y = 0;\n }\n\n this.anchorTransition.x = 0;\n this.anchorTransition.y = 0;\n\n element.updateMouseTransformation(this);\n };\n\n const mousemove = (mouse, anchor) => {\n if (this.scalable) {\n if (element.type === \"line\") {\n const diffX = mouse.x - [this.bound.x1, this.bound.x2][anchor - 1];\n const diffY = mouse.y - [this.bound.y1, this.bound.y2][anchor - 1];\n\n const scaleX =\n this.previousScaleX -\n (this.isClickedPointBiggerX ? -diffX : diffX) /\n this.initialBounds.diffX;\n\n const scaleY =\n this.previousScaleY -\n (this.isClickedPointBiggerY ? -diffY : diffY) /\n this.initialBounds.diffY;\n\n this.mouse = mouse;\n\n this.props = {\n scaleX,\n scaleY,\n x: this.props.x || this.bound.x + this.bound.width / 2,\n y: this.props.y || this.bound.y + this.bound.height / 2,\n rotate: 0,\n };\n } else {\n const width = anchor % 2 ? this.bound.width : 0;\n const height = Math.floor(anchor / 3) ? 0 : this.bound.height;\n\n const diffX = mouse.x - (this.bound.x + width);\n const diffY = mouse.y - (this.bound.y + height);\n\n const scaleX =\n this.previousScaleX -\n (anchor % 2 ? diffX * -1 : diffX) / this.initialBounds.width;\n\n const scaleY =\n this.previousScaleY -\n (Math.floor(anchor / 3) ? diffY : diffY * -1) /\n this.initialBounds.height;\n\n const { x1, y1, x2, y2 } = this.bound;\n\n this.mouse = mouse;\n this.props = {\n scaleX,\n scaleY,\n x: this.props.x || Math.min(x1, x2) + Math.abs(x1 - x2) / 2,\n y: this.props.y || Math.min(y1, y2) + Math.abs(y1 - y2) / 2,\n rotate: 0,\n };\n }\n\n element.updateMouseTransformation(this);\n }\n };\n\n // these handlers start as soon as we click on of the anchors.\n this.scalingHandlers = { mousedown, mousemove, mouseup };\n }", "function setCellSelection($anchor, event) {\n var $head = cellUnderMouse(view, event);\n var starting = key.getState(view.state) == null;\n if (!$head || !inSameTable($anchor, $head)) {\n if (starting) { $head = $anchor; }\n else { return }\n }\n var selection = new CellSelection($anchor, $head);\n if (starting || !view.state.selection.eq(selection)) {\n var tr = view.state.tr.setSelection(selection);\n if (starting) { tr.setMeta(key, $anchor.pos); }\n view.dispatch(tr);\n }\n }", "anchorDragMove(dx, dy, x, y) {\r\n let p = new Point2D_1.Point2D(this.dragOrigin.x + dx, this.dragOrigin.y + dy);\r\n if (this.paperRect !== null) {\r\n p = p.boundToRect(this.paperRect);\r\n }\r\n window.requestAnimationFrame(() => {\r\n this.ghostAnchor.attr({ cx: p.x, cy: p.y });\r\n });\r\n this.updateRegion(p);\r\n }", "constructor($anchor, $head = $anchor) {\n let inv = $anchor.pos > $head.pos\n super(inv ? $head : $anchor, inv ? $anchor : $head)\n // :: ResolvedPos The resolved anchor of the selection.\n this.$anchor = $anchor\n // :: ResolvedPos The resolved head of the selection.\n this.$head = $head\n }", "anchorDragBegin() {\r\n // do nothing\r\n }", "function anchorFirst(){self.startRow=anchorRow;self.startNode=selection.anchorNode;self.startOffset=selection.anchorOffset;self.endRow=focusRow;self.endNode=selection.focusNode;self.endOffset=selection.focusOffset;}// This function is used when we detect that the \"focus\" node is first.", "function offsetAnchor() {\n if (location.hash.length !== 0) {\n window.scrollTo(window.scrollX, window.scrollY - 110);\n }\n}", "function addCenterJumpMenu(layer, text, fontType, fontSize, height, onTouch)\n{\n var easyLabel = new cc.LabelTTF(text, fontType, fontSize);\n easyLabel.color = cc.color(0,0,0,255);\n var easyItem = new SoundMenuItemLabel(easyLabel,onTouch,layer);\n easyItem.setPosition(cc.p(cc.winSize.width/2, cc.winSize.height/2 + height));\n\n return easyItem;\n}", "function deriveAnchor(edge, index, ep, conn) {\n return options.anchor ? options.anchor : options.deriveAnchor(edge, index, ep, conn);\n }", "_setEvent_jump(){\n let jumps = this._carousel.find(this._controlSelectors.jump);\n $(jumps).click((e)=>{\n let indexStr = $(e.target).attr(this._itemIndexAttr);\n let indexInt = parseInt(indexStr);\n this.jump(indexInt);\n });\n }", "handleHighlight(e){\n let startIdx = window.getSelection().getRangeAt(0).startOffset;\n let endIdx = window.getSelection().getRangeAt(0).endOffset;\n if(startIdx!=endIdx){\n this.props.history.push(`/songs/${this.props.match.params.songId}/create/${startIdx}/${endIdx}`);\n }else{\n this.resetClicked();\n this.props.history.push(`/songs/${this.props.match.params.songId}`);\n }\n }", "function offsetAnchor() {\r\n\tif (location.hash.length !== 0) {\r\n\t\twindow.scrollTo(window.scrollX, window.scrollY - 100);\r\n\t}\r\n}", "function edge(event, Dt, Op) {\n\n var handles = Dt.base.data('handles'), to, i;\n\n i = Op['orientation'] ? event['pointY'] : event['pointX'];\n i = i < Dt.base.offset()[Op['style']];\n\n to = i ? 0 : 100;\n i = i ? 0 : handles.length - 1;\n\n jump(Dt.base, handles[i], to, [Op['slide'], Op['set']]);\n }", "function offsetAnchor() {\n if (location.hash.length !== 0) {\n window.scrollTo(window.scrollX, window.scrollY - 100);\n }\n}", "function offsetAnchor() {\n if (location.hash.length !== 0) {\n window.scrollTo(window.scrollX, window.scrollY - 100);\n }\n}", "get anchor() {\n return this.$anchor.pos;\n }", "function offsetAnchor() {\n if (location.hash.length !== 0) {\n window.scrollTo(window.scrollX, window.scrollY - 100)\n }\n}", "_onAnchorUpdate() {\n this._transformID = -1;\n this._transformTrimmedID = -1;\n }", "function generate_hyperlink_position(in_x, in_y) {\n\t// {{{\n\tvar ital = document.createElement(\"i\");\n\tital.innerHTML += \"(\" + in_x + \",\" + in_y + \")\";\n\tif (in_x < 0.5 || in_x > 100) {\n\t\treturn ital;\n\t}\n\tif (in_y < 0.5 || in_y > 100) {\n\t\treturn ital;\n\t}\n\tital.setAttribute(\"newX\", \"\" + in_x);\n\tital.setAttribute(\"newY\", \"\" + in_y);\n\tital.style.textDecoration = \"none\";\n\n\tital.addEventListener(\n\t\t'click',\n\t\tfunction(event) {\n\t\t\tvar dx = this.getAttribute(\"newX\");\n\t\t\tvar dy = this.getAttribute(\"newY\");\n\t\t\tselect_dest_x.selectedIndex = 2*dx-1;\n\t\t\tselect_dest_y.selectedIndex = 2*dy-1;\n\t\t\tGM_setValue(\"destination_x\", \"\" + dx);\n\t\t\tGM_setValue(\"destination_y\", \"\" + dy);\n\t\t\tcommon_func(event, null);\n\t\t},\n\t\ttrue);\n\n\tital.addEventListener(\n\t\t'mouseover',\n\t\tfunction(event) {\n\t\t\tthis.style.textDecoration = \"underline\";\n\t\t},\n\t\ttrue);\n\n\tital.addEventListener(\n\t\t'mouseout',\n\t\tfunction(event) {\n\t\t\tthis.style.textDecoration = \"none\";\n\t\t},\n\t\ttrue);\n\treturn ital;\n\t// }}}\n}", "function getSelectionAnchor() {\r\n\treturn [selectionAnchorLine, selectionAnchorColumn];\r\n}", "function offsetAnchor() {\n if (location.hash.length !== 0) {\n window.scrollTo(window.scrollX, window.scrollY - 100);\n }\n}", "function enableAnchor(anchor) {\n anchor.style.pointerEvents = \"all\";\n anchor.style.cursor = \"pointer\";\n anchor.className = \"button game-mode-button back-color-1\";\n}", "get anchor() {\n return new FudgeCore.Vector3(this.jointAnchor.x, this.jointAnchor.y, this.jointAnchor.z);\n }", "function moveAlong(movemouse, selected) {\n movemouse.preventDefault();\n var left = parseInt(movemouse.clientX - diffX);\n var top = parseInt(movemouse.clientY - diffY);\n if (top < 0) {\n top = 0;\n }\n if (left < 0) {\n left = 0;\n }\n if (top > window.innerHeight - 1) {\n top = window.innerHeight - 1;\n }\n if (left > window.innerWidth - 1) {\n left = window.innerWidth - 1;\n }\n selected.style.left = left + 'px';\n selected.style.top = top + 'px';\n }", "_onAnchorUpdate()\n {\n this._transformID = -1;\n }", "function determineTextAnchor(point){\n if(Math.abs(point.x) < 0.01 && point.x >= 0){\n return \"middle\"\n }\n else if(point.x > 0){\n return \"start\"\n }\n else{\n return \"end\"\n }\n }", "function alinhar(imagem, x, y){\n\timagem.anchor.x = x;\n\timagem.anchor.y = y;\n}", "function Ma(e,t,a){var r=ca(e,t,\"div\",null,null,!e.options.singleCursorHeightPerLine),f=a.appendChild(n(\"div\",\"聽\",\"CodeMirror-cursor\"));if(f.style.left=r.left+\"px\",f.style.top=r.top+\"px\",f.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+\"px\",r.other){\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var o=a.appendChild(n(\"div\",\"聽\",\"CodeMirror-cursor CodeMirror-secondarycursor\"));o.style.display=\"\",o.style.left=r.other.left+\"px\",o.style.top=r.other.top+\"px\",o.style.height=.85*(r.other.bottom-r.other.top)+\"px\"}}", "function highlightLink() {\r\n // Extract dimensions / coord from highlighted element\r\n const linkCoords = this.getBoundingClientRect();\r\n // Set the highlight elements dimensions and coords based on THIS' data\r\n highlight.style.width = `${linkCoords.width}px`;\r\n highlight.style.height = `${linkCoords.height}px`;\r\n highlight.style.transform = `translate(${linkCoords.left}px, ${linkCoords.top + window.scrollY}px)`;\r\n}", "function shiftTrackIntoView() {\n\tcancelPlayback();\n\tlet shift = getViewOctaveShift(selectedTrack);\n\ttracks[selectedTrack].octaveShift = shift;\n\ttracks[selectedTrack].semitoneShift = 0;\n\tdocument.getElementById('octaveShift').value = shift;\n\tlevel.noteGroups[selectedTrack].ofsY = tracks[selectedTrack].octaveShift * 12 + tracks[selectedTrack].semitoneShift;\n\tcalculateNoteRange();\n\tadjustZoom();\n\tsoftRefresh();\n\tupdateInstrumentContainer();\n}", "function setSimpleSelection(doc, anchor, head, options) {\r\n setSelection(doc, simpleSelection(anchor, head), options);\r\n}", "function setSimpleSelection(doc, anchor, head, options) {\r\n setSelection(doc, simpleSelection(anchor, head), options);\r\n }", "function moveSelected(delta) {\n setSelectedIndex(selectedIndex + delta);\n }", "function arrowMode() {\r\n\t\tvar move = document.getElementById(\"move\");\r\n\t\tvar select = document.getElementById(\"select\");\r\n\t\tvar scroll = document.getElementById(\"scroll\");\r\n\t\tif (move.checked === true) {\r\n\t\t myDiagram.commandHandler.arrowKeyBehavior = \"move\";\r\n\t\t} else if (select.checked === true) {\r\n\t\t myDiagram.commandHandler.arrowKeyBehavior = \"select\";\r\n\t\t} else if (scroll.checked === true) {\r\n\t\t myDiagram.commandHandler.arrowKeyBehavior = \"scroll\";\r\n\t\t}\r\n\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\t setSelection(doc, simpleSelection(anchor, head), options);\n\t\t }", "function offsetAnchor() {\n if (location.hash.length !== 0) {\n // window.scrollTo(window.scrollX, window.scrollY - 140);\n $(\"html\").animate({ scrollTop: $(location.hash).offset().top - 160 }, 500);\n }\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 }", "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 centerAnchorPoint(layer){\n var comp = app.project.activeItem;\n var x = layer.sourceRectAtTime(comp.time,false).width/2 + layer.sourceRectAtTime(comp.time,false).left;\n var y = layer.sourceRectAtTime(comp.time,false).height/2 + layer.sourceRectAtTime(comp.time,false).top;\n layer.anchorPoint.setValue([x,y]);\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\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 newPos(){\n //Triangle3: using triangle 1 sine, define triangle 3, side A will be the strike power (with correction)\n var triangle3A = strike * 6;\n var triangle3B = Math.round(sine1 * triangle3A,0);\n var triangle3C = Math.round(Math.pow(Math.pow(triangle3A,2)-Math.pow(triangle3B,2),0.5),0);\n\n //Define the new coordinates (newPosX and newPosY), depending on (if) which side mouse is pointing\n if (mousePosX > ballNewPosX){\n ballNewPosX = ballNewPosX - triangle3C - ballWidth/2;\n ballNewPosY = ballNewPosY + triangle3B - ballHeight/2;\n }\n if (mousePosX <= ballNewPosX){\n ballNewPosX = ballNewPosX + triangle3C - ballWidth/2;\n ballNewPosY = ballNewPosY + triangle3B - ballHeight/2;\n }\n}", "function updateAnchorItemsPositions() {\n for (var k = 0; k < anchorBlocks.length; k++) {\n var item = anchorBlocks[k];\n var blockTop = 0;\n var blockH = _utility.wndH;\n if (item.$block.length) {\n blockTop = item.$block.offset().top;\n blockH = item.$block.innerHeight();\n }\n item.activate = blockTop - _utility.wndH / 2;\n item.deactivate = blockTop + blockH - _utility.wndH / 2;\n }\n }", "function scrollToHead (anchor) {\n var item\n try {\n item = $(anchor)\n } catch (e) {\n // fix #286 support hexo v5\n item = $(decodeURI(anchor))\n }\n item.velocity('stop').velocity('scroll', {\n duration: 500,\n easing: 'easeInOutQuart',\n offset: -70,\n })\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.6865997", "0.65352046", "0.63302565", "0.6309565", "0.6135887", "0.6132395", "0.6033308", "0.6033308", "0.6033308", "0.5898258", "0.5860216", "0.5860216", "0.5860216", "0.5844974", "0.5740096", "0.5736967", "0.5736967", "0.5736967", "0.5736967", "0.569803", "0.56956744", "0.5647185", "0.5629125", "0.5572312", "0.55476665", "0.5539712", "0.55258137", "0.5517393", "0.55152506", "0.55019003", "0.54789937", "0.5459916", "0.54391015", "0.5432524", "0.542029", "0.54139143", "0.53609854", "0.5336877", "0.5336877", "0.5332756", "0.53321046", "0.5319646", "0.5319342", "0.53139305", "0.53132683", "0.5301415", "0.52998334", "0.52934897", "0.52882755", "0.5271572", "0.5270496", "0.5270377", "0.526394", "0.5248651", "0.5246501", "0.52331716", "0.52327317", "0.52272946", "0.52270186", "0.52270186", "0.5206779", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.5200203", "0.519751", "0.5191643", "0.5191643", "0.5183407", "0.5183407", "0.5183407", "0.5175141", "0.51740026", "0.5173665", "0.516924", "0.516924", "0.516924", "0.516924", "0.516924", "0.516924" ]
0.0
-1
Determines whether an event happened in the gutter, and fires the handlers for the corresponding event.
function gutterEvent(cm, e, type, prevent) { var mX, mY; if (e.touches) { mX = e.touches[0].clientX; mY = e.touches[0].clientY; } else { try { mX = e.clientX; mY = e.clientY; } catch(e) { return false } } if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false } if (prevent) { e_preventDefault(e); } var display = cm.display; var lineBox = display.lineDiv.getBoundingClientRect(); if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) } mY -= lineBox.top - display.viewOffset; for (var i = 0; i < cm.options.gutters.length; ++i) { var g = display.gutters.childNodes[i]; if (g && g.getBoundingClientRect().right >= mX) { var line = lineAtHeight(cm.doc, mY); var gutter = cm.options.gutters[i]; signal(cm, type, cm, line, gutter, e); return e_defaultPrevented(e) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gutterEvent(cm, e, type, prevent, signalfn) {\n try { var mX = e.clientX, mY = e.clientY; }\n catch(e) { return false; }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n if (prevent) e_preventDefault(e);\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signalfn(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e);\n }\n }\n }", "function gutterEvent(cm, e, type, prevent, signalfn) {\n try { var mX = e.clientX, mY = e.clientY; }\n catch(e) { return false; }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n if (prevent) e_preventDefault(e);\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signalfn(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e);\n }\n }\n }", "function gutterEvent(cm, e, type, prevent, signalfn) {\n try { var mX = e.clientX, mY = e.clientY; }\n catch(e) { return false; }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n if (prevent) e_preventDefault(e);\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signalfn(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e);\n }\n }\n }", "function gutterEvent(cm, e, type, prevent, signalfn) {\n try { var mX = e.clientX, mY = e.clientY; }\n catch(e) { return false; }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n if (prevent) e_preventDefault(e);\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signalfn(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e);\n }\n }\n }", "function gutterEvent(cm, e, type, prevent, signalfn) {\n try { var mX = e.clientX, mY = e.clientY; }\n catch(e) { return false; }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n if (prevent) e_preventDefault(e);\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signalfn(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e);\n }\n }\n }", "function gutterEvent(cm, e, type, prevent, signalfn) {\n try { var mX = e.clientX, mY = e.clientY; }\n catch(e) { return false; }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n if (prevent) e_preventDefault(e);\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signalfn(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e);\n }\n }\n }", "function gutterEvent(cm, e, type, prevent, signalfn) {\n try { var mX = e.clientX, mY = e.clientY; }\n catch(e) { return false; }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n if (prevent) e_preventDefault(e);\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signalfn(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e);\n }\n }\n }", "function gutterEvent(cm, e, type, prevent, signalfn) {\r\n try { var mX = e.clientX, mY = e.clientY; }\r\n catch(e) { return false; }\r\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\r\n if (prevent) e_preventDefault(e);\r\n\r\n var display = cm.display;\r\n var lineBox = display.lineDiv.getBoundingClientRect();\r\n\r\n if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\r\n mY -= lineBox.top - display.viewOffset;\r\n\r\n for (var i = 0; i < cm.options.gutters.length; ++i) {\r\n var g = display.gutters.childNodes[i];\r\n if (g && g.getBoundingClientRect().right >= mX) {\r\n var line = lineAtHeight(cm.doc, mY);\r\n var gutter = cm.options.gutters[i];\r\n signalfn(cm, type, cm, line, gutter, e);\r\n return e_defaultPrevented(e);\r\n }\r\n }\r\n }", "function gutterEvent(cm, e, type, prevent) {\n\t\t try { var mX = e.clientX, mY = e.clientY; }\n\t\t catch(e) { return false; }\n\t\t if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n\t\t if (prevent) e_preventDefault(e);\n\t\t\n\t\t var display = cm.display;\n\t\t var lineBox = display.lineDiv.getBoundingClientRect();\n\t\t\n\t\t if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\n\t\t mY -= lineBox.top - display.viewOffset;\n\t\t\n\t\t for (var i = 0; i < cm.options.gutters.length; ++i) {\n\t\t var g = display.gutters.childNodes[i];\n\t\t if (g && g.getBoundingClientRect().right >= mX) {\n\t\t var line = lineAtHeight(cm.doc, mY);\n\t\t var gutter = cm.options.gutters[i];\n\t\t signal(cm, type, cm, line, gutter, e);\n\t\t return e_defaultPrevented(e);\n\t\t }\n\t\t }\n\t\t }", "function gutterEvent(cm, e, type, prevent) {\n\t\t var mX, mY;\n\t\t if (e.touches) {\n\t\t mX = e.touches[0].clientX;\n\t\t mY = e.touches[0].clientY;\n\t\t } else {\n\t\t try { mX = e.clientX; mY = e.clientY; }\n\t\t catch(e$1) { return false }\n\t\t }\n\t\t if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n\t\t if (prevent) { e_preventDefault(e); }\n\n\t\t var display = cm.display;\n\t\t var lineBox = display.lineDiv.getBoundingClientRect();\n\n\t\t if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n\t\t mY -= lineBox.top - display.viewOffset;\n\n\t\t for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n\t\t var g = display.gutters.childNodes[i];\n\t\t if (g && g.getBoundingClientRect().right >= mX) {\n\t\t var line = lineAtHeight(cm.doc, mY);\n\t\t var gutter = cm.display.gutterSpecs[i];\n\t\t signal(cm, type, cm, line, gutter.className, e);\n\t\t return e_defaultPrevented(e)\n\t\t }\n\t\t }\n\t\t }", "function gutterEvent(cm, e, type, prevent) {\n\t try { var mX = e.clientX, mY = e.clientY; }\n\t catch(e) { return false; }\n\t if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n\t if (prevent) e_preventDefault(e);\n\t\n\t var display = cm.display;\n\t var lineBox = display.lineDiv.getBoundingClientRect();\n\t\n\t if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\n\t mY -= lineBox.top - display.viewOffset;\n\t\n\t for (var i = 0; i < cm.options.gutters.length; ++i) {\n\t var g = display.gutters.childNodes[i];\n\t if (g && g.getBoundingClientRect().right >= mX) {\n\t var line = lineAtHeight(cm.doc, mY);\n\t var gutter = cm.options.gutters[i];\n\t signal(cm, type, cm, line, gutter, e);\n\t return e_defaultPrevented(e);\n\t }\n\t }\n\t }", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try {\n mX = e.clientX;\n mY = e.clientY;\n } catch (e) {\n return false;\n }\n }\n\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) {\n return false;\n }\n\n if (prevent) {\n e_preventDefault(e);\n }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) {\n return e_defaultPrevented(e);\n }\n\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = _lineAtHeight(cm.doc, mY);\n\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e);\n }\n }\n }", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e$1) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e$1) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e$1) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e$1) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e$1) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e$1) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e$1) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }", "function gutterEvent(cm, e, type, prevent) {\n\t try { var mX = e.clientX, mY = e.clientY; }\n\t catch(e) { return false; }\n\t if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n\t if (prevent) e_preventDefault(e);\n\n\t var display = cm.display;\n\t var lineBox = display.lineDiv.getBoundingClientRect();\n\n\t if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\n\t mY -= lineBox.top - display.viewOffset;\n\n\t for (var i = 0; i < cm.options.gutters.length; ++i) {\n\t var g = display.gutters.childNodes[i];\n\t if (g && g.getBoundingClientRect().right >= mX) {\n\t var line = lineAtHeight(cm.doc, mY);\n\t var gutter = cm.options.gutters[i];\n\t signal(cm, type, cm, line, gutter, e);\n\t return e_defaultPrevented(e);\n\t }\n\t }\n\t }", "function gutterEvent(cm, e, type, prevent) {\n\t try { var mX = e.clientX, mY = e.clientY; }\n\t catch(e) { return false; }\n\t if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n\t if (prevent) e_preventDefault(e);\n\n\t var display = cm.display;\n\t var lineBox = display.lineDiv.getBoundingClientRect();\n\n\t if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\n\t mY -= lineBox.top - display.viewOffset;\n\n\t for (var i = 0; i < cm.options.gutters.length; ++i) {\n\t var g = display.gutters.childNodes[i];\n\t if (g && g.getBoundingClientRect().right >= mX) {\n\t var line = lineAtHeight(cm.doc, mY);\n\t var gutter = cm.options.gutters[i];\n\t signal(cm, type, cm, line, gutter, e);\n\t return e_defaultPrevented(e);\n\t }\n\t }\n\t }", "function gutterEvent(cm, e, type, prevent) {\r\n var mX, mY;\r\n if (e.touches) {\r\n mX = e.touches[0].clientX;\r\n mY = e.touches[0].clientY;\r\n } else {\r\n try { mX = e.clientX; mY = e.clientY; }\r\n catch(e) { return false }\r\n }\r\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\r\n if (prevent) { e_preventDefault(e); }\r\n\r\n var display = cm.display;\r\n var lineBox = display.lineDiv.getBoundingClientRect();\r\n\r\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\r\n mY -= lineBox.top - display.viewOffset;\r\n\r\n for (var i = 0; i < cm.options.gutters.length; ++i) {\r\n var g = display.gutters.childNodes[i];\r\n if (g && g.getBoundingClientRect().right >= mX) {\r\n var line = lineAtHeight(cm.doc, mY);\r\n var gutter = cm.options.gutters[i];\r\n signal(cm, type, cm, line, gutter, e);\r\n return e_defaultPrevented(e)\r\n }\r\n }\r\n}", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e)\n }\n }\n}", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e)\n }\n }\n}", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e)\n }\n }\n}", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e)\n }\n }\n}", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e)\n }\n }\n}", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e)\n }\n }\n}", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e)\n }\n }\n}", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e)\n }\n }\n}", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e)\n }\n }\n}", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e)\n }\n }\n}", "function gutterEvent(cm, e, type, prevent) {\n try { var mX = e.clientX, mY = e.clientY; }\n catch(e) { return false; }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n if (prevent) e_preventDefault(e);\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e);\n }\n }\n }", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY\n try { mX = e.clientX; mY = e.clientY }\n catch(e) { return false }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e) }\n\n var display = cm.display\n var lineBox = display.lineDiv.getBoundingClientRect()\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i]\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY)\n var gutter = cm.options.gutters[i]\n signal(cm, type, cm, line, gutter, e)\n return e_defaultPrevented(e)\n }\n }\n}", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY\n try { mX = e.clientX; mY = e.clientY }\n catch(e) { return false }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e) }\n\n var display = cm.display\n var lineBox = display.lineDiv.getBoundingClientRect()\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i]\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY)\n var gutter = cm.options.gutters[i]\n signal(cm, type, cm, line, gutter, e)\n return e_defaultPrevented(e)\n }\n }\n}", "function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e)\n }\n }\n}", "function checkGutterEvents(cm, obj) {\n if (!Code.isScript(this_ref.file)) return\n blanke.cooldownFn(\"checkGutterEvents\", 1000, () => {\n let cur = cm.getCursor()\n let line_text = cm.getLine(cur.line)\n\n Object.values(this_ref.gutterEvents).forEach(v => {\n cm.clearGutter(v.name)\n })\n\n for (let txt in this_ref.gutterEvents) {\n let info = this_ref.gutterEvents[txt]\n if (line_text.match(new RegExp(txt))) {\n let el_gutter = blanke.createElement(\"div\", \"gutter-evt\")\n el_gutter.innerHTML = \"<i class='mdi mdi-flash'></i>\"\n if (info.tooltip) el_gutter.title = info.tooltip\n el_gutter.addEventListener(\"click\", function (e) {\n this_ref.gutterEvents[txt].fn(line_text, cm, cur)\n })\n cm.setGutterMarker(cur.line, info.name, el_gutter)\n }\n }\n })\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}", "function handler() {\n fired = true;\n }", "function checkForToggler() {\n var toggler = $(this).find('.menu-toggle');\n if (toggler.length) {\n determineMenuAction.call(toggler[0]);\n }\n }", "function isFired( _event )\n {\n if( !firedProgressEvents ) return false;\n return ( firedProgressEvents.indexOf( _event ) > -1 );\n }", "function checkGemTotal (cell){\n if (currentGems >= 3){\n cell.addEventListener('mousedown', hitAngrySlime)\n console.log('Angry slimes can now be hit!')\n } \n}", "function eventHandlersOnce() {\n\tif (globalDebug) {console.group(\"Event Handlers Once\");}\n\n\tmenuTrigger();\n\n\tif (globalDebug) {console.groupEnd();}\n}", "function isEventHandled(value){return value==='handled'||value===true;}", "guard(e, view) {\n // handled as `contextmenu` type\n if (e.type === 'mousedown' && e.button === 2) {\n return true;\n }\n if (this.options.guard && this.options.guard(e, view)) {\n return true;\n }\n if (e.data && e.data.guarded !== undefined) {\n return e.data.guarded;\n }\n if (view && view.cell && Cell.isCell(view.cell)) {\n return false;\n }\n if (this.svg === e.target ||\n this.container === e.target ||\n JQuery.contains(this.svg, e.target)) {\n return false;\n }\n return true;\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 }", "function triggerAndReturn( context, eventName, data ) {\n var event = $.Event( eventName )\n $( context ).trigger( event, data )\n return !event.isDefaultPrevented()\n }", "trigger(eventName) {\n if (this.events[eventName]) {\n for (let cb of this.events[eventName]) {\n cb();\n }\n }\n }", "function trigger() {\n GEvent.trigger.apply(this, arguments);\n }", "trigger (eventName) {\n if (this.events[eventName]) {\n for (let cb of this.events[eventName]) {\n cb();\n }\n }\n }", "function eventHandler(event) {\n var message = event.data.message;\n var handles = eventMessageDecoder(message);\n\n event.__system = (message.match(/__system/)) ? true : false;\n \n // if callback exists\n if ( handles instanceof Array ) {\n trigger(event, handles);\n }\n else {\n console.warn(\"I see no event handler callbacks for message=\"+event.data.message);\n }\n}", "canHandleEvent(target, type) {}", "_events() {\n var _this = this;\n this._pauseEvents();\n if(this.hasNested){\n this.$element.on('postequalized.zf.equalizer', this._bindHandler.onPostEqualizedBound);\n }else{\n this.$element.on('resizeme.zf.trigger', this._bindHandler.onResizeMeBound);\n\t this.$element.on('mutateme.zf.trigger', this._bindHandler.onResizeMeBound);\n }\n this.isOn = true;\n }", "trigger(eventName) {\n if (this.events[eventName]) {\n for (let cb of this.events[eventName]) {\n cb();\n }\n }\n }", "function triggerAndReturn(context, eventName, data) {\n var event = $.Event(eventName)\n $(context).trigger(event, data)\n return !event.isDefaultPrevented()\n }", "triggerMouseEvent(e) {\n // range check for col/row\n if (e.col < 0 || e.col >= this._bufferService.cols\n || e.row < 0 || e.row >= this._bufferService.rows) {\n return false;\n }\n // filter nonsense combinations of button + action\n if (e.button === 4 /* WHEEL */ && e.action === 32 /* MOVE */) {\n return false;\n }\n if (e.button === 3 /* NONE */ && e.action !== 32 /* MOVE */) {\n return false;\n }\n if (e.button !== 4 /* WHEEL */ && (e.action === 2 /* LEFT */ || e.action === 3 /* RIGHT */)) {\n return false;\n }\n // report 1-based coords\n e.col++;\n e.row++;\n // debounce move at grid level\n if (e.action === 32 /* MOVE */ && this._lastEvent && this._compareEvents(this._lastEvent, e)) {\n return false;\n }\n // apply protocol restrictions\n if (!this._protocols[this._activeProtocol].restrict(e)) {\n return false;\n }\n // encode report and send\n const report = this._encodings[this._activeEncoding](e);\n if (report) {\n // always send DEFAULT as binary data\n if (this._activeEncoding === 'DEFAULT') {\n this._coreService.triggerBinaryEvent(report);\n }\n else {\n this._coreService.triggerDataEvent(report, true);\n }\n }\n this._lastEvent = e;\n return true;\n }", "function triggerAndReturn(context, eventName, data) {\n var event = $.Event(eventName)\n $(context).trigger(event, data)\n return !event.isDefaultPrevented()\n }", "function triggerAndReturn(context, eventName, data) {\n var event = $.Event(eventName)\n $(context).trigger(event, data)\n return !event.isDefaultPrevented()\n }", "function triggerAndReturn(context, eventName, data) {\n var event = $.Event(eventName)\n $(context).trigger(event, data)\n return !event.isDefaultPrevented()\n }", "function triggerAndReturn(context, eventName, data) {\n var event = $.Event(eventName)\n $(context).trigger(event, data)\n return !event.isDefaultPrevented()\n }", "function triggerAndReturn(context, eventName, data) {\n var event = $.Event(eventName)\n $(context).trigger(event, data)\n return !event.isDefaultPrevented()\n }", "function triggerAndReturn(context, eventName, data) {\n var event = $.Event(eventName)\n $(context).trigger(event, data)\n return !event.isDefaultPrevented()\n }", "function triggerAndReturn(context, eventName, data) {\n var event = $.Event(eventName)\n $(context).trigger(event, data)\n return !event.isDefaultPrevented()\n }", "function triggerAndReturn(context, eventName, data) {\n var event = $.Event(eventName)\n $(context).trigger(event, data)\n return !event.isDefaultPrevented()\n }", "function triggerAndReturn(context, eventName, data) {\n var event = $.Event(eventName)\n $(context).trigger(event, data)\n return !event.isDefaultPrevented()\n }", "function triggerAndReturn(context, eventName, data) {\n var event = $.Event(eventName)\n $(context).trigger(event, data)\n return !event.isDefaultPrevented()\n }", "function triggerAndReturn(context, eventName, data) {\r\n var event = $.Event(eventName)\r\n $(context).trigger(event, data)\r\n return !event.isDefaultPrevented()\r\n }", "function trigger(eventName) {\n // Only if have subscribers\n if (typeof subscribers[eventName] !== 'undefined') {\n for(var i = 0, subsCount = subscribers[eventName].length; i < subsCount; i++) {\n subscribers[eventName][i].call(eventName);\n $.event.trigger(eventName);\n }\n console.info('[Event Dispatcher] Event \"' + eventName + '\" dispatched to ' + subscribers[eventName].length + ' function(s).');\n } else {\n console.info(\"[Event Dispatcher] No function subscribed for event '\" + eventName + \"' \");\n }\n }", "function triggerAndReturn(context, eventName, data) {\n\t var event = $.Event(eventName);\n\t $(context).trigger(event, data);\n\t return !event.isDefaultPrevented();\n\t }", "gutter_click(n_line) {\n\t\t\texecute_query_block(n_line);\n\t\t}", "function eventChecker() {\n if(isSubscribed)\n pubsubEvents();\n}", "_handleGridMouseDown(event) {\n return this._handleAllMouseEvents(event)\n }", "handleEvent(event) {\n if (this.isHidden || !this._editor) {\n return;\n }\n switch (event.type) {\n case 'keydown':\n this._evtKeydown(event);\n break;\n case 'mousedown':\n this._evtMousedown(event);\n break;\n case 'scroll':\n this._evtScroll(event);\n break;\n default:\n break;\n }\n }", "eventShouldTriggerStart(event) {\n let node = event.toElement;\n\n do {\n // look for dograin class\n if (node.classList.contains(\"dograin\")) {\n return true;\n }\n\n // climb up to parent\n node = node.parentNode;\n } while (node instanceof HTMLElement && node.parentNode);\n\n return false;\n }", "function triggerAndReturn(context, eventName, data) {\r\n var event = $.Event(eventName)\r\n $(context).trigger(event, data)\r\n return !event.isDefaultPrevented()\r\n }", "function triggerAndReturn(context, eventName, data) {\r\n var event = $.Event(eventName)\r\n $(context).trigger(event, data)\r\n return !event.isDefaultPrevented()\r\n }", "function triggerIfHandlers(that, handlerListName, event) {\n triggerIfHandlerList(that[handlerListName][event], event)\n triggerIfHandlerList(that[normalHandlerToAllHandlerProperty(handlerListName)], event)\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 }", "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 }" ]
[ "0.6424223", "0.6424223", "0.6424223", "0.6424223", "0.6424223", "0.6424223", "0.6424223", "0.64166504", "0.63820106", "0.63625795", "0.63530976", "0.63412756", "0.6337135", "0.6337135", "0.6337135", "0.6337135", "0.6337135", "0.6337135", "0.63256717", "0.63256717", "0.63256717", "0.63256717", "0.63256717", "0.63256717", "0.63256717", "0.6323345", "0.6323345", "0.6278888", "0.6268477", "0.6268477", "0.6268477", "0.6268477", "0.6268477", "0.6268477", "0.6268477", "0.6268477", "0.6268477", "0.6268477", "0.626386", "0.62407535", "0.62407535", "0.62198985", "0.6178525", "0.56961995", "0.53871757", "0.53642964", "0.5322903", "0.527217", "0.5243634", "0.52273685", "0.5155206", "0.5144487", "0.507153", "0.5023168", "0.5001319", "0.49971116", "0.49817607", "0.49747276", "0.49732718", "0.49703524", "0.4969908", "0.49582058", "0.49512067", "0.49512067", "0.49512067", "0.49512067", "0.49512067", "0.49512067", "0.49512067", "0.49512067", "0.49512067", "0.49512067", "0.49456906", "0.493152", "0.4929421", "0.49231797", "0.49130884", "0.49002337", "0.48944658", "0.4889943", "0.4885192", "0.4885192", "0.48849636", "0.48849505", "0.48849505", "0.48849505", "0.48849505", "0.48849505", "0.48849505", "0.48849505", "0.48849505", "0.48849505", "0.48849505", "0.48849505", "0.48849505", "0.48849505", "0.48849505" ]
0.6320734
29
CONTEXT MENU HANDLING To make the context menu work, we need to briefly unhide the textarea (making it as unobtrusive as possible) to let the rightclick take effect on it.
function onContextMenu(cm, e) { if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return } if (signalDOMEvent(cm, e, "contextmenu")) { return } if (!captureRightClick) { cm.display.input.onContextMenu(e); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rightClickHandler(ev, textarea, screenElement, selectionService, shouldSelectWord) {\n moveTextAreaUnderMouseCursor(ev, textarea, screenElement);\n if (shouldSelectWord) {\n selectionService.rightClickSelect(ev);\n }\n // Get textarea ready to copy from the context menu\n textarea.value = selectionService.selectionText;\n textarea.select();\n}", "handleContextMenu(event) {\n event.preventDefault();\n return false;\n }", "function ContextMenuClickHandler() {\n $(settings.menuSelector)\n .off('click')\n .on('click', function(e) {\n $(this).hide();\n\n var $invokedOn = $(this).data(\"invokedOn\");\n var $selectedMenu = $(e.target);\n\n settings.menuSelected.call($(this), $invokedOn, $selectedMenu);\n });\n\n }", "function deactivateContextMenu() {\n $('#canvas-contextmenu').removeClass('active');\n}", "function modifyEventContextMenu() {\n displayEventEditWindow();\n}", "function onHiddenContextMenuHandler () {\n myMenu_open = false; // This sidebar instance menu closed, do not interpret onClicked events anymore\n}", "function contextMenu(e){\r\n\tprintln(\"context\");\r\n\treturn false;\r\n}", "function nocontextmenu() {\n\t\t\t\ttry {\n\t\t\t\t\tevent.cancelBubble = true;\n\t\t\t\t\tevent.returnValue = false;\n\t\t\t\t\treturn false;\n\t\t\t\t} catch (err) {\n\t\t\t\t\tiLog(\"nocontextmenu\", err, Log.Type.Error);\n\t\t\t\t}\n\t\t\t}", "onAfterContextMenuShow() {\n const contextMenu = this.hot.getPlugin('contextMenu');\n const data = contextMenu.menu.hotMenu.getData();\n\n // find position of 'copy' option.\n arrayEach(data, (item, index) => {\n if (item.key === 'copy') {\n let zeroClipboardInstance = new ZeroClipboard(contextMenu.menu.hotMenu.getCell(index, 0));\n\n zeroClipboardInstance.off();\n zeroClipboardInstance.on('copy', (event) => {\n let clipboard = event.clipboardData;\n\n clipboard.setData('text/plain', this.getCopyValue());\n this.hot.getSettings().outsideClickDeselects = this.outsideClickDeselectsCache;\n });\n\n // hide copy/paste btn when error, edit by xp 2015.12.15\n zeroClipboardInstance.on('error', (function(){\n let $menuItems = $('.htContextMenu tbody tr');\n $($menuItems[0]).hide();\n $($menuItems[1]).hide();\n $('.htSeparator').first().hide();\n }));\n\n return false;\n }\n });\n }", "function contextMenu(e) {\n\t\t\tif (result.allowContextMenu) return true;\n\t\t\te.preventDefault();\n\t\t\treturn false;\n\t\t}", "function PopupOnContextMenu() { return false ; }", "function PopupOnContextMenu() { return false ; }", "function handleContextMenu(event) {\n\tconsole.log(\"Contextual Menu\");\n\tconsole.log( event.target.nodeName.toLowerCase() );\n\tif ( event.target.nodeName.toLowerCase() != \"a\" ) {\n\t\t//\tGet disabling to work and add on/off preference for this feature\n\t\t// safari.self.tab.dispatchMessage(\"disable\", true);\n\t\tsafari.self.tab.dispatchMessage(\"getLink\", document.URL);\n\t\tconsole.log(document.URL);\n\t} else {\n\t\tsafari.self.tab.dispatchMessage(\"getLink\", event.target.href);\n\t\tconsole.log(event.target.href);\t//\tFor debugging\n\t}\n}", "beforeContextMenuShow() {}", "beforeContextMenuShow() {}", "function qf(e,t){Pt(e.display,t)||jf(e,t)||Ne(e,t,\"contextmenu\")||e.display.input.onContextMenu(t)}", "function detachContextMenus() {\n $(\".graph .node\").unbind(\"contextmenu\"); \n }", "function onHiddenContextMenuHandler () {\r\n // Reset remembered bnId if any\r\n lastMenuBnId = undefined;\r\n}", "function detachContextMenus() {\n $('.graph .node').unbind('contextmenu');\n }", "function Document_OnContextMenu( e )\n{\n\tif ( !e.target._FCKShowContextMenu )\n\t\te.preventDefault() ;\n}", "contextMenu(x, y, _isLeftButton) {}", "function canvasContextMenuEv(event) {\n event.preventDefault(); // this.activeContextMenu();\n}", "function rightClickMenu(ctx) {\n window.rightClickCtx = ctx\n $(fitStrechBtn).text(\n window\n .references[ctx.target.id]\n .data.metadata.ratio === 'fit' ? \n 'Strech ratio' : 'Fit ratio'\n )\n\n $(contextMenu).css({\n 'top': `${ctx.pageY - 15}px`, \n 'left': `${ctx.pageX + 15}px`\n }).show();\n ctx.preventDefault();\n}", "function __onContextShowNormal() {\n if (self._contextTimer) {\n clearTimeout(self._contextTimer);\n }\n\n $(\".wcFrame\").contextMenu(false);\n self._contextTimer = setTimeout(function () {\n $(\".wcFrame\").contextMenu(true);\n self._contextTimer = null;\n }, 100);\n return true;\n }", "function contextmenu(event) {\n if (event.preventDefault != undefined)\n event.preventDefault();\n if (event.stopPropagation != undefined)\n event.stopPropagation();\n return false;\n }", "function contextmenu(event) {\n if (event.preventDefault != undefined)\n event.preventDefault();\n if (event.stopPropagation != undefined)\n event.stopPropagation();\n return false;\n }", "function ContextMenuEvent(ev) {\n\t// Ignore if the cursor isn't locked.\n\tif (!document.pointerLockElement) {\n\t\treturn;\n\t}\n\n\t// Ignore default handlers.\n\tev.preventDefault();\n\tev.stopPropagation();\n}", "function noContextMenuHandler(evt) {\n evt.preventDefault();\n }", "function onContextMenu(cm, e) {\n\t\t if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }\n\t\t if (signalDOMEvent(cm, e, \"contextmenu\")) { return }\n\t\t if (!captureRightClick) { cm.display.input.onContextMenu(e); }\n\t\t }", "function rightClick()\n{\n\ttry {\n\t\tvar e = window.event; \n\t\tif(e != null && e.button)\n\t\t{\n\t\t\tif( e.target.parentElement.className.indexOf('haas') == -1 && e.target.parentElement.parentElement.className.indexOf('haas') == -1)\n\t\t\t\ttoggleContextMenu(null);\n\t\t}\n\t} catch(ex) {}\n}", "function hide() {\n if (contextMenu != null) {\n contextMenu.hide();\n }\n}", "translateContextMenu() {\n if (this.contextMenuExtension && this.contextMenuExtension.translateContextMenu) {\n this.contextMenuExtension.translateContextMenu();\n }\n }", "function xcustom_onContextMenu(event) {\r\n console.log('there we are...');\r\n}", "function onContextMenu(e) {\n\tif (e.target && e.target.object && e.target.object instanceof Movable) {\n\t\te.preventDefault();\n\t}\n\tonMouseUp(e);\n}", "handleClickOnContext(evt) {\n if (evt.altKey) {\n // panning\n return;\n }\n // if (isMouseEventPlatformModifierKey(evt)) \n // ctrl(meta) + click: select trace\n this.remote.selectFirstTrace();\n document.getSelection().removeAllRanges();\n // else {\n // // click: show trace\n // this.remote.goToFirstTrace();\n // }\n }", "function lol(){\r\n\tvar cancellationEvent = document.addEventListener('contextmenu', event => event.preventDefault());\r\n}", "function hideContextMenu() {\n let contextMenu = document.getElementsByClassName(\"context-menu\")[0];\n contextMenu.style.display = \"none\";\n}", "internalShowContextMenu(event) {\n const me = this;\n\n if (me.disabled) {\n return;\n }\n\n const data = me.getDataFromEvent(event);\n\n if (me.shouldShowMenu(data)) {\n me.showContextMenu(data);\n }\n }", "function disableContextMenu() {\n document.addEventListener('contextmenu', e => e.preventDefault());\n}", "closeCtxMenu(state) {\n if (state.ctxMenu) {\n if (state.ctxMenu.off) state.ctxMenu.off()\n state.ctxMenu = null\n }\n }", "function onContextMenu_Item(event, mEdit, mCopy, callbackEvent, callbackWindow, jaloPk, webroot) {\r\n\tvar element = getMenuHTMLElement();\r\n\tshowCMSMenu( element, event);\r\n\taddItemLinks(element, mEdit, mCopy, callbackEvent, callbackWindow, jaloPk, webroot);\r\n\tevent.cancelBubble=true;\r\n\treturn false;\r\n}", "function onContextMenu(cm, e) {\r\n if (signalDOMEvent(cm, e, \"contextmenu\")) return;\r\n var display = cm.display;\r\n if (eventInWidget(display, e) || contextMenuInGutter(cm, e)) return;\r\n\r\n var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;\r\n if (!pos || presto) return; // Opera is difficult.\r\n\r\n // Reset the current text selection only if the click is done outside of the selection\r\n // and 'resetSelectionOnContextMenu' option is true.\r\n var reset = cm.options.resetSelectionOnContextMenu;\r\n if (reset && cm.doc.sel.contains(pos) == -1)\r\n operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);\r\n\r\n var oldCSS = display.input.style.cssText;\r\n display.inputDiv.style.position = \"absolute\";\r\n display.input.style.cssText = \"position: fixed; width: 30px; height: 30px; top: \" + (e.clientY - 5) +\r\n \"px; left: \" + (e.clientX - 5) + \"px; z-index: 1000; background: \" +\r\n (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") +\r\n \"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\r\n if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712)\r\n focusInput(cm);\r\n if (webkit) window.scrollTo(null, oldScrollY);\r\n resetInput(cm);\r\n // Adds \"Select all\" to context menu in FF\r\n if (!cm.somethingSelected()) display.input.value = display.prevInput = \" \";\r\n display.selForContextMenu = cm.doc.sel;\r\n clearTimeout(display.detectingSelectAll);\r\n\r\n // Select-all will be greyed out if there's nothing to select, so\r\n // this adds a zero-width space so that we can later check whether\r\n // it got selected.\r\n function prepareSelectAllHack() {\r\n if (display.input.selectionStart != null) {\r\n var selected = cm.somethingSelected();\r\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\r\n display.prevInput = selected ? \"\" : \"\\u200b\";\r\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\r\n // Re-set this, in case some other handler touched the\r\n // selection in the meantime.\r\n display.selForContextMenu = cm.doc.sel;\r\n }\r\n }\r\n function rehide() {\r\n display.inputDiv.style.position = \"relative\";\r\n display.input.style.cssText = oldCSS;\r\n if (ie && ie_version < 9) display.scrollbarV.scrollTop = display.scroller.scrollTop = scrollPos;\r\n slowPoll(cm);\r\n\r\n // Try to detect the user choosing select-all\r\n if (display.input.selectionStart != null) {\r\n if (!ie || (ie && ie_version < 9)) prepareSelectAllHack();\r\n var i = 0, poll = function() {\r\n if (display.selForContextMenu == cm.doc.sel && display.input.selectionStart == 0)\r\n operation(cm, commands.selectAll)(cm);\r\n else if (i++ < 10) display.detectingSelectAll = setTimeout(poll, 500);\r\n else resetInput(cm);\r\n };\r\n display.detectingSelectAll = setTimeout(poll, 200);\r\n }\r\n }\r\n\r\n if (ie && ie_version >= 9) prepareSelectAllHack();\r\n if (captureRightClick) {\r\n e_stop(e);\r\n var mouseup = function() {\r\n off(window, \"mouseup\", mouseup);\r\n setTimeout(rehide, 20);\r\n };\r\n on(window, \"mouseup\", mouseup);\r\n } else {\r\n setTimeout(rehide, 50);\r\n }\r\n }", "function context_menu(params,event) {\n\tel=document.getElementById(\"cm\");\n\to=event.srcElement;\n\tx=event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;\n\ty=event.clientY+document.documentElement.scrollTop+document.body.scrollTop;\n\tel.innerHTML='';\n\tfor (k in params) {\n\t//if params[k]=='space' then draw line (separator)\n\t\tif (params[k]=='space') { el.innerHTML+='<hr size=1>';\n\t//if menu item is disabled\n\t\t} else if (params[k][\"disabled\"]) { el.innerHTML+='<a class=\"cm_gray\" href=\"\" onclick=\"return false;\" title=\"'+params[k][\"title\"]+'\" onmouseover=\"window.status=this.title;return true;\" onmouseout=\"window.status=&quot;&quot; ;return true;\">&nbsp;&nbsp;&nbsp;&nbsp;'+params[k][\"value\"]+\"</a><br>\";\n\t//if current window is not opened in frame\n\t\t} else if (params[k][\"frame\"]==\"off\") { if (window.frameElement==\"[object HTMLFrameElement]\") { el.innerHTML+='<a class=\"cm_black\" href=\"\"'+\"onclick=\"+'window.open('+\"'\"+params[k][\"href\"]+\"','','statusbar,menubar,location'); return false;\"+'\" title=\"'+params[k][\"title\"]+'\" onmouseover=\"window.status=this.title;return true;\" onmouseout=\"window.status=&quot;&quot; ;return true;\">&nbsp;&nbsp;&nbsp;&nbsp;'+params[k][\"value\"]+\"</a><br>\";} else { el.innerHTML+='<a class=\"cm_black\" href=\"\"'+\"onclick=\"+'window.open('+\"'\"+params[k][\"href\"]+\"','','statusbar,menubar,location');return false;\"+'\" title=\"'+params[k][\"title\"]+'\" onmouseover=\"window.status=this.title;return true;\" onmouseout=\"window.status=&quot;&quot; ;return true;\">&nbsp;&nbsp;&nbsp;&nbsp;'+params[k][\"value\"]+\"</a><br>\";}\n\t//if current window must be opened in frame\n\t\t} else if (params[k][\"frame\"]==\"on\") { el.innerHTML+='<a class=\"cm_black\" href=\"\"'+'onclick='+\"parent\"+params[k][\"taget\"]+\".location.href='\"+params[k][\"href\"]+\"' return false;\"+' title=\"'+params[k][\"title\"]+'\" onmouseover=\"window.status=this.title;return true;\" onmouseout=\"window.status=&quot;&quot; ;return true;\">&nbsp;&nbsp;&nbsp;&nbsp;'+params[k][\"value\"]+\"</a><br>\";}\n\t}\n\tel.style.visibility=\"visible\";\n\tel.style.display=\"block\";\n\theight=el.scrollHeight-20;\n\tif (window.opera) height+=30;//stupid opera...\n\tif (event.clientY+height>document.body.clientHeight) { y-=height+14 } else { y-=2 }\n\tel.style.left=x+\"px\";\n\tel.style.top=y+\"px\";\n\tel.style.visibility=\"hidden\";\n\tel.style.display=\"none\";\n\tel.style.visibility=\"visible\";\n\tel.style.display=\"block\";\n\tevent.returnValue=false;\n}", "function contextListener() {\n document.addEventListener(\"contextmenu\", function (e) {\n console.log(e);\n //taskItemInContext = true; //clickInsideElement(e, articeContentClassName);\n e.preventDefault();\n \n \n if(e.target.tagName == \"IMG\")\n {\n selectedImg = e.target;\n if (window.getSelection)\n window.getSelection().removeAllRanges();\n else\n document.selection.empty();\n toggleMenuOn();\n positionMenu(e);\n }\n else if (selectedText() != \"\") {\n selectedImg = null;\n toggleMenuOn();\n positionMenu(e);\n }\n else\n {\n //taskItemInContext = null;\n toggleMenuOff();\n }\n });\n }", "function hide() {\n\t if (contextMenu != null) {\n\t contextMenu.hide();\n\t }\n\t}", "function hide() {\n\t if (contextMenu != null) {\n\t contextMenu.hide();\n\t }\n\t}", "function itinFromHere(){\n\tremoveContextualMenu()\n}", "function onContextMenu(cm, e) {\n if (signalDOMEvent(cm, e, \"contextmenu\")) return;\n var display = cm.display;\n if (eventInWidget(display, e) || contextMenuInGutter(cm, e)) return;\n\n var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;\n if (!pos || presto) return; // Opera is difficult.\n\n // Reset the current text selection only if the click is done outside of the selection\n // and 'resetSelectionOnContextMenu' option is true.\n var reset = cm.options.resetSelectionOnContextMenu;\n if (reset && cm.doc.sel.contains(pos) == -1)\n operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);\n\n var oldCSS = display.input.style.cssText;\n display.inputDiv.style.position = \"absolute\";\n display.input.style.cssText = \"position: fixed; width: 30px; height: 30px; top: \" + (e.clientY - 5) +\n \"px; left: \" + (e.clientX - 5) + \"px; z-index: 1000; background: \" +\n (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") +\n \"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n focusInput(cm);\n resetInput(cm);\n // Adds \"Select all\" to context menu in FF\n if (!cm.somethingSelected()) display.input.value = display.prevInput = \" \";\n display.selForContextMenu = cm.doc.sel;\n clearTimeout(display.detectingSelectAll);\n\n // Select-all will be greyed out if there's nothing to select, so\n // this adds a zero-width space so that we can later check whether\n // it got selected.\n function prepareSelectAllHack() {\n if (display.input.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\n display.prevInput = selected ? \"\" : \"\\u200b\";\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }\n function rehide() {\n display.inputDiv.style.position = \"relative\";\n display.input.style.cssText = oldCSS;\n if (ie && ie_version < 9) display.scrollbarV.scrollTop = display.scroller.scrollTop = scrollPos;\n slowPoll(cm);\n\n // Try to detect the user choosing select-all\n if (display.input.selectionStart != null) {\n if (!ie || (ie && ie_version < 9)) prepareSelectAllHack();\n var i = 0, poll = function() {\n if (display.selForContextMenu == cm.doc.sel && display.input.selectionStart == 0)\n operation(cm, commands.selectAll)(cm);\n else if (i++ < 10) display.detectingSelectAll = setTimeout(poll, 500);\n else resetInput(cm);\n };\n display.detectingSelectAll = setTimeout(poll, 200);\n }\n }\n\n if (ie && ie_version >= 9) prepareSelectAllHack();\n if (captureRightClick) {\n e_stop(e);\n var mouseup = function() {\n off(window, \"mouseup\", mouseup);\n setTimeout(rehide, 20);\n };\n on(window, \"mouseup\", mouseup);\n } else {\n setTimeout(rehide, 50);\n }\n }", "function onContextMenu(cm, e) {\n if (signalDOMEvent(cm, e, \"contextmenu\")) return;\n var display = cm.display;\n if (eventInWidget(display, e) || contextMenuInGutter(cm, e)) return;\n\n var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;\n if (!pos || presto) return; // Opera is difficult.\n\n // Reset the current text selection only if the click is done outside of the selection\n // and 'resetSelectionOnContextMenu' option is true.\n var reset = cm.options.resetSelectionOnContextMenu;\n if (reset && cm.doc.sel.contains(pos) == -1)\n operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);\n\n var oldCSS = display.input.style.cssText;\n display.inputDiv.style.position = \"absolute\";\n display.input.style.cssText = \"position: fixed; width: 30px; height: 30px; top: \" + (e.clientY - 5) +\n \"px; left: \" + (e.clientX - 5) + \"px; z-index: 1000; background: \" +\n (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") +\n \"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712)\n focusInput(cm);\n if (webkit) window.scrollTo(null, oldScrollY);\n resetInput(cm);\n // Adds \"Select all\" to context menu in FF\n if (!cm.somethingSelected()) display.input.value = display.prevInput = \" \";\n display.selForContextMenu = cm.doc.sel;\n clearTimeout(display.detectingSelectAll);\n\n // Select-all will be greyed out if there's nothing to select, so\n // this adds a zero-width space so that we can later check whether\n // it got selected.\n function prepareSelectAllHack() {\n if (display.input.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\n display.prevInput = selected ? \"\" : \"\\u200b\";\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }\n function rehide() {\n display.inputDiv.style.position = \"relative\";\n display.input.style.cssText = oldCSS;\n if (ie && ie_version < 9) display.scrollbarV.scrollTop = display.scroller.scrollTop = scrollPos;\n slowPoll(cm);\n\n // Try to detect the user choosing select-all\n if (display.input.selectionStart != null) {\n if (!ie || (ie && ie_version < 9)) prepareSelectAllHack();\n var i = 0, poll = function() {\n if (display.selForContextMenu == cm.doc.sel && display.input.selectionStart == 0)\n operation(cm, commands.selectAll)(cm);\n else if (i++ < 10) display.detectingSelectAll = setTimeout(poll, 500);\n else resetInput(cm);\n };\n display.detectingSelectAll = setTimeout(poll, 200);\n }\n }\n\n if (ie && ie_version >= 9) prepareSelectAllHack();\n if (captureRightClick) {\n e_stop(e);\n var mouseup = function() {\n off(window, \"mouseup\", mouseup);\n setTimeout(rehide, 20);\n };\n on(window, \"mouseup\", mouseup);\n } else {\n setTimeout(rehide, 50);\n }\n }", "function onContextMenu(cm, e) {\n if (signalDOMEvent(cm, e, \"contextmenu\")) return;\n var display = cm.display;\n if (eventInWidget(display, e) || contextMenuInGutter(cm, e)) return;\n\n var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;\n if (!pos || presto) return; // Opera is difficult.\n\n // Reset the current text selection only if the click is done outside of the selection\n // and 'resetSelectionOnContextMenu' option is true.\n var reset = cm.options.resetSelectionOnContextMenu;\n if (reset && cm.doc.sel.contains(pos) == -1)\n operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);\n\n var oldCSS = display.input.style.cssText;\n display.inputDiv.style.position = \"absolute\";\n display.input.style.cssText = \"position: fixed; width: 30px; height: 30px; top: \" + (e.clientY - 5) +\n \"px; left: \" + (e.clientX - 5) + \"px; z-index: 1000; background: \" +\n (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") +\n \"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712)\n focusInput(cm);\n if (webkit) window.scrollTo(null, oldScrollY);\n resetInput(cm);\n // Adds \"Select all\" to context menu in FF\n if (!cm.somethingSelected()) display.input.value = display.prevInput = \" \";\n display.selForContextMenu = cm.doc.sel;\n clearTimeout(display.detectingSelectAll);\n\n // Select-all will be greyed out if there's nothing to select, so\n // this adds a zero-width space so that we can later check whether\n // it got selected.\n function prepareSelectAllHack() {\n if (display.input.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\n display.prevInput = selected ? \"\" : \"\\u200b\";\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }\n function rehide() {\n display.inputDiv.style.position = \"relative\";\n display.input.style.cssText = oldCSS;\n if (ie && ie_version < 9) display.scrollbarV.scrollTop = display.scroller.scrollTop = scrollPos;\n slowPoll(cm);\n\n // Try to detect the user choosing select-all\n if (display.input.selectionStart != null) {\n if (!ie || (ie && ie_version < 9)) prepareSelectAllHack();\n var i = 0, poll = function() {\n if (display.selForContextMenu == cm.doc.sel && display.input.selectionStart == 0)\n operation(cm, commands.selectAll)(cm);\n else if (i++ < 10) display.detectingSelectAll = setTimeout(poll, 500);\n else resetInput(cm);\n };\n display.detectingSelectAll = setTimeout(poll, 200);\n }\n }\n\n if (ie && ie_version >= 9) prepareSelectAllHack();\n if (captureRightClick) {\n e_stop(e);\n var mouseup = function() {\n off(window, \"mouseup\", mouseup);\n setTimeout(rehide, 20);\n };\n on(window, \"mouseup\", mouseup);\n } else {\n setTimeout(rehide, 50);\n }\n }", "function removeContextMenu() {\n if (contextMenuId) {\n chrome.contextMenus.remove(contextMenuId);\n contextMenuId = null;\n }\n}", "function handleContextMenu(info, tab) {\n //store selected text\n selectedText = info.selectionText;\n //open new tab to create issue \n openMainPage(\"/new_issue\");\n}", "function itinToHere(){\n\tremoveContextualMenu()\n\n}", "function mymenu_popupshowing(event)\n{\n var element = event.target.triggerNode; // get the clicked object\n \n //var isTextArea = element instanceof HTMLTextAreaElement;\n if (!document.getElementById(\"mybrowser\").contentWindow.should_popupmenu(element)) {\n //alert(element);\n event.preventDefault(); // prevent the menu from appearing\n }\n}", "function onContextMenu(cm, e) {\n\t\t if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) return;\n\t\t if (signalDOMEvent(cm, e, \"contextmenu\")) return;\n\t\t cm.display.input.onContextMenu(e);\n\t\t }", "function onContextMenu(cm, e) {\n if (signalDOMEvent(cm, e, \"contextmenu\")) return;\n var display = cm.display;\n if (eventInWidget(display, e) || contextMenuInGutter(cm, e)) return;\n\n var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;\n if (!pos || presto) return; // Opera is difficult.\n\n // Reset the current text selection only if the click is done outside of the selection\n // and 'resetSelectionOnContextMenu' option is true.\n var reset = cm.options.resetSelectionOnContextMenu;\n if (reset && cm.doc.sel.contains(pos) == -1)\n operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);\n\n var oldCSS = display.input.style.cssText;\n display.inputDiv.style.position = \"absolute\";\n display.input.style.cssText = \"position: fixed; width: 30px; height: 30px; top: \" + (e.clientY - 5) +\n \"px; left: \" + (e.clientX - 5) + \"px; z-index: 1000; background: \" +\n (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") +\n \"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712)\n focusInput(cm);\n if (webkit) window.scrollTo(null, oldScrollY);\n resetInput(cm);\n // Adds \"Select all\" to context menu in FF\n if (!cm.somethingSelected()) display.input.value = display.prevInput = \" \";\n display.contextMenuPending = true;\n display.selForContextMenu = cm.doc.sel;\n clearTimeout(display.detectingSelectAll);\n\n // Select-all will be greyed out if there's nothing to select, so\n // this adds a zero-width space so that we can later check whether\n // it got selected.\n function prepareSelectAllHack() {\n if (display.input.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\n display.prevInput = selected ? \"\" : \"\\u200b\";\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }\n function rehide() {\n display.contextMenuPending = false;\n display.inputDiv.style.position = \"relative\";\n display.input.style.cssText = oldCSS;\n if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos);\n slowPoll(cm);\n\n // Try to detect the user choosing select-all\n if (display.input.selectionStart != null) {\n if (!ie || (ie && ie_version < 9)) prepareSelectAllHack();\n var i = 0, poll = function() {\n if (display.selForContextMenu == cm.doc.sel && display.input.selectionStart == 0)\n operation(cm, commands.selectAll)(cm);\n else if (i++ < 10) display.detectingSelectAll = setTimeout(poll, 500);\n else resetInput(cm);\n };\n display.detectingSelectAll = setTimeout(poll, 200);\n }\n }\n\n if (ie && ie_version >= 9) prepareSelectAllHack();\n if (captureRightClick) {\n e_stop(e);\n var mouseup = function() {\n off(window, \"mouseup\", mouseup);\n setTimeout(rehide, 20);\n };\n on(window, \"mouseup\", mouseup);\n } else {\n setTimeout(rehide, 50);\n }\n }", "function onContextMenu(cm, e) {\n if (signalDOMEvent(cm, e, \"contextmenu\")) return;\n var display = cm.display;\n if (eventInWidget(display, e) || contextMenuInGutter(cm, e)) return;\n\n var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;\n if (!pos || presto) return; // Opera is difficult.\n\n // Reset the current text selection only if the click is done outside of the selection\n // and 'resetSelectionOnContextMenu' option is true.\n var reset = cm.options.resetSelectionOnContextMenu;\n if (reset && cm.doc.sel.contains(pos) == -1)\n operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);\n\n var oldCSS = display.input.style.cssText;\n display.inputDiv.style.position = \"absolute\";\n display.input.style.cssText = \"position: fixed; width: 30px; height: 30px; top: \" + (e.clientY - 5) +\n \"px; left: \" + (e.clientX - 5) + \"px; z-index: 1000; background: \" +\n (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") +\n \"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712)\n focusInput(cm);\n if (webkit) window.scrollTo(null, oldScrollY);\n resetInput(cm);\n // Adds \"Select all\" to context menu in FF\n if (!cm.somethingSelected()) display.input.value = display.prevInput = \" \";\n display.contextMenuPending = true;\n display.selForContextMenu = cm.doc.sel;\n clearTimeout(display.detectingSelectAll);\n\n // Select-all will be greyed out if there's nothing to select, so\n // this adds a zero-width space so that we can later check whether\n // it got selected.\n function prepareSelectAllHack() {\n if (display.input.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\n display.prevInput = selected ? \"\" : \"\\u200b\";\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }\n function rehide() {\n display.contextMenuPending = false;\n display.inputDiv.style.position = \"relative\";\n display.input.style.cssText = oldCSS;\n if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos);\n slowPoll(cm);\n\n // Try to detect the user choosing select-all\n if (display.input.selectionStart != null) {\n if (!ie || (ie && ie_version < 9)) prepareSelectAllHack();\n var i = 0, poll = function() {\n if (display.selForContextMenu == cm.doc.sel && display.input.selectionStart == 0)\n operation(cm, commands.selectAll)(cm);\n else if (i++ < 10) display.detectingSelectAll = setTimeout(poll, 500);\n else resetInput(cm);\n };\n display.detectingSelectAll = setTimeout(poll, 200);\n }\n }\n\n if (ie && ie_version >= 9) prepareSelectAllHack();\n if (captureRightClick) {\n e_stop(e);\n var mouseup = function() {\n off(window, \"mouseup\", mouseup);\n setTimeout(rehide, 20);\n };\n on(window, \"mouseup\", mouseup);\n } else {\n setTimeout(rehide, 50);\n }\n }", "evtContextMenu(event) {\n this._contextMenuEvent = event;\n if (event.shiftKey) {\n return;\n }\n const opened = this.contextMenu.open(event);\n if (opened) {\n const items = this.contextMenu.menu.items;\n // If only the context menu information will be shown,\n // with no real commands, close the context menu and\n // allow the native one to open.\n if (items.length === 1 &&\n items[0].command === Private.CONTEXT_MENU_INFO) {\n this.contextMenu.menu.close();\n return;\n }\n // Stop propagation and allow the application context menu to show.\n event.preventDefault();\n event.stopPropagation();\n }\n }", "function noContextMenuHandler(e) {\n\t e.preventDefault();\n\t }", "function disableContextMenu() {\r\n\tvar user = getCurrenUserID(); // get the current user_id\r\n\tif (!user) {\r\n\t\t$(\"#vakata-contextmenu\").remove();\r\n\t\treturn;\r\n\t}\r\n}", "onRightClick() {\n const menuConfig = Menu.buildFromTemplate([\n {\n label: 'Quit',\n click: () => app.quit()\n }\n ]);\n this.popUpContextMenu(menuConfig);\n }", "function displayContextMenu(e,file,folder,isLin) {\n\n\tstopBrowserActions(e);\n\tshowFileContextMenu(e,file,folder,isLin);\n}", "testContextMenuKeyboard() {\n popup.attach(anchor, null, null, true);\n popup.hide();\n assertFalse(popup.isVisible());\n events.fireKeySequence(anchor, KeyCodes.SPACE);\n assertFalse(popup.isVisible());\n events.fireKeySequence(anchor, KeyCodes.ENTER);\n assertFalse(popup.isVisible());\n }", "contextMenu(e) {\n this._modifiers(e);\n this.status.button1 = false;\n this.status.button2 = true;\n this.handleMouseUp(e);\n this.handleClick(e);\n const focused = this._listeners.focused;\n const _wantsToStopTheEvent = [];\n const _contextMenuable = this._listeners.byEvent.contextMenu;\n this._filterViewIdToValidView(focused, _viewId => {\n return _contextMenuable.includes(_viewId);\n }).filter(_ctrl => {\n return this.isFunction(_ctrl.contextMenu);\n }).forEach(_ctrl => {\n if (_ctrl.contextMenu()) {\n _wantsToStopTheEvent.push(_ctrl.viewId);\n }\n });\n this.status.button2 = false;\n if (_wantsToStopTheEvent.length !== 0) {\n Event.stop(e);\n }\n }", "contextMenu(e) {\n this._modifiers(e);\n this.status.button1 = false;\n this.status.button2 = true;\n this.handleMouseUp(e);\n this.handleClick(e);\n const focused = this._listeners.focused;\n const _wantsToStopTheEvent = [];\n const _contextMenuable = this._listeners.byEvent.contextMenu;\n this._filterViewIdToValidView(focused, _viewId => {\n return _contextMenuable.includes(_viewId);\n }).filter(_ctrl => {\n return this.isFunction(_ctrl.contextMenu);\n }).forEach(_ctrl => {\n if (_ctrl.contextMenu()) {\n _wantsToStopTheEvent.push(_ctrl.viewId);\n }\n });\n this.status.button2 = false;\n if (_wantsToStopTheEvent.length !== 0) {\n Event.stop(e);\n }\n }", "function showUIActionContext(event) {\n if (!g_user.hasRole(\"ui_action_admin\"))\n return;\n var element = Event.element(event);\n if (element.tagName.toLowerCase() == \"span\")\n element = element.parentNode;\n var id = element.getAttribute(\"gsft_id\");\n var mcm = new GwtContextMenu('context_menu_action_' + id);\n mcm.clear();\n mcm.addURL(getMessage('Edit UI Action'), \"sys_ui_action.do?sys_id=\" + id, \"gsft_main\");\n contextShow(event, mcm.getID(), 500, 0, 0);\n Event.stop(event);\n}", "function onContextMenu(cm, e) {\n\t if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) return;\n\t if (signalDOMEvent(cm, e, \"contextmenu\")) return;\n\t cm.display.input.onContextMenu(e);\n\t }", "function onContextMenu(cm, e) {\n\t if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) return;\n\t if (signalDOMEvent(cm, e, \"contextmenu\")) return;\n\t cm.display.input.onContextMenu(e);\n\t }", "function onContextMenu(cm, e) {\n\t if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) return;\n\t if (signalDOMEvent(cm, e, \"contextmenu\")) return;\n\t cm.display.input.onContextMenu(e);\n\t }", "function onContextMenu(cm, e) {\n if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) {\n return;\n }\n\n if (signalDOMEvent(cm, e, \"contextmenu\")) {\n return;\n }\n\n if (!captureRightClick) {\n cm.display.input.onContextMenu(e);\n }\n }", "function listenContextMenu() {\n\n\tif (globalBrowser == \"ie\")\n\t\tdocument.attachEvent(\"onclick\", hideFileContextMenu);\n\telse\n\t\tdocument.addEventListener(\"click\", hideFileContextMenu, true);\n}", "function pressRightClick() { return false; }", "function onContextMenu(cm, e) {\n if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) return;\n cm.display.input.onContextMenu(e);\n }", "function initEditorContextMenuItems(aEvent)\n{\n var shouldShowEditPage = !gContextMenu.onImage && !gContextMenu.onLink && !gContextMenu.onTextInput && !gContextMenu.inDirList;\n gContextMenu.showItem( \"context-editpage\", shouldShowEditPage );\n\n var shouldShowEditLink = gContextMenu.onSaveableLink; \n gContextMenu.showItem( \"context-editlink\", shouldShowEditLink );\n\n // Hide the applications separator if there's no add-on apps present. \n gContextMenu.showItem(\"context-sep-apps\", gContextMenu.shouldShowSeparator(\"context-sep-apps\"));\n}", "function antiContextMenuHook() {\n\t// Note: Opera is not hookable.\n\tvar showAlert = function() { alert('All images are protected by Copyright. Do not use without permission.'); }\n\tvar mdClick = function(e) {\n\t\tif (!document.all) {\n\t\t\tif (e.button == 2 || e.button == 3)\n\t\t\t\tshowAlert();\n\t\t}\n\t\telse if (event && event.button == 2)\n\t\t\tshowAlert();\n\t}\n\tvar cmClick = function(e) {\n\t\tif (navigator.userAgent.toLowerCase().indexOf('khtml') > -1) {\n\t\t\t// Safari, Konquerer\n\t\t\tif (e.preventDefault)\n\t\t\t\te.preventDefault();\n\t\t\tshowAlert();\n\t\t}\n\t\tif (e.stopPropagation)\n\t\t\te.stopPropagation(); // Mozilla Firefox 2.0\n\t\treturn false; // IE 6.0 and 7.0\n\t}\n\tdocument.onmousedown = mdClick;\n\tdocument.oncontextmenu = cmClick;\n}", "function removeContextualMenu(){\n\t$(\".contextualMenu\").remove();\n\tcontextualMenuEvtPosition = null;\n}", "function contextmenu_callback(key, options) {\n\tvar module = overlay.win.document.navicell_module_name;\n\twindow.console.log(module + \" \" + overlay.clicked_node_ctxmenu);\n\t$.each(overlay.win.bubble_list, function() {\n\t\tthis.close();\n\t});\n\tif (key == \"center\") {\n\t\toverlay.win.map.setCenter(overlay.clicked_latlng_ctxmenu);\n\t\tnv_perform(\"nv_select_entity\", overlay.win, overlay.clicked_node_ctxmenu.user_id, \"select\", false, overlay.clicked_boundbox_ctxmenu);\n\t} else if (key == \"reaction_select\" || key == \"reaction_select_highlight\") {\n\t\toverlay.neighbour_of_box = overlay.clicked_center_box_ctxmenu;\n\t\tif (key == \"reaction_select_highlight\") {\n\t\t\tarray_push_all(overlay.highlight_boxes, overlay.RGN_highlight_boxes);\n\t\t}\n\t\tnavicell.mapdata.findJXTree(overlay.win, overlay.RGN_select_entities, true, 'subtree', {div: $(\"#result_tree_contents\", overlay.win.document).get(0), select_neighbours: true, result_title: ' '});\n\t\t$(\"#right_tabs\", window.document).tabs(\"option\", \"active\", 1);\n\t} else if (key == \"interact_select\" || key == \"interact_select_highlight\") {\n\t\toverlay.neighbour_of_box = overlay.clicked_center_box_ctxmenu;\n\t\tif (key == \"interact_select_highlight\") {\n\t\t\tarray_push_all(overlay.highlight_boxes, overlay.IE_highlight_boxes);\n\t\t}\n\t\tnavicell.mapdata.findJXTree(overlay.win, overlay.IE_select_entities2, true, 'subtree', {div: $(\"#result_tree_contents\", overlay.win.document).get(0), select_neighbours: true, result_title: ' '});\n\t\t$(\"#right_tabs\", window.document).tabs(\"option\", \"active\", 1);\n\t} else if (key == \"highlight\") {\n\t\tif (!is_selected_species_highlighted()) {\n\t\t\toverlay.highlight_boxes.push(overlay.clicked_center_box_ctxmenu);\n\t\t} else {\n\t\t\tvar boxes = [];\n\t\t\tfor (var idx in overlay.highlight_boxes) {\n\t\t\t\tvar box = overlay.highlight_boxes[idx];\n\t\t\t\tvar equals = true;\n\t\t\t\tfor (var nn = 0; nn < 4; ++nn) {\n\t\t\t\t\tif (box[nn] != overlay.clicked_center_box_ctxmenu[nn]) {\n\t\t\t\t\t\tequals = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!equals) {\n\t\t\t\t\tboxes.push(box);\n\t\t\t\t}\n\t\t\t}\n\t\t\toverlay.highlight_boxes = boxes;\n\t\t}\n\t}\n\toverlay.clicked_center_box = null;\n\toverlay.draw(module);\n}", "function showContextMenu(evt) {\n\t\t// If context menu element not exist - create it\n\t\tif (!context_menu_element) {\n\t\t\tinitContextMenu();\n\t\t}\n\n\t\thideTooltips();\n\t\t// Clear context menu\n\t\tcontext_menu_element.innerHTML = '';\n\n\t\t// Determine the type of element on context\n\t\tcontext_element = getElProp(evt);\n\t\tif (context_element.type == 2) {\n\t\t\thighlightFileItem(context_element.index);\n\t\t}\n\t\tbildContextMenu();\n\t\t// Show context menu with time out\n\t\t//setTimeout(function() {\n\t\tcontext_menu_element.style.display = 'block';\n\t\tfixMouseEventElementPosition(evt, context_menu_element, 0);\n\t\t//\t}, 20);\n\t\tcontext_menu_element.style.display = 'block';\n\t\tcancelEvent(evt);\n\t}", "onTextareaKeyDown(event) {\n const ENTER_KEY = 13\n const SHIFT_KEY = 16\n const CAPS_KEY = 20\n const LEFT_ARROW_KEY = 37\n const UP_ARROW_KEY = 38\n const RIGHT_ARROW_KEY = 39\n const DOWN_ARROW_KEY = 40\n const CMD_KEY = 91\n\n if (typeof window.getSelection != \"undefined\"\n && event.keyCode != SHIFT_KEY\n && event.keyCode != CAPS_KEY\n ) {\n const selection = window.getSelection()\n // Checks if a Mention is being altered (except arrow keys), if yes deletes it\n // TODO find a better way to auto-delete spans, instead of listing all keys\n if (selection.anchorNode.parentElement.localName == \"span\"\n && event.keyCode != LEFT_ARROW_KEY\n && event.keyCode != UP_ARROW_KEY\n && event.keyCode != RIGHT_ARROW_KEY\n && event.keyCode != DOWN_ARROW_KEY\n && event.keyCode != CMD_KEY) {\n this.removeMention(this.textareaElement, selection.anchorNode.parentElement)\n }\n if (event.keyCode == ENTER_KEY) {\n // TODO The first \"enter\" at the end of the comment won't return to the line, but then it is fine\n // document.execCommand('insertHTML', false, '<br><br>')\n event.preventDefault()\n this.enterAction()\n this.state.showUserList && this.showUserList(false)\n }\n }\n }", "function postContextMenuWork(data, textStatus, jqXHR, param) {\n\teditBulkInProgress = true;\n\tshowPreview();\n\teditBulkInProgress = false;\n}", "function onDocumentKeyDown(e) {\n var ctrlDown = e.ctrlKey || e.metaKey; // PC || Mac\n \n switch (e.keyCode) {\n case KEYS.F1:\n help.show();\n e.preventDefault();\n \n break;\n \n case KEYS.ESC:\n help.hide();\n if (state.isDraw) {\n state.isDraw = false;\n state.newArea.remove();\n state.areas.pop();\n app.removeAllEvents();\n } else if (state.appMode === 'editing') {\n state.selectedArea.redraw();\n app.removeAllEvents();\n }\n \n break;\n \n case KEYS.TOP:\n if (state.appMode === 'editing' && state.selectedArea) {\n state.selectedArea.setParams(\n state.selectedArea.dynamicEdit(state.selectedArea.move(0, -1))\n );\n e.preventDefault();\n }\n \n break;\n \n case KEYS.BOTTOM:\n if (state.appMode === 'editing' && state.selectedArea) {\n state.selectedArea.setParams(\n state.selectedArea.dynamicEdit(state.selectedArea.move(0, 1))\n );\n e.preventDefault();\n }\n break;\n \n case KEYS.LEFT: \n if (state.appMode === 'editing' && state.selectedArea) {\n state.selectedArea.setParams(\n state.selectedArea.dynamicEdit(state.selectedArea.move(-1, 0))\n );\n e.preventDefault();\n }\n \n break;\n \n case KEYS.RIGHT:\n if (state.appMode === 'editing' && state.selectedArea) {\n state.selectedArea.setParams(\n state.selectedArea.dynamicEdit(state.selectedArea.move(1, 0))\n );\n e.preventDefault();\n }\n \n break;\n \n case KEYS.DELETE:\n if (state.appMode === 'editing' && state.selectedArea) {\n app.removeObject(state.selectedArea);\n state.selectedArea = null;\n info.unload();\n }\n \n break;\n \n case KEYS.I:\n if (state.appMode === 'editing' && state.selectedArea) {\n var params = state.selectedArea.params,\n x = params.x || params.cx || params[0],\n y = params.y || params.cy || params[1];\n \n info.load(state.selectedArea, x + app.getOffset('x'), y + app.getOffset('y'));\n }\n \n break;\n \n case KEYS.S:\n app.saveInLocalStorage();\n \n break;\n \n case KEYS.C:\n if (state.appMode === 'editing' && state.selectedArea && ctrlDown) {\n var Constructor = AREAS_CONSTRUCTORS[area_params.type],\n area_params = state.selectedArea.toJSON();\n \n if (Constructor) {\n Constructor.createFromSaved(area_params);\n state.selectedArea.setParams(state.selectedArea.move(10, 10));\n state.selectedArea.redraw();\n }\n }\n \n break;\n }\n }", "function preventKeyUpEventIfMenuOpen(event) {\n if (event.which === 121 && event.shiftKey) {\n // Shift-F10\n if (getContextMenuNode().is(':visible')) {\n event.preventDefault();\n }\n }\n } // lazily get the Menu component in case it is inited after the ojContextMenu binding is applied to launcher.", "function Browser_CancelBubbleAndMenu(event)\n{\n\t//cancel bubble\n\tevent.cancelBubble = true;\n\t//destroy menus\n\tPopups_TriggerCloseAll();\n\t//if we have designer controller\n\tif (__DESIGNER_CONTROLLER)\n\t{\n\t\t//notify selection\n\t\tWI4_PlugIn_Generic_ForwardEvent(event);\n\t}\n\t//was this a right click? with a prevent default?\n\tif (event.type === __BROWSER_EVENT_MOUSERIGHT && event.preventDefault)\n\t{\n\t\t//trigger it\n\t\tevent.preventDefault();\n\t}\n}", "function showContextMenu()\n{\n chrome.contextMenus.removeAll(function()\n {\n if(typeof localStorage[\"shouldShowBlockElementMenu\"] == \"string\" && localStorage[\"shouldShowBlockElementMenu\"] == \"true\")\n {\n chrome.contextMenus.create({'title': chrome.i18n.getMessage('block_element'), 'contexts': ['image', 'video', 'audio'], 'onclick': function(info, tab)\n {\n if(info.srcUrl)\n chrome.tabs.sendRequest(tab.id, {reqtype: \"clickhide-new-filter\", filter: info.srcUrl});\n }});\n }\n });\n}" ]
[ "0.68555146", "0.6613691", "0.6610034", "0.65589243", "0.65370077", "0.65265536", "0.6479694", "0.64353794", "0.6356764", "0.63425994", "0.63180727", "0.63180727", "0.63047725", "0.62931454", "0.62931454", "0.62903816", "0.6225206", "0.6213413", "0.6207998", "0.61801744", "0.6176002", "0.6139556", "0.6125314", "0.61228883", "0.6109261", "0.6109261", "0.610196", "0.60871816", "0.60814196", "0.60779357", "0.60678065", "0.60008466", "0.5984584", "0.59701407", "0.5969556", "0.5952811", "0.5952249", "0.5940525", "0.5928829", "0.5928463", "0.58999807", "0.58956563", "0.58863425", "0.5878873", "0.58771586", "0.58771586", "0.58710784", "0.58580375", "0.58552986", "0.58552986", "0.585374", "0.5852118", "0.5832526", "0.58324677", "0.58304965", "0.5829673", "0.5829673", "0.5824408", "0.57931316", "0.5787511", "0.57852", "0.5775656", "0.576992", "0.57635224", "0.57635224", "0.57611954", "0.57541364", "0.57541364", "0.57541364", "0.5751135", "0.5733997", "0.57323885", "0.571879", "0.57141316", "0.5708105", "0.56916666", "0.5689899", "0.5660519", "0.5653423", "0.5635871", "0.5628874", "0.5628413", "0.5626023", "0.56229806" ]
0.5823754
70
A CodeMirror instance represents an editor. This is the object that user code is usually dealing with.
function CodeMirror(place, options) { var this$1 = this; if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) } this.options = options = options ? copyObj(options) : {}; // Determine effective options based on given values and defaults. copyObj(defaults, options, false); setGuttersForLineNumbers(options); var doc = options.value; if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); } else if (options.mode) { doc.modeOption = options.mode; } this.doc = doc; var input = new CodeMirror.inputStyles[options.inputStyle](this); var display = this.display = new Display(place, doc, input); display.wrapper.CodeMirror = this; updateGutters(this); themeChanged(this); if (options.lineWrapping) { this.display.wrapper.className += " CodeMirror-wrap"; } initScrollbars(this); this.state = { keyMaps: [], // stores maps added by addKeyMap overlays: [], // highlighting overlays, as added by addOverlay modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info overwrite: false, delayingBlurEvent: false, focused: false, suppressEdits: false, // used to disable editing during key handlers when in readOnly mode pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll selectingText: false, draggingText: false, highlight: new Delayed(), // stores highlight worker timeout keySeq: null, // Unfinished key sequence specialChars: null }; if (options.autofocus && !mobile) { display.input.focus(); } // Override magic textarea content restore that IE sometimes does // on our hidden textarea on reload if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); } registerEventHandlers(this); ensureGlobalHandlers(); startOperation(this); this.curOp.forceUpdate = true; attachDoc(this, doc); if ((options.autofocus && !mobile) || this.hasFocus()) { setTimeout(bind(onFocus, this), 20); } else { onBlur(this); } for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt)) { optionHandlers[opt](this$1, options[opt], Init); } } maybeUpdateLineNumberWidth(this); if (options.finishInit) { options.finishInit(this); } for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); } endOperation(this); // Suppress optimizelegibility in Webkit, since it breaks text // measuring on line wrapping boundaries. if (webkit && options.lineWrapping && getComputedStyle(display.lineDiv).textRendering == "optimizelegibility") { display.lineDiv.style.textRendering = "auto"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options || {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\n this.doc = doc;\n\n var display = this.display = new Display(place, doc);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) focusInput(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false, focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput\n draggingText: false,\n highlight: new Delayed() // stores highlight worker timeout\n };\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n var cm = this;\n runInOp(this, function() {\n cm.curOp.forceUpdate = true;\n attachDoc(cm, doc);\n\n if ((options.autofocus && !mobile) || activeElt() == display.input)\n setTimeout(bind(onFocus, cm), 20);\n else\n onBlur(cm);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](cm, options[opt], Init);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](cm);\n });\n }", "function CodeMirror(place, options) {\r\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\r\n\r\n this.options = options = options || {};\r\n // Determine effective options based on given values and defaults.\r\n copyObj(defaults, options, false);\r\n setGuttersForLineNumbers(options);\r\n\r\n var doc = options.value;\r\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\r\n this.doc = doc;\r\n\r\n var display = this.display = new Display(place, doc);\r\n display.wrapper.CodeMirror = this;\r\n updateGutters(this);\r\n themeChanged(this);\r\n if (options.lineWrapping)\r\n this.display.wrapper.className += \" CodeMirror-wrap\";\r\n if (options.autofocus && !mobile) focusInput(this);\r\n\r\n this.state = {\r\n keyMaps: [], // stores maps added by addKeyMap\r\n overlays: [], // highlighting overlays, as added by addOverlay\r\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\r\n overwrite: false, focused: false,\r\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\r\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput\r\n draggingText: false,\r\n highlight: new Delayed() // stores highlight worker timeout\r\n };\r\n\r\n // Override magic textarea content restore that IE sometimes does\r\n // on our hidden textarea on reload\r\n if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);\r\n\r\n registerEventHandlers(this);\r\n ensureGlobalHandlers();\r\n\r\n var cm = this;\r\n runInOp(this, function() {\r\n cm.curOp.forceUpdate = true;\r\n attachDoc(cm, doc);\r\n\r\n if ((options.autofocus && !mobile) || activeElt() == display.input)\r\n setTimeout(bind(onFocus, cm), 20);\r\n else\r\n onBlur(cm);\r\n\r\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\r\n optionHandlers[opt](cm, options[opt], Init);\r\n maybeUpdateLineNumberWidth(cm);\r\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](cm);\r\n });\r\n }", "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options || {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\n this.doc = doc;\n\n var display = this.display = new Display(place, doc);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) focusInput(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false, focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput\n draggingText: false,\n highlight: new Delayed() // stores highlight worker timeout\n };\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n var cm = this;\n runInOp(this, function() {\n cm.curOp.forceUpdate = true;\n attachDoc(cm, doc);\n\n if ((options.autofocus && !mobile) || activeElt() == display.input)\n setTimeout(bind(onFocus, cm), 20);\n else\n onBlur(cm);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](cm, options[opt], Init);\n maybeUpdateLineNumberWidth(cm);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](cm);\n });\n }", "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options || {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\n this.doc = doc;\n\n var display = this.display = new Display(place, doc);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) focusInput(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false, focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput\n draggingText: false,\n highlight: new Delayed() // stores highlight worker timeout\n };\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n var cm = this;\n runInOp(this, function() {\n cm.curOp.forceUpdate = true;\n attachDoc(cm, doc);\n\n if ((options.autofocus && !mobile) || activeElt() == display.input)\n setTimeout(bind(onFocus, cm), 20);\n else\n onBlur(cm);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](cm, options[opt], Init);\n maybeUpdateLineNumberWidth(cm);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](cm);\n });\n }", "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\n this.doc = doc;\n\n var display = this.display = new Display(place, doc);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) focusInput(this);\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false, focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null // Unfinished key sequence\n };\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || activeElt() == display.input)\n setTimeout(bind(onFocus, this), 20);\n else\n onBlur(this);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](this, options[opt], Init);\n maybeUpdateLineNumberWidth(this);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n display.lineDiv.style.textRendering = \"auto\";\n }", "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) display.input.focus();\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n var cm = this;\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || cm.hasFocus())\n setTimeout(bind(onFocus, this), 20);\n else\n onBlur(this);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](this, options[opt], Init);\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) options.finishInit(this);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n display.lineDiv.style.textRendering = \"auto\";\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) {\n return new CodeMirror(place, options);\n }\n\n this.options = options = options ? copyObj(options) : {}; // Determine effective options based on given values and defaults.\n\n copyObj(defaults, options, false);\n var doc = options.value;\n\n if (typeof doc == \"string\") {\n doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction);\n } else if (options.mode) {\n doc.modeOption = options.mode;\n }\n\n this.doc = doc;\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n\n if (options.lineWrapping) {\n this.display.wrapper.className += \" CodeMirror-wrap\";\n }\n\n initScrollbars(this);\n this.state = {\n keyMaps: [],\n // stores maps added by addKeyMap\n overlays: [],\n // highlighting overlays, as added by addOverlay\n modeGen: 0,\n // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false,\n // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1,\n cutIncoming: -1,\n // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(),\n // stores highlight worker timeout\n keySeq: null,\n // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) {\n display.input.focus();\n } // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n\n\n if (ie && ie_version < 11) {\n setTimeout(function () {\n return this$1.display.input.reset(true);\n }, 20);\n }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n _startOperation(this);\n\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if (options.autofocus && !mobile || this.hasFocus()) {\n setTimeout(bind(onFocus, this), 20);\n } else {\n onBlur(this);\n }\n\n for (var opt in optionHandlers) {\n if (optionHandlers.hasOwnProperty(opt)) {\n optionHandlers[opt](this, options[opt], Init);\n }\n }\n\n maybeUpdateLineNumberWidth(this);\n\n if (options.finishInit) {\n options.finishInit(this);\n }\n\n for (var i = 0; i < initHooks.length; ++i) {\n initHooks[i](this);\n }\n\n _endOperation(this); // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n\n\n if (webkit && options.lineWrapping && getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\") {\n display.lineDiv.style.textRendering = \"auto\";\n }\n } // The default configuration options.", "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\n this.doc = doc;\n\n var display = this.display = new Display(place, doc);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) focusInput(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false, focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null // Unfinished key sequence\n };\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || activeElt() == display.input)\n setTimeout(bind(onFocus, this), 20);\n else\n onBlur(this);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](this, options[opt], Init);\n maybeUpdateLineNumberWidth(this);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n endOperation(this);\n }", "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\n this.doc = doc;\n\n var display = this.display = new Display(place, doc);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) focusInput(this);\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false, focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null // Unfinished key sequence\n };\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || activeElt() == display.input)\n setTimeout(bind(onFocus, this), 20);\n else\n onBlur(this);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](this, options[opt], Init);\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) options.finishInit(this);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n display.lineDiv.style.textRendering = \"auto\";\n }", "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode, null, options.lineSeparator);\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) display.input.focus();\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n var cm = this;\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || cm.hasFocus())\n setTimeout(bind(onFocus, this), 20);\n else\n onBlur(this);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](this, options[opt], Init);\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) options.finishInit(this);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n display.lineDiv.style.textRendering = \"auto\";\n }", "function CodeMirror(place, options) {\n\t if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n\t this.options = options = options ? copyObj(options) : {};\n\t // Determine effective options based on given values and defaults.\n\t copyObj(defaults, options, false);\n\t setGuttersForLineNumbers(options);\n\n\t var doc = options.value;\n\t if (typeof doc == \"string\") doc = new Doc(doc, options.mode, null, options.lineSeparator);\n\t this.doc = doc;\n\n\t var input = new CodeMirror.inputStyles[options.inputStyle](this);\n\t var display = this.display = new Display(place, doc, input);\n\t display.wrapper.CodeMirror = this;\n\t updateGutters(this);\n\t themeChanged(this);\n\t if (options.lineWrapping)\n\t this.display.wrapper.className += \" CodeMirror-wrap\";\n\t if (options.autofocus && !mobile) display.input.focus();\n\t initScrollbars(this);\n\n\t this.state = {\n\t keyMaps: [], // stores maps added by addKeyMap\n\t overlays: [], // highlighting overlays, as added by addOverlay\n\t modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n\t overwrite: false,\n\t delayingBlurEvent: false,\n\t focused: false,\n\t suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n\t pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n\t selectingText: false,\n\t draggingText: false,\n\t highlight: new Delayed(), // stores highlight worker timeout\n\t keySeq: null, // Unfinished key sequence\n\t specialChars: null\n\t };\n\n\t var cm = this;\n\n\t // Override magic textarea content restore that IE sometimes does\n\t // on our hidden textarea on reload\n\t if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);\n\n\t registerEventHandlers(this);\n\t ensureGlobalHandlers();\n\n\t startOperation(this);\n\t this.curOp.forceUpdate = true;\n\t attachDoc(this, doc);\n\n\t if ((options.autofocus && !mobile) || cm.hasFocus())\n\t setTimeout(bind(onFocus, this), 20);\n\t else\n\t onBlur(this);\n\n\t for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n\t optionHandlers[opt](this, options[opt], Init);\n\t maybeUpdateLineNumberWidth(this);\n\t if (options.finishInit) options.finishInit(this);\n\t for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n\t endOperation(this);\n\t // Suppress optimizelegibility in Webkit, since it breaks text\n\t // measuring on line wrapping boundaries.\n\t if (webkit && options.lineWrapping &&\n\t getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n\t display.lineDiv.style.textRendering = \"auto\";\n\t }", "function CodeMirror(place, options) {\n\t if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n\t this.options = options = options ? copyObj(options) : {};\n\t // Determine effective options based on given values and defaults.\n\t copyObj(defaults, options, false);\n\t setGuttersForLineNumbers(options);\n\n\t var doc = options.value;\n\t if (typeof doc == \"string\") doc = new Doc(doc, options.mode, null, options.lineSeparator);\n\t this.doc = doc;\n\n\t var input = new CodeMirror.inputStyles[options.inputStyle](this);\n\t var display = this.display = new Display(place, doc, input);\n\t display.wrapper.CodeMirror = this;\n\t updateGutters(this);\n\t themeChanged(this);\n\t if (options.lineWrapping)\n\t this.display.wrapper.className += \" CodeMirror-wrap\";\n\t if (options.autofocus && !mobile) display.input.focus();\n\t initScrollbars(this);\n\n\t this.state = {\n\t keyMaps: [], // stores maps added by addKeyMap\n\t overlays: [], // highlighting overlays, as added by addOverlay\n\t modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n\t overwrite: false,\n\t delayingBlurEvent: false,\n\t focused: false,\n\t suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n\t pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n\t selectingText: false,\n\t draggingText: false,\n\t highlight: new Delayed(), // stores highlight worker timeout\n\t keySeq: null, // Unfinished key sequence\n\t specialChars: null\n\t };\n\n\t var cm = this;\n\n\t // Override magic textarea content restore that IE sometimes does\n\t // on our hidden textarea on reload\n\t if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);\n\n\t registerEventHandlers(this);\n\t ensureGlobalHandlers();\n\n\t startOperation(this);\n\t this.curOp.forceUpdate = true;\n\t attachDoc(this, doc);\n\n\t if ((options.autofocus && !mobile) || cm.hasFocus())\n\t setTimeout(bind(onFocus, this), 20);\n\t else\n\t onBlur(this);\n\n\t for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n\t optionHandlers[opt](this, options[opt], Init);\n\t maybeUpdateLineNumberWidth(this);\n\t if (options.finishInit) options.finishInit(this);\n\t for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n\t endOperation(this);\n\t // Suppress optimizelegibility in Webkit, since it breaks text\n\t // measuring on line wrapping boundaries.\n\t if (webkit && options.lineWrapping &&\n\t getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n\t display.lineDiv.style.textRendering = \"auto\";\n\t }", "function CodeMirror(place, options) {\n\t\t if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\t\t\n\t\t this.options = options = options ? copyObj(options) : {};\n\t\t // Determine effective options based on given values and defaults.\n\t\t copyObj(defaults, options, false);\n\t\t setGuttersForLineNumbers(options);\n\t\t\n\t\t var doc = options.value;\n\t\t if (typeof doc == \"string\") doc = new Doc(doc, options.mode, null, options.lineSeparator);\n\t\t this.doc = doc;\n\t\t\n\t\t var input = new CodeMirror.inputStyles[options.inputStyle](this);\n\t\t var display = this.display = new Display(place, doc, input);\n\t\t display.wrapper.CodeMirror = this;\n\t\t updateGutters(this);\n\t\t themeChanged(this);\n\t\t if (options.lineWrapping)\n\t\t this.display.wrapper.className += \" CodeMirror-wrap\";\n\t\t if (options.autofocus && !mobile) display.input.focus();\n\t\t initScrollbars(this);\n\t\t\n\t\t this.state = {\n\t\t keyMaps: [], // stores maps added by addKeyMap\n\t\t overlays: [], // highlighting overlays, as added by addOverlay\n\t\t modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n\t\t overwrite: false,\n\t\t delayingBlurEvent: false,\n\t\t focused: false,\n\t\t suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n\t\t pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n\t\t selectingText: false,\n\t\t draggingText: false,\n\t\t highlight: new Delayed(), // stores highlight worker timeout\n\t\t keySeq: null, // Unfinished key sequence\n\t\t specialChars: null\n\t\t };\n\t\t\n\t\t var cm = this;\n\t\t\n\t\t // Override magic textarea content restore that IE sometimes does\n\t\t // on our hidden textarea on reload\n\t\t if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);\n\t\t\n\t\t registerEventHandlers(this);\n\t\t ensureGlobalHandlers();\n\t\t\n\t\t startOperation(this);\n\t\t this.curOp.forceUpdate = true;\n\t\t attachDoc(this, doc);\n\t\t\n\t\t if ((options.autofocus && !mobile) || cm.hasFocus())\n\t\t setTimeout(bind(onFocus, this), 20);\n\t\t else\n\t\t onBlur(this);\n\t\t\n\t\t for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n\t\t optionHandlers[opt](this, options[opt], Init);\n\t\t maybeUpdateLineNumberWidth(this);\n\t\t if (options.finishInit) options.finishInit(this);\n\t\t for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n\t\t endOperation(this);\n\t\t // Suppress optimizelegibility in Webkit, since it breaks text\n\t\t // measuring on line wrapping boundaries.\n\t\t if (webkit && options.lineWrapping &&\n\t\t getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n\t\t display.lineDiv.style.textRendering = \"auto\";\n\t\t }", "function CodeMirror(place, options) {\n\t\t var this$1$1 = this;\n\n\t\t if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n\t\t this.options = options = options ? copyObj(options) : {};\n\t\t // Determine effective options based on given values and defaults.\n\t\t copyObj(defaults, options, false);\n\n\t\t var doc = options.value;\n\t\t if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n\t\t else if (options.mode) { doc.modeOption = options.mode; }\n\t\t this.doc = doc;\n\n\t\t var input = new CodeMirror.inputStyles[options.inputStyle](this);\n\t\t var display = this.display = new Display(place, doc, input, options);\n\t\t display.wrapper.CodeMirror = this;\n\t\t themeChanged(this);\n\t\t if (options.lineWrapping)\n\t\t { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n\t\t initScrollbars(this);\n\n\t\t this.state = {\n\t\t keyMaps: [], // stores maps added by addKeyMap\n\t\t overlays: [], // highlighting overlays, as added by addOverlay\n\t\t modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n\t\t overwrite: false,\n\t\t delayingBlurEvent: false,\n\t\t focused: false,\n\t\t suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n\t\t pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n\t\t selectingText: false,\n\t\t draggingText: false,\n\t\t highlight: new Delayed(), // stores highlight worker timeout\n\t\t keySeq: null, // Unfinished key sequence\n\t\t specialChars: null\n\t\t };\n\n\t\t if (options.autofocus && !mobile) { display.input.focus(); }\n\n\t\t // Override magic textarea content restore that IE sometimes does\n\t\t // on our hidden textarea on reload\n\t\t if (ie && ie_version < 11) { setTimeout(function () { return this$1$1.display.input.reset(true); }, 20); }\n\n\t\t registerEventHandlers(this);\n\t\t ensureGlobalHandlers();\n\n\t\t startOperation(this);\n\t\t this.curOp.forceUpdate = true;\n\t\t attachDoc(this, doc);\n\n\t\t if ((options.autofocus && !mobile) || this.hasFocus())\n\t\t { setTimeout(function () {\n\t\t if (this$1$1.hasFocus() && !this$1$1.state.focused) { onFocus(this$1$1); }\n\t\t }, 20); }\n\t\t else\n\t\t { onBlur(this); }\n\n\t\t for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n\t\t { optionHandlers[opt](this, options[opt], Init); } }\n\t\t maybeUpdateLineNumberWidth(this);\n\t\t if (options.finishInit) { options.finishInit(this); }\n\t\t for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n\t\t endOperation(this);\n\t\t // Suppress optimizelegibility in Webkit, since it breaks text\n\t\t // measuring on line wrapping boundaries.\n\t\t if (webkit && options.lineWrapping &&\n\t\t getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n\t\t { display.lineDiv.style.textRendering = \"auto\"; }\n\t\t }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n\t if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\t\n\t this.options = options = options ? copyObj(options) : {};\n\t // Determine effective options based on given values and defaults.\n\t copyObj(defaults, options, false);\n\t setGuttersForLineNumbers(options);\n\t\n\t var doc = options.value;\n\t if (typeof doc == \"string\") doc = new Doc(doc, options.mode, null, options.lineSeparator);\n\t this.doc = doc;\n\t\n\t var input = new CodeMirror.inputStyles[options.inputStyle](this);\n\t var display = this.display = new Display(place, doc, input);\n\t display.wrapper.CodeMirror = this;\n\t updateGutters(this);\n\t themeChanged(this);\n\t if (options.lineWrapping)\n\t this.display.wrapper.className += \" CodeMirror-wrap\";\n\t if (options.autofocus && !mobile) display.input.focus();\n\t initScrollbars(this);\n\t\n\t this.state = {\n\t keyMaps: [], // stores maps added by addKeyMap\n\t overlays: [], // highlighting overlays, as added by addOverlay\n\t modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n\t overwrite: false,\n\t delayingBlurEvent: false,\n\t focused: false,\n\t suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n\t pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n\t selectingText: false,\n\t draggingText: false,\n\t highlight: new Delayed(), // stores highlight worker timeout\n\t keySeq: null, // Unfinished key sequence\n\t specialChars: null\n\t };\n\t\n\t var cm = this;\n\t\n\t // Override magic textarea content restore that IE sometimes does\n\t // on our hidden textarea on reload\n\t if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);\n\t\n\t registerEventHandlers(this);\n\t ensureGlobalHandlers();\n\t\n\t startOperation(this);\n\t this.curOp.forceUpdate = true;\n\t attachDoc(this, doc);\n\t\n\t if ((options.autofocus && !mobile) || cm.hasFocus())\n\t setTimeout(bind(onFocus, this), 20);\n\t else\n\t onBlur(this);\n\t\n\t for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n\t optionHandlers[opt](this, options[opt], Init);\n\t maybeUpdateLineNumberWidth(this);\n\t if (options.finishInit) options.finishInit(this);\n\t for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n\t endOperation(this);\n\t // Suppress optimizelegibility in Webkit, since it breaks text\n\t // measuring on line wrapping boundaries.\n\t if (webkit && options.lineWrapping &&\n\t getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n\t display.lineDiv.style.textRendering = \"auto\";\n\t }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {}\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false)\n setGuttersForLineNumbers(options)\n\n var doc = options.value\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator) }\n this.doc = doc\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this)\n var display = this.display = new Display(place, doc, input)\n display.wrapper.CodeMirror = this\n updateGutters(this)\n themeChanged(this)\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\" }\n initScrollbars(this)\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n }\n\n if (options.autofocus && !mobile) { display.input.focus() }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20) }\n\n registerEventHandlers(this)\n ensureGlobalHandlers()\n\n startOperation(this)\n this.curOp.forceUpdate = true\n attachDoc(this, doc)\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20) }\n else\n { onBlur(this) }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init) } }\n maybeUpdateLineNumberWidth(this)\n if (options.finishInit) { options.finishInit(this) }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1) }\n endOperation(this)\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\" }\n}", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {}\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false)\n setGuttersForLineNumbers(options)\n\n var doc = options.value\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction) }\n this.doc = doc\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this)\n var display = this.display = new Display(place, doc, input)\n display.wrapper.CodeMirror = this\n updateGutters(this)\n themeChanged(this)\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\" }\n initScrollbars(this)\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n }\n\n if (options.autofocus && !mobile) { display.input.focus() }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20) }\n\n registerEventHandlers(this)\n ensureGlobalHandlers()\n\n startOperation(this)\n this.curOp.forceUpdate = true\n attachDoc(this, doc)\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20) }\n else\n { onBlur(this) }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init) } }\n maybeUpdateLineNumberWidth(this)\n if (options.finishInit) { options.finishInit(this) }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1) }\n endOperation(this)\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\" }\n}", "function CodeMirror$1(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n}", "function CodeMirror$1(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n}", "function CodeMirror$1(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n}", "function CodeMirror$1(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n this.doc = doc;\n\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n}", "function CodeMirror$1(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n this.doc = doc;\n\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n}", "function CodeMirror$1(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n this.doc = doc;\n\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n}", "function CodeMirror$1(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n this.doc = doc;\n\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n}", "function CodeMirror$1(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n this.doc = doc;\n\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n}", "function CodeMirror$1(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n this.doc = doc;\n\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n}", "function CodeMirror$1(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n this.doc = doc;\n\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n}", "function CodeMirror$1(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n this.doc = doc;\n\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n}", "function CodeMirror$1(place, options) {\r\n var this$1 = this;\r\n\r\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\r\n\r\n this.options = options = options ? copyObj(options) : {};\r\n // Determine effective options based on given values and defaults.\r\n copyObj(defaults, options, false);\r\n setGuttersForLineNumbers(options);\r\n\r\n var doc = options.value;\r\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\r\n this.doc = doc;\r\n\r\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\r\n var display = this.display = new Display(place, doc, input);\r\n display.wrapper.CodeMirror = this;\r\n updateGutters(this);\r\n themeChanged(this);\r\n if (options.lineWrapping)\r\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\r\n initScrollbars(this);\r\n\r\n this.state = {\r\n keyMaps: [], // stores maps added by addKeyMap\r\n overlays: [], // highlighting overlays, as added by addOverlay\r\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\r\n overwrite: false,\r\n delayingBlurEvent: false,\r\n focused: false,\r\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\r\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\r\n selectingText: false,\r\n draggingText: false,\r\n highlight: new Delayed(), // stores highlight worker timeout\r\n keySeq: null, // Unfinished key sequence\r\n specialChars: null\r\n };\r\n\r\n if (options.autofocus && !mobile) { display.input.focus(); }\r\n\r\n // Override magic textarea content restore that IE sometimes does\r\n // on our hidden textarea on reload\r\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\r\n\r\n registerEventHandlers(this);\r\n ensureGlobalHandlers();\r\n\r\n startOperation(this);\r\n this.curOp.forceUpdate = true;\r\n attachDoc(this, doc);\r\n\r\n if ((options.autofocus && !mobile) || this.hasFocus())\r\n { setTimeout(bind(onFocus, this), 20); }\r\n else\r\n { onBlur(this); }\r\n\r\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\r\n { optionHandlers[opt](this$1, options[opt], Init); } }\r\n maybeUpdateLineNumberWidth(this);\r\n if (options.finishInit) { options.finishInit(this); }\r\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\r\n endOperation(this);\r\n // Suppress optimizelegibility in Webkit, since it breaks text\r\n // measuring on line wrapping boundaries.\r\n if (webkit && options.lineWrapping &&\r\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\r\n { display.lineDiv.style.textRendering = \"auto\"; }\r\n}", "function CodeMirror(place, givenOptions) {\n // Determine effective options based on given values and defaults.\n var options = {}, defaults = CodeMirror.defaults;\n for (var opt in defaults)\n if (defaults.hasOwnProperty(opt))\n options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];\n\n var targetDocument = options[\"document\"];\n // The element in which the editor lives.\n var wrapper = targetDocument.createElement(\"div\");\n wrapper.className = \"CodeMirror\" + (options.lineWrapping ? \" CodeMirror-wrap\" : \"\");\n // This mess creates the base DOM structure for the editor.\n wrapper.innerHTML =\n '<div style=\"overflow: hidden; position: relative; width: 3px; height: 0px;\">' + // Wraps and hides input textarea\n '<textarea style=\"position: absolute; padding: 0; width: 1px;\" wrap=\"off\" ' +\n 'autocorrect=\"off\" autocapitalize=\"off\"></textarea></div>' +\n '<div class=\"CodeMirror-scroll\" tabindex=\"-1\">' +\n '<div style=\"position: relative\">' + // Set to the height of the text, causes scrolling\n '<div style=\"position: relative\">' + // Moved around its parent to cover visible view\n '<div class=\"CodeMirror-gutter\"><div class=\"CodeMirror-gutter-text\"></div></div>' +\n // Provides positioning relative to (visible) text origin\n '<div class=\"CodeMirror-lines\"><div style=\"position: relative\">' +\n '<div style=\"position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden\"></div>' +\n '<pre class=\"CodeMirror-cursor\">&#160;</pre>' + // Absolutely positioned blinky cursor\n '<div></div>' + // This DIV contains the actual code\n '</div></div></div></div></div>';\n if (place.appendChild) place.appendChild(wrapper); else place(wrapper);\n // I've never seen more elegant code in my life.\n var inputDiv = wrapper.firstChild, input = inputDiv.firstChild,\n scroller = wrapper.lastChild, code = scroller.firstChild,\n mover = code.firstChild, gutter = mover.firstChild, gutterText = gutter.firstChild,\n lineSpace = gutter.nextSibling.firstChild, measure = lineSpace.firstChild,\n cursor = measure.nextSibling, lineDiv = cursor.nextSibling;\n themeChanged();\n // Needed to hide big blue blinking cursor on Mobile Safari\n if (/AppleWebKit/.test(navigator.userAgent) && /Mobile\\/\\w+/.test(navigator.userAgent)) input.style.width = \"0px\";\n if (!webkit) lineSpace.draggable = true;\n if (options.tabindex != null) input.tabIndex = options.tabindex;\n if (!options.gutter && !options.lineNumbers) gutter.style.display = \"none\";\n\n // Check for problem with IE innerHTML not working when we have a\n // P (or similar) parent node.\n try { stringWidth(\"x\"); }\n catch (e) {\n if (e.message.match(/runtime/i))\n e = new Error(\"A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)\");\n throw e;\n }\n\n // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.\n var poll = new Delayed(), highlight = new Delayed(), blinker;\n\n // mode holds a mode API object. doc is the tree of Line objects,\n // work an array of lines that should be parsed, and history the\n // undo history (instance of History constructor).\n var mode, doc = new BranchChunk([new LeafChunk([new Line(\"\")])]), work, focused;\n loadMode();\n // The selection. These are always maintained to point at valid\n // positions. Inverted is used to remember that the user is\n // selecting bottom-to-top.\n var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};\n // Selection-related flags. shiftSelecting obviously tracks\n // whether the user is holding shift.\n var shiftSelecting, lastClick, lastDoubleClick, draggingText, overwrite = false;\n // Variables used by startOperation/endOperation to track what\n // happened during the operation.\n var updateInput, userSelChange, changes, textChanged, selectionChanged, leaveInputAlone,\n gutterDirty, callbacks;\n // Current visible range (may be bigger than the view window).\n var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0;\n // bracketHighlighted is used to remember that a backet has been\n // marked.\n var bracketHighlighted;\n // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n var maxLine = \"\", maxWidth, tabText = computeTabText();\n\n // Initialize the content.\n operation(function(){setValue(options.value || \"\"); updateInput = false;})();\n var history = new History();\n\n // Register our event handlers.\n connect(scroller, \"mousedown\", operation(onMouseDown));\n connect(scroller, \"dblclick\", operation(onDoubleClick));\n connect(lineSpace, \"dragstart\", onDragStart);\n connect(lineSpace, \"selectstart\", e_preventDefault);\n // Gecko browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for Gecko.\n if (!gecko) connect(scroller, \"contextmenu\", onContextMenu);\n connect(scroller, \"scroll\", function() {\n updateDisplay([]);\n if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + \"px\";\n if (options.onScroll) options.onScroll(instance);\n });\n connect(window, \"resize\", function() {updateDisplay(true);});\n connect(input, \"keyup\", operation(onKeyUp));\n connect(input, \"input\", fastPoll);\n connect(input, \"keydown\", operation(onKeyDown));\n connect(input, \"keypress\", operation(onKeyPress));\n connect(input, \"focus\", onFocus);\n connect(input, \"blur\", onBlur);\n\n connect(scroller, \"dragenter\", e_stop);\n connect(scroller, \"dragover\", e_stop);\n connect(scroller, \"drop\", operation(onDrop));\n connect(scroller, \"paste\", function(){focusInput(); fastPoll();});\n connect(input, \"paste\", fastPoll);\n connect(input, \"cut\", operation(function(){replaceSelection(\"\");}));\n\n // IE throws unspecified error in certain cases, when\n // trying to access activeElement before onload\n var hasFocus; try { hasFocus = (targetDocument.activeElement == input); } catch(e) { }\n if (hasFocus) setTimeout(onFocus, 20);\n else onBlur();\n\n function isLine(l) {return l >= 0 && l < doc.size;}\n // The instance object that we'll return. Mostly calls out to\n // local functions in the CodeMirror function. Some do some extra\n // range checking and/or clipping. operation is used to wrap the\n // call so that changes it makes are tracked, and the display is\n // updated afterwards.\n var instance = wrapper.CodeMirror = {\n getValue: getValue,\n setValue: operation(setValue),\n getSelection: getSelection,\n replaceSelection: operation(replaceSelection),\n focus: function(){focusInput(); onFocus(); fastPoll();},\n setOption: function(option, value) {\n var oldVal = options[option];\n options[option] = value;\n if (option == \"mode\" || option == \"indentUnit\") loadMode();\n else if (option == \"readOnly\" && value) {onBlur(); input.blur();}\n else if (option == \"theme\") themeChanged();\n else if (option == \"lineWrapping\" && oldVal != value) operation(wrappingChanged)();\n else if (option == \"tabSize\") operation(tabsChanged)();\n if (option == \"lineNumbers\" || option == \"gutter\" || option == \"firstLineNumber\" || option == \"theme\")\n operation(gutterChanged)();\n },\n getOption: function(option) {return options[option];},\n undo: operation(undo),\n redo: operation(redo),\n indentLine: operation(function(n, dir) {\n if (isLine(n)) indentLine(n, dir == null ? \"smart\" : dir ? \"add\" : \"subtract\");\n }),\n indentSelection: operation(indentSelected),\n historySize: function() {return {undo: history.done.length, redo: history.undone.length};},\n clearHistory: function() {history = new History();},\n matchBrackets: operation(function(){matchBrackets(true);}),\n getTokenAt: operation(function(pos) {\n pos = clipPos(pos);\n return getLine(pos.line).getTokenAt(mode, getStateBefore(pos.line), pos.ch);\n }),\n getStateAfter: function(line) {\n line = clipLine(line == null ? doc.size - 1: line);\n return getStateBefore(line + 1);\n },\n cursorCoords: function(start){\n if (start == null) start = sel.inverted;\n return pageCoords(start ? sel.from : sel.to);\n },\n charCoords: function(pos){return pageCoords(clipPos(pos));},\n coordsChar: function(coords) {\n var off = eltOffset(lineSpace);\n return coordsChar(coords.x - off.left, coords.y - off.top);\n },\n markText: operation(markText),\n setBookmark: setBookmark,\n setMarker: operation(addGutterMarker),\n clearMarker: operation(removeGutterMarker),\n setLineClass: operation(setLineClass),\n hideLine: operation(function(h) {return setLineHidden(h, true);}),\n showLine: operation(function(h) {return setLineHidden(h, false);}),\n onDeleteLine: function(line, f) {\n if (typeof line == \"number\") {\n if (!isLine(line)) return null;\n line = getLine(line);\n }\n (line.handlers || (line.handlers = [])).push(f);\n return line;\n },\n lineInfo: lineInfo,\n addWidget: function(pos, node, scroll, vert, horiz) {\n pos = localCoords(clipPos(pos));\n var top = pos.yBot, left = pos.x;\n node.style.position = \"absolute\";\n code.appendChild(node);\n if (vert == \"over\") top = pos.y;\n else if (vert == \"near\") {\n var vspace = Math.max(scroller.offsetHeight, doc.height * textHeight()),\n hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft();\n if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)\n top = pos.y - node.offsetHeight;\n if (left + node.offsetWidth > hspace)\n left = hspace - node.offsetWidth;\n }\n node.style.top = (top + paddingTop()) + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = code.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") left = 0;\n else if (horiz == \"middle\") left = (code.clientWidth - node.offsetWidth) / 2;\n node.style.left = (left + paddingLeft()) + \"px\";\n }\n if (scroll)\n scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);\n },\n\n lineCount: function() {return doc.size;},\n clipPos: clipPos,\n getCursor: function(start) {\n if (start == null) start = sel.inverted;\n return copyPos(start ? sel.from : sel.to);\n },\n somethingSelected: function() {return !posEq(sel.from, sel.to);},\n setCursor: operation(function(line, ch, user) {\n if (ch == null && typeof line.line == \"number\") setCursor(line.line, line.ch, user);\n else setCursor(line, ch, user);\n }),\n setSelection: operation(function(from, to, user) {\n (user ? setSelectionUser : setSelection)(clipPos(from), clipPos(to || from));\n }),\n getLine: function(line) {if (isLine(line)) return getLine(line).text;},\n getLineHandle: function(line) {if (isLine(line)) return getLine(line);},\n setLine: operation(function(line, text) {\n if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: getLine(line).text.length});\n }),\n removeLine: operation(function(line) {\n if (isLine(line)) replaceRange(\"\", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));\n }),\n replaceRange: operation(replaceRange),\n getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},\n\n execCommand: function(cmd) {return commands[cmd](instance);},\n // Stuff used by commands, probably not much use to outside code.\n moveH: operation(moveH),\n deleteH: operation(deleteH),\n moveV: operation(moveV),\n toggleOverwrite: function() {overwrite = !overwrite;},\n\n posFromIndex: function(off) {\n var lineNo = 0, ch;\n doc.iter(0, doc.size, function(line) {\n var sz = line.text.length + 1;\n if (sz > off) { ch = off; return true; }\n off -= sz;\n ++lineNo;\n });\n return clipPos({line: lineNo, ch: ch});\n },\n indexFromPos: function (coords) {\n if (coords.line < 0 || coords.ch < 0) return 0;\n var index = coords.ch;\n doc.iter(0, coords.line, function (line) {\n index += line.text.length + 1;\n });\n return index;\n },\n\n operation: function(f){return operation(f)();},\n refresh: function(){updateDisplay(true);},\n getInputField: function(){return input;},\n getWrapperElement: function(){return wrapper;},\n getScrollerElement: function(){return scroller;},\n getGutterElement: function(){return gutter;}\n };\n\n function getLine(n) { return getLineAt(doc, n); }\n function updateLineHeight(line, height) {\n gutterDirty = true;\n var diff = height - line.height;\n for (var n = line; n; n = n.parent) n.height += diff;\n }\n\n function setValue(code) {\n var top = {line: 0, ch: 0};\n updateLines(top, {line: doc.size - 1, ch: getLine(doc.size-1).text.length},\n splitLines(code), top, top);\n updateInput = true;\n }\n function getValue(code) {\n var text = [];\n doc.iter(0, doc.size, function(line) { text.push(line.text); });\n return text.join(\"\\n\");\n }\n\n function onMouseDown(e) {\n setShift(e.shiftKey);\n // Check whether this is a click in a widget\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == code && n != mover) return;\n\n // See if this is a click in the gutter\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == gutterText) {\n if (options.onGutterClick)\n options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e);\n return e_preventDefault(e);\n }\n\n var start = posFromMouse(e);\n\n switch (e_button(e)) {\n case 3:\n if (gecko && !mac) onContextMenu(e);\n return;\n case 2:\n if (start) setCursor(start.line, start.ch, true);\n return;\n }\n // For button 1, if it was clicked inside the editor\n // (posFromMouse returning non-null), we have to adjust the\n // selection.\n if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}\n\n if (!focused) onFocus();\n\n var now = +new Date;\n if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {\n e_preventDefault(e);\n setTimeout(focusInput, 20);\n return selectLine(start.line);\n } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) {\n lastDoubleClick = {time: now, pos: start};\n e_preventDefault(e);\n return selectWordAt(start);\n } else { lastClick = {time: now, pos: start}; }\n\n var last = start, going;\n if (dragAndDrop && !posEq(sel.from, sel.to) &&\n !posLess(start, sel.from) && !posLess(sel.to, start)) {\n // Let the drag handler handle this.\n if (webkit) lineSpace.draggable = true;\n var up = connect(targetDocument, \"mouseup\", operation(function(e2) {\n if (webkit) lineSpace.draggable = false;\n draggingText = false;\n up();\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2);\n setCursor(start.line, start.ch, true);\n focusInput();\n }\n }), true);\n draggingText = true;\n return;\n }\n e_preventDefault(e);\n setCursor(start.line, start.ch, true);\n\n function extend(e) {\n var cur = posFromMouse(e, true);\n if (cur && !posEq(cur, last)) {\n if (!focused) onFocus();\n last = cur;\n setSelectionUser(start, cur);\n updateInput = false;\n var visible = visibleLines();\n if (cur.line >= visible.to || cur.line < visible.from)\n going = setTimeout(operation(function(){extend(e);}), 150);\n }\n }\n\n var move = connect(targetDocument, \"mousemove\", operation(function(e) {\n clearTimeout(going);\n e_preventDefault(e);\n extend(e);\n }), true);\n var up = connect(targetDocument, \"mouseup\", operation(function(e) {\n clearTimeout(going);\n var cur = posFromMouse(e);\n if (cur) setSelectionUser(start, cur);\n e_preventDefault(e);\n focusInput();\n updateInput = true;\n move(); up();\n }), true);\n }\n function onDoubleClick(e) {\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == gutterText) return e_preventDefault(e);\n var start = posFromMouse(e);\n if (!start) return;\n lastDoubleClick = {time: +new Date, pos: start};\n e_preventDefault(e);\n selectWordAt(start);\n }\n function onDrop(e) {\n e.preventDefault();\n var pos = posFromMouse(e, true), files = e.dataTransfer.files;\n if (!pos || options.readOnly) return;\n if (files && files.length && window.FileReader && window.File) {\n function loadFile(file, i) {\n var reader = new FileReader;\n reader.onload = function() {\n text[i] = reader.result;\n if (++read == n) {\n pos = clipPos(pos);\n operation(function() {\n var end = replaceRange(text.join(\"\"), pos, pos);\n setSelectionUser(pos, end);\n })();\n }\n };\n reader.readAsText(file);\n }\n var n = files.length, text = Array(n), read = 0;\n for (var i = 0; i < n; ++i) loadFile(files[i], i);\n }\n else {\n try {\n var text = e.dataTransfer.getData(\"Text\");\n if (text) {\n var end = replaceRange(text, pos, pos);\n var curFrom = sel.from, curTo = sel.to;\n setSelectionUser(pos, end);\n if (draggingText) replaceRange(\"\", curFrom, curTo);\n focusInput();\n }\n }\n catch(e){}\n }\n }\n function onDragStart(e) {\n var txt = getSelection();\n // This will reset escapeElement\n htmlEscape(txt);\n e.dataTransfer.setDragImage(escapeElement, 0, 0);\n e.dataTransfer.setData(\"Text\", txt);\n }\n function handleKeyBinding(e) {\n var name = keyNames[e.keyCode], next = keyMap[options.keyMap].auto, bound, dropShift;\n if (name == null || e.altGraphKey) {\n if (next) options.keyMap = next;\n return null;\n }\n if (e.altKey) name = \"Alt-\" + name;\n if (e.ctrlKey) name = \"Ctrl-\" + name;\n if (e.metaKey) name = \"Cmd-\" + name;\n if (e.shiftKey && (bound = lookupKey(\"Shift-\" + name, options.extraKeys, options.keyMap))) {\n dropShift = true;\n } else {\n bound = lookupKey(name, options.extraKeys, options.keyMap);\n }\n if (typeof bound == \"string\") {\n if (commands.propertyIsEnumerable(bound)) bound = commands[bound];\n else bound = null;\n }\n if (next && (bound || !isModifierKey(e))) options.keyMap = next;\n if (!bound) return false;\n if (dropShift) {\n var prevShift = shiftSelecting;\n shiftSelecting = null;\n bound(instance);\n shiftSelecting = prevShift;\n } else bound(instance);\n e_preventDefault(e);\n return true;\n }\n var lastStoppedKey = null;\n function onKeyDown(e) {\n if (!focused) onFocus();\n var code = e.keyCode;\n // IE does strange things with escape.\n if (ie && code == 27) { e.returnValue = false; }\n setShift(code == 16 || e.shiftKey);\n // First give onKeyEvent option a chance to handle this.\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n var handled = handleKeyBinding(e);\n if (window.opera) {\n lastStoppedKey = handled ? e.keyCode : null;\n // Opera has no cut event... we try to at least catch the key combo\n if (!handled && (mac ? e.metaKey : e.ctrlKey) && e.keyCode == 88)\n replaceSelection(\"\");\n }\n }\n function onKeyPress(e) {\n if (window.opera && e.keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n if (window.opera && !e.which && handleKeyBinding(e)) return;\n if (options.electricChars && mode.electricChars) {\n var ch = String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode);\n if (mode.electricChars.indexOf(ch) > -1)\n setTimeout(operation(function() {indentLine(sel.to.line, \"smart\");}), 75);\n }\n fastPoll();\n }\n function onKeyUp(e) {\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n if (e.keyCode == 16) shiftSelecting = null;\n }\n\n function onFocus() {\n if (options.readOnly) return;\n if (!focused) {\n if (options.onFocus) options.onFocus(instance);\n focused = true;\n if (wrapper.className.search(/\\bCodeMirror-focused\\b/) == -1)\n wrapper.className += \" CodeMirror-focused\";\n if (!leaveInputAlone) resetInput(true);\n }\n slowPoll();\n restartBlink();\n }\n function onBlur() {\n if (focused) {\n if (options.onBlur) options.onBlur(instance);\n focused = false;\n wrapper.className = wrapper.className.replace(\" CodeMirror-focused\", \"\");\n }\n clearInterval(blinker);\n setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);\n }\n\n // Replace the range from from to to by the strings in newText.\n // Afterwards, set the selection to selFrom, selTo.\n function updateLines(from, to, newText, selFrom, selTo) {\n if (history) {\n var old = [];\n doc.iter(from.line, to.line + 1, function(line) { old.push(line.text); });\n history.addChange(from.line, newText.length, old);\n while (history.done.length > options.undoDepth) history.done.shift();\n }\n updateLinesNoUndo(from, to, newText, selFrom, selTo);\n }\n function unredoHelper(from, to) {\n var change = from.pop();\n if (change) {\n var replaced = [], end = change.start + change.added;\n doc.iter(change.start, end, function(line) { replaced.push(line.text); });\n to.push({start: change.start, added: change.old.length, old: replaced});\n var pos = clipPos({line: change.start + change.old.length - 1,\n ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])});\n updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: getLine(end-1).text.length}, change.old, pos, pos);\n updateInput = true;\n }\n }\n function undo() {unredoHelper(history.done, history.undone);}\n function redo() {unredoHelper(history.undone, history.done);}\n\n function updateLinesNoUndo(from, to, newText, selFrom, selTo) {\n var recomputeMaxLength = false, maxLineLength = maxLine.length;\n if (!options.lineWrapping)\n doc.iter(from.line, to.line, function(line) {\n if (line.text.length == maxLineLength) {recomputeMaxLength = true; return true;}\n });\n if (from.line != to.line || newText.length > 1) gutterDirty = true;\n\n var nlines = to.line - from.line, firstLine = getLine(from.line), lastLine = getLine(to.line);\n // First adjust the line structure, taking some care to leave highlighting intact.\n if (from.ch == 0 && to.ch == 0 && newText[newText.length - 1] == \"\") {\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 = [], prevLine = null;\n if (from.line) {\n prevLine = getLine(from.line - 1);\n prevLine.fixMarkEnds(lastLine);\n } else lastLine.fixMarkStarts();\n for (var i = 0, e = newText.length - 1; i < e; ++i)\n added.push(Line.inheritMarks(newText[i], prevLine));\n if (nlines) doc.remove(from.line, nlines, callbacks);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (newText.length == 1)\n firstLine.replace(from.ch, to.ch, newText[0]);\n else {\n lastLine = firstLine.split(to.ch, newText[newText.length-1]);\n firstLine.replace(from.ch, null, newText[0]);\n firstLine.fixMarkEnds(lastLine);\n var added = [];\n for (var i = 1, e = newText.length - 1; i < e; ++i)\n added.push(Line.inheritMarks(newText[i], firstLine));\n added.push(lastLine);\n doc.insert(from.line + 1, added);\n }\n } else if (newText.length == 1) {\n firstLine.replace(from.ch, null, newText[0]);\n lastLine.replace(null, to.ch, \"\");\n firstLine.append(lastLine);\n doc.remove(from.line + 1, nlines, callbacks);\n } else {\n var added = [];\n firstLine.replace(from.ch, null, newText[0]);\n lastLine.replace(null, to.ch, newText[newText.length-1]);\n firstLine.fixMarkEnds(lastLine);\n for (var i = 1, e = newText.length - 1; i < e; ++i)\n added.push(Line.inheritMarks(newText[i], firstLine));\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1, callbacks);\n doc.insert(from.line + 1, added);\n }\n if (options.lineWrapping) {\n var perLine = scroller.clientWidth / charWidth() - 3;\n doc.iter(from.line, from.line + newText.length, function(line) {\n if (line.hidden) return;\n var guess = Math.ceil(line.text.length / perLine) || 1;\n if (guess != line.height) updateLineHeight(line, guess);\n });\n } else {\n doc.iter(from.line, i + newText.length, function(line) {\n var l = line.text;\n if (l.length > maxLineLength) {\n maxLine = l; maxLineLength = l.length; maxWidth = null;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) {\n maxLineLength = 0; maxLine = \"\"; maxWidth = null;\n doc.iter(0, doc.size, function(line) {\n var l = line.text;\n if (l.length > maxLineLength) {\n maxLineLength = l.length; maxLine = l;\n }\n });\n }\n }\n\n // Add these lines to the work array, so that they will be\n // highlighted. Adjust work lines if lines were added/removed.\n var newWork = [], lendiff = newText.length - nlines - 1;\n for (var i = 0, l = work.length; i < l; ++i) {\n var task = work[i];\n if (task < from.line) newWork.push(task);\n else if (task > to.line) newWork.push(task + lendiff);\n }\n var hlEnd = from.line + Math.min(newText.length, 500);\n highlightLines(from.line, hlEnd);\n newWork.push(hlEnd);\n work = newWork;\n startWorker(100);\n // Remember that these lines changed, for updating the display\n changes.push({from: from.line, to: to.line + 1, diff: lendiff});\n var changeObj = {from: from, to: to, text: newText};\n if (textChanged) {\n for (var cur = textChanged; cur.next; cur = cur.next) {}\n cur.next = changeObj;\n } else textChanged = changeObj;\n\n // Update the selection\n function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}\n setSelection(selFrom, selTo, updateLine(sel.from.line), updateLine(sel.to.line));\n\n // Make sure the scroll-size div has the correct height.\n code.style.height = (doc.height * textHeight() + 2 * paddingTop()) + \"px\";\n }\n\n function replaceRange(code, from, to) {\n from = clipPos(from);\n if (!to) to = from; else to = clipPos(to);\n code = splitLines(code);\n function adjustPos(pos) {\n if (posLess(pos, from)) return pos;\n if (!posLess(to, pos)) return end;\n var line = pos.line + code.length - (to.line - from.line) - 1;\n var ch = pos.ch;\n if (pos.line == to.line)\n ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));\n return {line: line, ch: ch};\n }\n var end;\n replaceRange1(code, from, to, function(end1) {\n end = end1;\n return {from: adjustPos(sel.from), to: adjustPos(sel.to)};\n });\n return end;\n }\n function replaceSelection(code, collapse) {\n replaceRange1(splitLines(code), sel.from, sel.to, function(end) {\n if (collapse == \"end\") return {from: end, to: end};\n else if (collapse == \"start\") return {from: sel.from, to: sel.from};\n else return {from: sel.from, to: end};\n });\n }\n function replaceRange1(code, from, to, computeSel) {\n var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;\n var newSel = computeSel({line: from.line + code.length - 1, ch: endch});\n updateLines(from, to, code, newSel.from, newSel.to);\n }\n\n function getRange(from, to) {\n var l1 = from.line, l2 = to.line;\n if (l1 == l2) return getLine(l1).text.slice(from.ch, to.ch);\n var code = [getLine(l1).text.slice(from.ch)];\n doc.iter(l1 + 1, l2, function(line) { code.push(line.text); });\n code.push(getLine(l2).text.slice(0, to.ch));\n return code.join(\"\\n\");\n }\n function getSelection() {\n return getRange(sel.from, sel.to);\n }\n\n var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll\n function slowPoll() {\n if (pollingFast) return;\n poll.set(options.pollInterval, function() {\n startOperation();\n readInput();\n if (focused) slowPoll();\n endOperation();\n });\n }\n function fastPoll() {\n var missed = false;\n pollingFast = true;\n function p() {\n startOperation();\n var changed = readInput();\n if (!changed && !missed) {missed = true; poll.set(60, p);}\n else {pollingFast = false; slowPoll();}\n endOperation();\n }\n poll.set(20, p);\n }\n\n // Previnput is a hack to work with IME. If we reset the textarea\n // on every change, that breaks IME. So we look for changes\n // compared to the previous content instead. (Modern browsers have\n // events that indicate IME taking place, but these are not widely\n // supported or compatible enough yet to rely on.)\n var prevInput = \"\";\n function readInput() {\n if (leaveInputAlone || !focused || hasSelection(input)) return false;\n var text = input.value;\n if (text == prevInput) return false;\n shiftSelecting = null;\n var same = 0, l = Math.min(prevInput.length, text.length);\n while (same < l && prevInput[same] == text[same]) ++same;\n if (same < prevInput.length)\n sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)};\n else if (overwrite && posEq(sel.from, sel.to))\n sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))};\n replaceSelection(text.slice(same), \"end\");\n prevInput = text;\n return true;\n }\n function resetInput(user) {\n if (!posEq(sel.from, sel.to)) {\n prevInput = \"\";\n input.value = getSelection();\n input.select();\n } else if (user) prevInput = input.value = \"\";\n }\n\n function focusInput() {\n if (!options.readOnly) input.focus();\n }\n\n function scrollEditorIntoView() {\n if (!cursor.getBoundingClientRect) return;\n var rect = cursor.getBoundingClientRect();\n // IE returns bogus coordinates when the instance sits inside of an iframe and the cursor is hidden\n if (ie && rect.top == rect.bottom) return;\n var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);\n if (rect.top < 0 || rect.bottom > winH) cursor.scrollIntoView();\n }\n function scrollCursorIntoView() {\n var cursor = localCoords(sel.inverted ? sel.from : sel.to);\n var x = options.lineWrapping ? Math.min(cursor.x, lineSpace.offsetWidth) : cursor.x;\n return scrollIntoView(x, cursor.y, x, cursor.yBot);\n }\n function scrollIntoView(x1, y1, x2, y2) {\n var pl = paddingLeft(), pt = paddingTop(), lh = textHeight();\n y1 += pt; y2 += pt; x1 += pl; x2 += pl;\n var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true;\n if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1 - 2*lh); scrolled = true;}\n else if (y2 > screentop + screen) {scroller.scrollTop = y2 + lh - screen; scrolled = true;}\n\n var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;\n var gutterw = options.fixedGutter ? gutter.clientWidth : 0;\n if (x1 < screenleft + gutterw) {\n if (x1 < 50) x1 = 0;\n scroller.scrollLeft = Math.max(0, x1 - 10 - gutterw);\n scrolled = true;\n }\n else if (x2 > screenw + screenleft - 3) {\n scroller.scrollLeft = x2 + 10 - screenw;\n scrolled = true;\n if (x2 > code.clientWidth) result = false;\n }\n if (scrolled && options.onScroll) options.onScroll(instance);\n return result;\n }\n\n function visibleLines() {\n var lh = textHeight(), top = scroller.scrollTop - paddingTop();\n var from_height = Math.max(0, Math.floor(top / lh));\n var to_height = Math.ceil((top + scroller.clientHeight) / lh);\n return {from: lineAtHeight(doc, from_height),\n to: lineAtHeight(doc, to_height)};\n }\n // Uses a set of changes plus the current scroll position to\n // determine which DOM updates have to be made, and makes the\n // updates.\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 }\n\n function computeIntact(intact, changes) {\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 && change.diff)\n intact2.push({from: range.from + diff, to: range.to + diff,\n domStart: range.domStart});\n else if (change.to <= range.from || change.from >= range.to)\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 return intact;\n }\n\n function patchDisplay(from, to, intact) {\n // The first pass removes the DOM nodes that aren't intact.\n if (!intact.length) lineDiv.innerHTML = \"\";\n else {\n function killNode(node) {\n var tmp = node.nextSibling;\n node.parentNode.removeChild(node);\n return tmp;\n }\n var domPos = 0, curNode = lineDiv.firstChild, n;\n for (var i = 0; i < intact.length; ++i) {\n var cur = intact[i];\n while (cur.domStart > domPos) {curNode = killNode(curNode); domPos++;}\n for (var j = 0, e = cur.to - cur.from; j < e; ++j) {curNode = curNode.nextSibling; domPos++;}\n }\n while (curNode) curNode = killNode(curNode);\n }\n // This pass fills in the lines that actually changed.\n var nextIntact = intact.shift(), curNode = lineDiv.firstChild, j = from;\n var sfrom = sel.from.line, sto = sel.to.line, inSel = sfrom < from && sto >= from;\n var scratch = targetDocument.createElement(\"div\"), newElt;\n doc.iter(from, to, function(line) {\n var ch1 = null, ch2 = null;\n if (inSel) {\n ch1 = 0;\n if (sto == j) {inSel = false; ch2 = sel.to.ch;}\n } else if (sfrom == j) {\n if (sto == j) {ch1 = sel.from.ch; ch2 = sel.to.ch;}\n else {inSel = true; ch1 = sel.from.ch;}\n }\n if (nextIntact && nextIntact.to == j) nextIntact = intact.shift();\n if (!nextIntact || nextIntact.from > j) {\n if (line.hidden) scratch.innerHTML = \"<pre></pre>\";\n else scratch.innerHTML = line.getHTML(ch1, ch2, true, tabText);\n lineDiv.insertBefore(scratch.firstChild, curNode);\n } else {\n curNode = curNode.nextSibling;\n }\n ++j;\n });\n }\n\n function updateGutter() {\n if (!options.gutter && !options.lineNumbers) return;\n var hText = mover.offsetHeight, hEditor = scroller.clientHeight;\n gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + \"px\";\n var html = [], i = showingFrom;\n doc.iter(showingFrom, Math.max(showingTo, showingFrom + 1), function(line) {\n if (line.hidden) {\n html.push(\"<pre></pre>\");\n } else {\n var marker = line.gutterMarker;\n var text = options.lineNumbers ? i + options.firstLineNumber : null;\n if (marker && marker.text)\n text = marker.text.replace(\"%N%\", text != null ? text : \"\");\n else if (text == null)\n text = \"\\u00a0\";\n html.push((marker && marker.style ? '<pre class=\"' + marker.style + '\">' : \"<pre>\"), text);\n for (var j = 1; j < line.height; ++j) html.push(\"<br/>&#160;\");\n html.push(\"</pre>\");\n }\n ++i;\n });\n gutter.style.display = \"none\";\n gutterText.innerHTML = html.join(\"\");\n var minwidth = String(doc.size).length, firstNode = gutterText.firstChild, val = eltText(firstNode), pad = \"\";\n while (val.length + pad.length < minwidth) pad += \"\\u00a0\";\n if (pad) firstNode.insertBefore(targetDocument.createTextNode(pad), firstNode.firstChild);\n gutter.style.display = \"\";\n lineSpace.style.marginLeft = gutter.offsetWidth + \"px\";\n gutterDirty = false;\n }\n function updateCursor() {\n var head = sel.inverted ? sel.from : sel.to, lh = textHeight();\n var pos = localCoords(head, true);\n var wrapOff = eltOffset(wrapper), lineOff = eltOffset(lineDiv);\n inputDiv.style.top = (pos.y + lineOff.top - wrapOff.top) + \"px\";\n inputDiv.style.left = (pos.x + lineOff.left - wrapOff.left) + \"px\";\n if (posEq(sel.from, sel.to)) {\n cursor.style.top = pos.y + \"px\";\n cursor.style.left = (options.lineWrapping ? Math.min(pos.x, lineSpace.offsetWidth) : pos.x) + \"px\";\n cursor.style.display = \"\";\n }\n else cursor.style.display = \"none\";\n }\n\n function setShift(val) {\n if (val) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);\n else shiftSelecting = null;\n }\n function setSelectionUser(from, to) {\n var sh = shiftSelecting && clipPos(shiftSelecting);\n if (sh) {\n if (posLess(sh, from)) from = sh;\n else if (posLess(to, sh)) to = sh;\n }\n setSelection(from, to);\n userSelChange = true;\n }\n // Update the selection. Last two args are only used by\n // updateLines, since they have to be expressed in the line\n // numbers before the update.\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 }\n function skipHidden(pos, oldLine, oldCh) {\n function getNonHidden(dir) {\n var lNo = pos.line + dir, end = dir == 1 ? doc.size : -1;\n while (lNo != end) {\n var line = getLine(lNo);\n if (!line.hidden) {\n var ch = pos.ch;\n if (ch > oldCh || ch > line.text.length) ch = line.text.length;\n return {line: lNo, ch: ch};\n }\n lNo += dir;\n }\n }\n var line = getLine(pos.line);\n if (!line.hidden) return pos;\n if (pos.line >= oldLine) return getNonHidden(1) || getNonHidden(-1);\n else return getNonHidden(-1) || getNonHidden(1);\n }\n function setCursor(line, ch, user) {\n var pos = clipPos({line: line, ch: ch || 0});\n (user ? setSelectionUser : setSelection)(pos, pos);\n }\n\n function clipLine(n) {return Math.max(0, Math.min(n, doc.size-1));}\n function clipPos(pos) {\n if (pos.line < 0) return {line: 0, ch: 0};\n if (pos.line >= doc.size) return {line: doc.size-1, ch: getLine(doc.size-1).text.length};\n var ch = pos.ch, linelen = getLine(pos.line).text.length;\n if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};\n else if (ch < 0) return {line: pos.line, ch: 0};\n else return pos;\n }\n\n function findPosH(dir, unit) {\n var end = sel.inverted ? sel.from : sel.to, line = end.line, ch = end.ch;\n var lineObj = getLine(line);\n function findNextLine() {\n for (var l = line + dir, e = dir < 0 ? -1 : doc.size; l != e; l += dir) {\n var lo = getLine(l);\n if (!lo.hidden) { line = l; lineObj = lo; return true; }\n }\n }\n function moveOnce(boundToLine) {\n if (ch == (dir < 0 ? 0 : lineObj.text.length)) {\n if (!boundToLine && findNextLine()) ch = dir < 0 ? lineObj.text.length : 0;\n else return false;\n } else ch += dir;\n return true;\n }\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\") {\n var sawWord = false;\n for (;;) {\n if (dir < 0) if (!moveOnce()) break;\n if (isWordChar(lineObj.text.charAt(ch))) sawWord = true;\n else if (sawWord) {if (dir < 0) {dir = 1; moveOnce();} break;}\n if (dir > 0) if (!moveOnce()) break;\n }\n }\n return {line: line, ch: ch};\n }\n function moveH(dir, unit) {\n var pos = dir < 0 ? sel.from : sel.to;\n if (shiftSelecting || posEq(sel.from, sel.to)) pos = findPosH(dir, unit);\n setCursor(pos.line, pos.ch, true);\n }\n function deleteH(dir, unit) {\n if (!posEq(sel.from, sel.to)) replaceRange(\"\", sel.from, sel.to);\n else if (dir < 0) replaceRange(\"\", findPosH(dir, unit), sel.to);\n else replaceRange(\"\", sel.from, findPosH(dir, unit));\n userSelChange = true;\n }\n var goalColumn = null;\n function moveV(dir, unit) {\n var dist = 0, pos = localCoords(sel.inverted ? sel.from : sel.to, true);\n if (goalColumn != null) pos.x = goalColumn;\n if (unit == \"page\") dist = scroller.clientHeight;\n else if (unit == \"line\") dist = textHeight();\n var target = coordsChar(pos.x, pos.y + dist * dir + 2);\n setCursor(target.line, target.ch, true);\n goalColumn = pos.x;\n }\n\n function selectWordAt(pos) {\n var line = getLine(pos.line).text;\n var start = pos.ch, end = pos.ch;\n while (start > 0 && isWordChar(line.charAt(start - 1))) --start;\n while (end < line.length && isWordChar(line.charAt(end))) ++end;\n setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end});\n }\n function selectLine(line) {\n setSelectionUser({line: line, ch: 0}, {line: line, ch: getLine(line).text.length});\n }\n function indentSelected(mode) {\n if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);\n var e = sel.to.line - (sel.to.ch ? 0 : 1);\n for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);\n }\n\n function indentLine(n, how) {\n if (!how) how = \"add\";\n if (how == \"smart\") {\n if (!mode.indent) how = \"prev\";\n else var state = getStateBefore(n);\n }\n\n var line = getLine(n), curSpace = line.indentation(options.tabSize),\n curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (how == \"prev\") {\n if (n) indentation = getLine(n-1).indentation(options.tabSize);\n else indentation = 0;\n }\n else if (how == \"smart\") indentation = mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n else if (how == \"add\") indentation = curSpace + options.indentUnit;\n else if (how == \"subtract\") indentation = curSpace - options.indentUnit;\n indentation = Math.max(0, indentation);\n var diff = indentation - curSpace;\n\n if (!diff) {\n if (sel.from.line != n && sel.to.line != n) return;\n var indentString = curSpaceString;\n }\n else {\n var indentString = \"\", pos = 0;\n if (options.indentWithTabs)\n for (var i = Math.floor(indentation / options.tabSize); i; --i) {pos += options.tabSize; indentString += \"\\t\";}\n while (pos < indentation) {++pos; indentString += \" \";}\n }\n\n replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});\n }\n\n function loadMode() {\n mode = CodeMirror.getMode(options, options.mode);\n doc.iter(0, doc.size, function(line) { line.stateAfter = null; });\n work = [0];\n startWorker();\n }\n function gutterChanged() {\n var visible = options.gutter || options.lineNumbers;\n gutter.style.display = visible ? \"\" : \"none\";\n if (visible) gutterDirty = true;\n else lineDiv.parentNode.style.marginLeft = 0;\n }\n function wrappingChanged(from, to) {\n if (options.lineWrapping) {\n wrapper.className += \" CodeMirror-wrap\";\n var perLine = scroller.clientWidth / charWidth() - 3;\n doc.iter(0, doc.size, function(line) {\n if (line.hidden) return;\n var guess = Math.ceil(line.text.length / perLine) || 1;\n if (guess != 1) updateLineHeight(line, guess);\n });\n lineSpace.style.width = code.style.width = \"\";\n } else {\n wrapper.className = wrapper.className.replace(\" CodeMirror-wrap\", \"\");\n maxWidth = null; maxLine = \"\";\n doc.iter(0, doc.size, function(line) {\n if (line.height != 1 && !line.hidden) updateLineHeight(line, 1);\n if (line.text.length > maxLine.length) maxLine = line.text;\n });\n }\n changes.push({from: 0, to: doc.size});\n }\n function computeTabText() {\n for (var str = '<span class=\"cm-tab\">', i = 0; i < options.tabSize; ++i) str += \" \";\n return str + \"</span>\";\n }\n function tabsChanged() {\n tabText = computeTabText();\n updateDisplay(true);\n }\n function themeChanged() {\n scroller.className = scroller.className.replace(/\\s*cm-s-\\w+/g, \"\") +\n options.theme.replace(/(^|\\s)\\s*/g, \" cm-s-\");\n }\n\n function TextMarker() { this.set = []; }\n TextMarker.prototype.clear = operation(function() {\n var min = Infinity, max = -Infinity;\n for (var i = 0, e = this.set.length; i < e; ++i) {\n var line = this.set[i], mk = line.marked;\n if (!mk || !line.parent) continue;\n var lineN = lineNo(line);\n min = Math.min(min, lineN); max = Math.max(max, lineN);\n for (var j = 0; j < mk.length; ++j)\n if (mk[j].set == this.set) mk.splice(j--, 1);\n }\n if (min != Infinity)\n changes.push({from: min, to: max + 1});\n });\n TextMarker.prototype.find = function() {\n var from, to;\n for (var i = 0, e = this.set.length; i < e; ++i) {\n var line = this.set[i], mk = line.marked;\n for (var j = 0; j < mk.length; ++j) {\n var mark = mk[j];\n if (mark.set == this.set) {\n if (mark.from != null || mark.to != null) {\n var found = lineNo(line);\n if (found != null) {\n if (mark.from != null) from = {line: found, ch: mark.from};\n if (mark.to != null) to = {line: found, ch: mark.to};\n }\n }\n }\n }\n }\n return {from: from, to: to};\n };\n\n function markText(from, to, className) {\n from = clipPos(from); to = clipPos(to);\n var tm = new TextMarker();\n function add(line, from, to, className) {\n getLine(line).addMark(new MarkedText(from, to, className, tm.set));\n }\n if (from.line == to.line) add(from.line, from.ch, to.ch, className);\n else {\n add(from.line, from.ch, null, className);\n for (var i = from.line + 1, e = to.line; i < e; ++i)\n add(i, null, null, className);\n add(to.line, null, to.ch, className);\n }\n changes.push({from: from.line, to: to.line + 1});\n return tm;\n }\n\n function setBookmark(pos) {\n pos = clipPos(pos);\n var bm = new Bookmark(pos.ch);\n getLine(pos.line).addMark(bm);\n return bm;\n }\n\n function addGutterMarker(line, text, className) {\n if (typeof line == \"number\") line = getLine(clipLine(line));\n line.gutterMarker = {text: text, style: className};\n gutterDirty = true;\n return line;\n }\n function removeGutterMarker(line) {\n if (typeof line == \"number\") line = getLine(clipLine(line));\n line.gutterMarker = null;\n gutterDirty = true;\n }\n\n function changeLine(handle, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") line = getLine(clipLine(handle));\n else no = lineNo(handle);\n if (no == null) return null;\n if (op(line, no)) changes.push({from: no, to: no + 1});\n else return null;\n return line;\n }\n function setLineClass(handle, className) {\n return changeLine(handle, function(line) {\n if (line.className != className) {\n line.className = className;\n return true;\n }\n });\n }\n function setLineHidden(handle, hidden) {\n return changeLine(handle, function(line, no) {\n if (line.hidden != hidden) {\n line.hidden = hidden;\n updateLineHeight(line, hidden ? 0 : 1);\n if (hidden && (sel.from.line == no || sel.to.line == no))\n setSelection(skipHidden(sel.from, sel.from.line, sel.from.ch),\n skipHidden(sel.to, sel.to.line, sel.to.ch));\n return (gutterDirty = true);\n }\n });\n }\n\n function lineInfo(line) {\n if (typeof line == \"number\") {\n if (!isLine(line)) return null;\n var n = line;\n line = getLine(line);\n if (!line) return null;\n }\n else {\n var n = lineNo(line);\n if (n == null) return null;\n }\n var marker = line.gutterMarker;\n return {line: n, handle: line, text: line.text, markerText: marker && marker.text,\n markerClass: marker && marker.style, lineClass: line.className};\n }\n\n function stringWidth(str) {\n measure.innerHTML = \"<pre><span>x</span></pre>\";\n measure.firstChild.firstChild.firstChild.nodeValue = str;\n return measure.firstChild.firstChild.offsetWidth || 10;\n }\n // These are used to go from pixel positions to character\n // positions, taking varying character widths into account.\n function charFromX(line, x) {\n if (x <= 0) return 0;\n var lineObj = getLine(line), text = lineObj.text;\n function getX(len) {\n measure.innerHTML = \"<pre><span>\" + lineObj.getHTML(null, null, false, tabText, len) + \"</span></pre>\";\n return measure.firstChild.firstChild.offsetWidth;\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 / charWidth()));\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 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 (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 }\n\n var tempId = Math.floor(Math.random() * 0xffffff).toString(16);\n function measureLine(line, ch) {\n var extra = \"\";\n // Include extra text at the end to make sure the measured line is wrapped in the right way.\n if (options.lineWrapping) {\n var end = line.text.indexOf(\" \", ch + 2);\n extra = htmlEscape(line.text.slice(ch + 1, end < 0 ? line.text.length : end + (ie ? 5 : 0)));\n }\n measure.innerHTML = \"<pre>\" + line.getHTML(null, null, false, tabText, ch) +\n '<span id=\"CodeMirror-temp-' + tempId + '\">' + htmlEscape(line.text.charAt(ch) || \" \") + \"</span>\" +\n extra + \"</pre>\";\n var elt = document.getElementById(\"CodeMirror-temp-\" + tempId);\n var top = elt.offsetTop, left = elt.offsetLeft;\n // Older IEs report zero offsets for spans directly after a wrap\n if (ie && ch && top == 0 && left == 0) {\n var backup = document.createElement(\"span\");\n backup.innerHTML = \"x\";\n elt.parentNode.insertBefore(backup, elt.nextSibling);\n top = backup.offsetTop;\n }\n return {top: top, left: left};\n }\n function localCoords(pos, inLineWrap) {\n var x, lh = textHeight(), y = lh * (heightAtLine(doc, pos.line) - (inLineWrap ? displayOffset : 0));\n if (pos.ch == 0) x = 0;\n else {\n var sp = measureLine(getLine(pos.line), pos.ch);\n x = sp.left;\n if (options.lineWrapping) y += Math.max(0, sp.top);\n }\n return {x: x, y: y, yBot: y + lh};\n }\n // Coords must be lineSpace-local\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 }\n function pageCoords(pos) {\n var local = localCoords(pos, true), off = eltOffset(lineSpace);\n return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};\n }\n\n var cachedHeight, cachedHeightFor, measureText;\n function textHeight() {\n if (measureText == null) {\n measureText = \"<pre>\";\n for (var i = 0; i < 49; ++i) measureText += \"x<br/>\";\n measureText += \"x</pre>\";\n }\n var offsetHeight = lineDiv.clientHeight;\n if (offsetHeight == cachedHeightFor) return cachedHeight;\n cachedHeightFor = offsetHeight;\n measure.innerHTML = measureText;\n cachedHeight = measure.firstChild.offsetHeight / 50 || 1;\n measure.innerHTML = \"\";\n return cachedHeight;\n }\n var cachedWidth, cachedWidthFor = 0;\n function charWidth() {\n if (scroller.clientWidth == cachedWidthFor) return cachedWidth;\n cachedWidthFor = scroller.clientWidth;\n return (cachedWidth = stringWidth(\"x\"));\n }\n function paddingTop() {return lineSpace.offsetTop;}\n function paddingLeft() {return lineSpace.offsetLeft;}\n\n function posFromMouse(e, liberal) {\n var offW = eltOffset(scroller, true), x, y;\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX; y = e.clientY; } catch (e) { return null; }\n // This is a mess of a heuristic to try and determine whether a\n // scroll-bar was clicked or not, and to return null if one was\n // (and !liberal).\n if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))\n return null;\n var offL = eltOffset(lineSpace, true);\n return coordsChar(x - offL.left, y - offL.top);\n }\n function onContextMenu(e) {\n var pos = posFromMouse(e);\n if (!pos || window.opera) return; // Opera is difficult.\n if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))\n operation(setCursor)(pos.line, pos.ch);\n\n var oldCSS = input.style.cssText;\n inputDiv.style.position = \"absolute\";\n input.style.cssText = \"position: fixed; width: 30px; height: 30px; top: \" + (e.clientY - 5) +\n \"px; left: \" + (e.clientX - 5) + \"px; z-index: 1000; background: white; \" +\n \"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n leaveInputAlone = true;\n var val = input.value = getSelection();\n focusInput();\n input.select();\n function rehide() {\n var newVal = splitLines(input.value).join(\"\\n\");\n if (newVal != val) operation(replaceSelection)(newVal, \"end\");\n inputDiv.style.position = \"relative\";\n input.style.cssText = oldCSS;\n leaveInputAlone = false;\n resetInput(true);\n slowPoll();\n }\n\n if (gecko) {\n e_stop(e);\n var mouseup = connect(window, \"mouseup\", function() {\n mouseup();\n setTimeout(rehide, 20);\n }, true);\n }\n else {\n setTimeout(rehide, 50);\n }\n }\n\n // Cursor-blinking\n function restartBlink() {\n clearInterval(blinker);\n var on = true;\n cursor.style.visibility = \"\";\n blinker = setInterval(function() {\n cursor.style.visibility = (on = !on) ? \"\" : \"hidden\";\n }, 650);\n }\n\n var matching = {\"(\": \")>\", \")\": \"(<\", \"[\": \"]>\", \"]\": \"[<\", \"{\": \"}>\", \"}\": \"{<\"};\n function matchBrackets(autoclear) {\n var head = sel.inverted ? sel.from : sel.to, line = getLine(head.line), pos = head.ch - 1;\n var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];\n if (!match) return;\n var ch = match.charAt(0), forward = match.charAt(1) == \">\", d = forward ? 1 : -1, st = line.styles;\n for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)\n if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}\n\n var stack = [line.text.charAt(pos)], re = /[(){}[\\]]/;\n function scan(line, from, to) {\n if (!line.text) return;\n var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;\n for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {\n var text = st[i];\n if (st[i+1] != null && st[i+1] != style) {pos += d * text.length; continue;}\n for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {\n if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {\n var match = matching[cur];\n if (match.charAt(1) == \">\" == forward) stack.push(cur);\n else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};\n else if (!stack.length) return {pos: pos, match: true};\n }\n }\n }\n }\n for (var i = head.line, e = forward ? Math.min(i + 100, doc.size) : Math.max(-1, i - 100); i != e; i+=d) {\n var line = getLine(i), first = i == head.line;\n var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);\n if (found) break;\n }\n if (!found) found = {pos: null, match: false};\n var style = found.match ? \"CodeMirror-matchingbracket\" : \"CodeMirror-nonmatchingbracket\";\n var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),\n two = found.pos != null && markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style);\n var clear = operation(function(){one.clear(); two && two.clear();});\n if (autoclear) setTimeout(clear, 800);\n else bracketHighlighted = clear;\n }\n\n // Finds the line to start with when starting a parse. Tries to\n // find a line with a stateAfter, so that it can start with a\n // valid state. If that fails, it returns the line with the\n // smallest indentation, which tends to need the least context to\n // parse correctly.\n function findStartLine(n) {\n var minindent, minline;\n for (var search = n, lim = n - 40; search > lim; --search) {\n if (search == 0) return 0;\n var line = getLine(search-1);\n if (line.stateAfter) return search;\n var indented = line.indentation(options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline;\n }\n function getStateBefore(n) {\n var start = findStartLine(n), state = start && getLine(start-1).stateAfter;\n if (!state) state = startState(mode);\n else state = copyState(mode, state);\n doc.iter(start, n, function(line) {\n line.highlight(mode, state, options.tabSize);\n line.stateAfter = copyState(mode, state);\n });\n if (start < n) changes.push({from: start, to: n});\n if (n < doc.size && !getLine(n).stateAfter) work.push(n);\n return state;\n }\n function highlightLines(start, end) {\n var state = getStateBefore(start);\n doc.iter(start, end, function(line) {\n line.highlight(mode, state, options.tabSize);\n line.stateAfter = copyState(mode, state);\n });\n }\n function highlightWorker() {\n var end = +new Date + options.workTime;\n var foundWork = work.length;\n while (work.length) {\n if (!getLine(showingFrom).stateAfter) var task = showingFrom;\n else var task = work.pop();\n if (task >= doc.size) continue;\n var start = findStartLine(task), state = start && getLine(start-1).stateAfter;\n if (state) state = copyState(mode, state);\n else state = startState(mode);\n\n var unchanged = 0, compare = mode.compareStates, realChange = false,\n i = start, bail = false;\n doc.iter(i, doc.size, function(line) {\n var hadState = line.stateAfter;\n if (+new Date > end) {\n work.push(i);\n startWorker(options.workDelay);\n if (realChange) changes.push({from: task, to: i + 1});\n return (bail = true);\n }\n var changed = line.highlight(mode, state, options.tabSize);\n if (changed) realChange = true;\n line.stateAfter = copyState(mode, state);\n if (compare) {\n if (hadState && compare(hadState, state)) return true;\n } else {\n if (changed !== false || !hadState) unchanged = 0;\n else if (++unchanged > 3 && (!mode.indent || mode.indent(hadState, \"\") == mode.indent(state, \"\")))\n return true;\n }\n ++i;\n });\n if (bail) return;\n if (realChange) changes.push({from: task, to: i + 1});\n }\n if (foundWork && options.onHighlightComplete)\n options.onHighlightComplete(instance);\n }\n function startWorker(time) {\n if (!work.length) return;\n highlight.set(time, operation(highlightWorker));\n }\n\n // Operations are used to wrap changes in such a way that each\n // change won't have to update the cursor and display (which would\n // be awkward, slow, and error-prone), but instead updates are\n // batched and then all combined and executed at once.\n function startOperation() {\n updateInput = userSelChange = textChanged = null;\n changes = []; selectionChanged = false; callbacks = [];\n }\n function endOperation() {\n var reScroll = false, updated;\n if (selectionChanged) reScroll = !scrollCursorIntoView();\n if (changes.length) updated = updateDisplay(changes, true);\n else {\n if (selectionChanged) updateCursor();\n if (gutterDirty) updateGutter();\n }\n if (reScroll) scrollCursorIntoView();\n if (selectionChanged) {scrollEditorIntoView(); restartBlink();}\n\n if (focused && !leaveInputAlone &&\n (updateInput === true || (updateInput !== false && selectionChanged)))\n resetInput(userSelChange);\n\n if (selectionChanged && options.matchBrackets)\n setTimeout(operation(function() {\n if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}\n if (posEq(sel.from, sel.to)) matchBrackets(false);\n }), 20);\n var tc = textChanged, cbs = callbacks; // these can be reset by callbacks\n if (selectionChanged && options.onCursorActivity)\n options.onCursorActivity(instance);\n if (tc && options.onChange && instance)\n options.onChange(instance, tc);\n for (var i = 0; i < cbs.length; ++i) cbs[i](instance);\n if (updated && options.onUpdate) options.onUpdate(instance);\n }\n var nestedOperation = 0;\n function operation(f) {\n return function() {\n if (!nestedOperation++) startOperation();\n try {var result = f.apply(this, arguments);}\n finally {if (!--nestedOperation) endOperation();}\n return result;\n };\n }\n\n for (var ext in extensions)\n if (extensions.propertyIsEnumerable(ext) &&\n !instance.propertyIsEnumerable(ext))\n instance[ext] = extensions[ext];\n return instance;\n } // (end of function CodeMirror)", "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\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 CodeMirror(place, givenOptions) {\n // Determine effective options based on given values and defaults.\n var options = {}, defaults = CodeMirror.defaults;\n for (var opt in defaults)\n if (defaults.hasOwnProperty(opt))\n options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];\n\n // The element in which the editor lives.\n var wrapper = document.createElement(\"div\");\n wrapper.className = \"CodeMirror\" + (options.lineWrapping ? \" CodeMirror-wrap\" : \"\");\n // This mess creates the base DOM structure for the editor.\n wrapper.innerHTML =\n '<div style=\"overflow: hidden; position: relative; width: 3px; height: 0px;\">' + // Wraps and hides input textarea\n '<textarea style=\"position: absolute; padding: 0; width: 1px; height: 1em\" wrap=\"off\" ' +\n 'autocorrect=\"off\" autocapitalize=\"off\"></textarea></div>' +\n '<div class=\"CodeMirror-scrollbar\">' + // The vertical scrollbar. Horizontal scrolling is handled by the scroller itself.\n '<div class=\"CodeMirror-scrollbar-inner\">' + // The empty scrollbar content, used solely for managing the scrollbar thumb.\n '</div></div>' + // This must be before the scroll area because it's float-right.\n '<div class=\"CodeMirror-scroll\" tabindex=\"-1\">' +\n '<div style=\"position: relative\">' + // Set to the height of the text, causes scrolling\n '<div style=\"position: relative\">' + // Moved around its parent to cover visible view\n '<div class=\"CodeMirror-gutter\"><div class=\"CodeMirror-gutter-text\"></div></div>' +\n // Provides positioning relative to (visible) text origin\n '<div class=\"CodeMirror-lines\"><div style=\"position: relative; z-index: 0\">' +\n // Used to measure text size\n '<div style=\"position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden;\"></div>' +\n '<pre class=\"CodeMirror-cursor\">&#160;</pre>' + // Absolutely positioned blinky cursor\n '<pre class=\"CodeMirror-cursor\" style=\"visibility: hidden\">&#160;</pre>' + // Used to force a width\n '<div style=\"position: relative; z-index: -1\"></div><div></div>' + // DIVs containing the selection and the actual code\n '</div></div></div></div></div>';\n if (place.appendChild) place.appendChild(wrapper); else place(wrapper);\n // I've never seen more elegant code in my life.\n var inputDiv = wrapper.firstChild, input = inputDiv.firstChild,\n scroller = wrapper.lastChild, code = scroller.firstChild,\n mover = code.firstChild, gutter = mover.firstChild, gutterText = gutter.firstChild,\n lineSpace = gutter.nextSibling.firstChild, measure = lineSpace.firstChild,\n cursor = measure.nextSibling, widthForcer = cursor.nextSibling,\n selectionDiv = widthForcer.nextSibling, lineDiv = selectionDiv.nextSibling,\n scrollbar = inputDiv.nextSibling, scrollbarInner = scrollbar.firstChild;\n themeChanged(); keyMapChanged();\n // Needed to hide big blue blinking cursor on Mobile Safari\n if (ios) input.style.width = \"0px\";\n if (!webkit) scroller.draggable = true;\n lineSpace.style.outline = \"none\";\n if (options.tabindex != null) input.tabIndex = options.tabindex;\n if (options.autofocus) focusInput();\n if (!options.gutter && !options.lineNumbers) gutter.style.display = \"none\";\n // Needed to handle Tab key in KHTML\n if (khtml) inputDiv.style.height = \"1px\", inputDiv.style.position = \"absolute\";\n\n // Check for OS X >= 10.7. If so, we need to force a width on the scrollbar, and \n // make it overlap the content. (But we only do this if the scrollbar doesn't already\n // have a natural width. If the mouse is plugged in or the user sets the system pref\n // to always show scrollbars, the scrollbar shouldn't overlap.)\n if (mac_geLion) {\n scrollbar.className += (overlapScrollbars() ? \" cm-sb-overlap\" : \" cm-sb-nonoverlap\");\n } else if (ie_lt8) {\n // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).\n scrollbar.className += \" cm-sb-ie7\";\n }\n\n // Check for problem with IE innerHTML not working when we have a\n // P (or similar) parent node.\n try { stringWidth(\"x\"); }\n catch (e) {\n if (e.message.match(/runtime/i))\n e = new Error(\"A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)\");\n throw e;\n }\n\n // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.\n var poll = new Delayed(), highlight = new Delayed(), blinker;\n\n // mode holds a mode API object. doc is the tree of Line objects,\n // work an array of lines that should be parsed, and history the\n // undo history (instance of History constructor).\n var mode, doc = new BranchChunk([new LeafChunk([new Line(\"\")])]), work, focused;\n loadMode();\n // The selection. These are always maintained to point at valid\n // positions. Inverted is used to remember that the user is\n // selecting bottom-to-top.\n var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};\n // Selection-related flags. shiftSelecting obviously tracks\n // whether the user is holding shift.\n var shiftSelecting, lastClick, lastDoubleClick, lastScrollTop = 0, lastScrollLeft = 0, draggingText,\n overwrite = false, suppressEdits = false;\n // Variables used by startOperation/endOperation to track what\n // happened during the operation.\n var updateInput, userSelChange, changes, textChanged, selectionChanged, leaveInputAlone,\n gutterDirty, callbacks;\n // Current visible range (may be bigger than the view window).\n var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0;\n // bracketHighlighted is used to remember that a bracket has been\n // marked.\n var bracketHighlighted;\n // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n var maxLine = \"\", updateMaxLine = false, maxLineChanged = true;\n var tabCache = {};\n\n // Initialize the content.\n operation(function(){setValue(options.value || \"\"); updateInput = false;})();\n var history = new History();\n\n // Register our event handlers.\n connect(scroller, \"mousedown\", operation(onMouseDown));\n connect(scroller, \"dblclick\", operation(onDoubleClick));\n connect(lineSpace, \"selectstart\", e_preventDefault);\n // Gecko browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for Gecko.\n if (!gecko) connect(scroller, \"contextmenu\", onContextMenu);\n connect(scroller, \"scroll\", onScroll);\n connect(scrollbar, \"scroll\", onScroll);\n connect(scrollbar, \"mousedown\", function() {if (focused) setTimeout(focusInput, 0);});\n connect(scroller, \"mousewheel\", onMouseWheel);\n connect(scroller, \"DOMMouseScroll\", onMouseWheel);\n connect(window, \"resize\", function() {updateDisplay(true);});\n connect(input, \"keyup\", operation(onKeyUp));\n connect(input, \"input\", fastPoll);\n connect(input, \"keydown\", operation(onKeyDown));\n connect(input, \"keypress\", operation(onKeyPress));\n connect(input, \"focus\", onFocus);\n connect(input, \"blur\", onBlur);\n\n if (options.dragDrop) {\n connect(scroller, \"dragstart\", onDragStart);\n function drag_(e) {\n if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;\n e_stop(e);\n }\n connect(scroller, \"dragenter\", drag_);\n connect(scroller, \"dragover\", drag_);\n connect(scroller, \"drop\", operation(onDrop));\n }\n connect(scroller, \"paste\", function(){focusInput(); fastPoll();});\n connect(input, \"paste\", fastPoll);\n connect(input, \"cut\", operation(function(){\n if (!options.readOnly) replaceSelection(\"\");\n }));\n\n // Needed to handle Tab key in KHTML\n if (khtml) connect(code, \"mouseup\", function() {\n if (document.activeElement == input) input.blur();\n focusInput();\n });\n\n // IE throws unspecified error in certain cases, when\n // trying to access activeElement before onload\n var hasFocus; try { hasFocus = (document.activeElement == input); } catch(e) { }\n if (hasFocus || options.autofocus) setTimeout(onFocus, 20);\n else onBlur();\n\n function isLine(l) {return l >= 0 && l < doc.size;}\n // The instance object that we'll return. Mostly calls out to\n // local functions in the CodeMirror function. Some do some extra\n // range checking and/or clipping. operation is used to wrap the\n // call so that changes it makes are tracked, and the display is\n // updated afterwards.\n var instance = wrapper.CodeMirror = {\n getValue: getValue,\n setValue: operation(setValue),\n getSelection: getSelection,\n replaceSelection: operation(replaceSelection),\n focus: function(){window.focus(); focusInput(); onFocus(); fastPoll();},\n setOption: function(option, value) {\n var oldVal = options[option];\n options[option] = value;\n if (option == \"mode\" || option == \"indentUnit\") loadMode();\n else if (option == \"readOnly\" && value == \"nocursor\") {onBlur(); input.blur();}\n else if (option == \"readOnly\" && !value) {resetInput(true);}\n else if (option == \"theme\") themeChanged();\n else if (option == \"lineWrapping\" && oldVal != value) operation(wrappingChanged)();\n else if (option == \"tabSize\") updateDisplay(true);\n else if (option == \"keyMap\") keyMapChanged();\n if (option == \"lineNumbers\" || option == \"gutter\" || option == \"firstLineNumber\" || option == \"theme\") {\n gutterChanged();\n updateDisplay(true);\n }\n },\n getOption: function(option) {return options[option];},\n undo: operation(undo),\n redo: operation(redo),\n indentLine: operation(function(n, dir) {\n if (typeof dir != \"string\") {\n if (dir == null) dir = options.smartIndent ? \"smart\" : \"prev\";\n else dir = dir ? \"add\" : \"subtract\";\n }\n if (isLine(n)) indentLine(n, dir);\n }),\n indentSelection: operation(indentSelected),\n historySize: function() {return {undo: history.done.length, redo: history.undone.length};},\n clearHistory: function() {history = new History();},\n matchBrackets: operation(function(){matchBrackets(true);}),\n getTokenAt: operation(function(pos) {\n pos = clipPos(pos);\n return getLine(pos.line).getTokenAt(mode, getStateBefore(pos.line), pos.ch);\n }),\n getStateAfter: function(line) {\n line = clipLine(line == null ? doc.size - 1: line);\n return getStateBefore(line + 1);\n },\n cursorCoords: function(start, mode) {\n if (start == null) start = sel.inverted;\n return this.charCoords(start ? sel.from : sel.to, mode);\n },\n charCoords: function(pos, mode) {\n pos = clipPos(pos);\n if (mode == \"local\") return localCoords(pos, false);\n if (mode == \"div\") return localCoords(pos, true);\n return pageCoords(pos);\n },\n coordsChar: function(coords) {\n var off = eltOffset(lineSpace);\n return coordsChar(coords.x - off.left, coords.y - off.top);\n },\n markText: operation(markText),\n setBookmark: setBookmark,\n findMarksAt: findMarksAt,\n setMarker: operation(addGutterMarker),\n clearMarker: operation(removeGutterMarker),\n setLineClass: operation(setLineClass),\n hideLine: operation(function(h) {return setLineHidden(h, true);}),\n showLine: operation(function(h) {return setLineHidden(h, false);}),\n onDeleteLine: function(line, f) {\n if (typeof line == \"number\") {\n if (!isLine(line)) return null;\n line = getLine(line);\n }\n (line.handlers || (line.handlers = [])).push(f);\n return line;\n },\n lineInfo: lineInfo,\n addWidget: function(pos, node, scroll, vert, horiz) {\n pos = localCoords(clipPos(pos));\n var top = pos.yBot, left = pos.x;\n node.style.position = \"absolute\";\n code.appendChild(node);\n if (vert == \"over\") top = pos.y;\n else if (vert == \"near\") {\n var vspace = Math.max(scroller.offsetHeight, doc.height * textHeight()),\n hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft();\n if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)\n top = pos.y - node.offsetHeight;\n if (left + node.offsetWidth > hspace)\n left = hspace - node.offsetWidth;\n }\n node.style.top = (top + paddingTop()) + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = code.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") left = 0;\n else if (horiz == \"middle\") left = (code.clientWidth - node.offsetWidth) / 2;\n node.style.left = (left + paddingLeft()) + \"px\";\n }\n if (scroll)\n scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);\n },\n\n lineCount: function() {return doc.size;},\n clipPos: clipPos,\n getCursor: function(start) {\n if (start == null) start = sel.inverted;\n return copyPos(start ? sel.from : sel.to);\n },\n somethingSelected: function() {return !posEq(sel.from, sel.to);},\n setCursor: operation(function(line, ch, user) {\n if (ch == null && typeof line.line == \"number\") setCursor(line.line, line.ch, user);\n else setCursor(line, ch, user);\n }),\n setSelection: operation(function(from, to, user) {\n (user ? setSelectionUser : setSelection)(clipPos(from), clipPos(to || from));\n }),\n getLine: function(line) {if (isLine(line)) return getLine(line).text;},\n getLineHandle: function(line) {if (isLine(line)) return getLine(line);},\n setLine: operation(function(line, text) {\n if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: getLine(line).text.length});\n }),\n removeLine: operation(function(line) {\n if (isLine(line)) replaceRange(\"\", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));\n }),\n replaceRange: operation(replaceRange),\n getRange: function(from, to, lineSep) {return getRange(clipPos(from), clipPos(to), lineSep);},\n\n triggerOnKeyDown: operation(onKeyDown),\n execCommand: function(cmd) {return commands[cmd](instance);},\n // Stuff used by commands, probably not much use to outside code.\n moveH: operation(moveH),\n deleteH: operation(deleteH),\n moveV: operation(moveV),\n toggleOverwrite: function() {\n if(overwrite){\n overwrite = false;\n cursor.className = cursor.className.replace(\" CodeMirror-overwrite\", \"\");\n } else {\n overwrite = true;\n cursor.className += \" CodeMirror-overwrite\";\n }\n },\n\n posFromIndex: function(off) {\n var lineNo = 0, ch;\n doc.iter(0, doc.size, function(line) {\n var sz = line.text.length + 1;\n if (sz > off) { ch = off; return true; }\n off -= sz;\n ++lineNo;\n });\n return clipPos({line: lineNo, ch: ch});\n },\n indexFromPos: function (coords) {\n if (coords.line < 0 || coords.ch < 0) return 0;\n var index = coords.ch;\n doc.iter(0, coords.line, function (line) {\n index += line.text.length + 1;\n });\n return index;\n },\n scrollTo: function(x, y) {\n if (x != null) scroller.scrollLeft = x;\n if (y != null) scrollbar.scrollTop = y;\n updateDisplay([]);\n },\n getScrollInfo: function() {\n return {x: scroller.scrollLeft, y: scrollbar.scrollTop,\n height: scrollbar.scrollHeight, width: scroller.scrollWidth};\n },\n\n operation: function(f){return operation(f)();},\n compoundChange: function(f){return compoundChange(f);},\n refresh: function(){\n updateDisplay(true, null, lastScrollTop);\n if (scrollbar.scrollHeight > lastScrollTop)\n scrollbar.scrollTop = lastScrollTop;\n },\n getInputField: function(){return input;},\n getWrapperElement: function(){return wrapper;},\n getScrollerElement: function(){return scroller;},\n getGutterElement: function(){return gutter;}\n };\n\n function getLine(n) { return getLineAt(doc, n); }\n function updateLineHeight(line, height) {\n gutterDirty = true;\n var diff = height - line.height;\n for (var n = line; n; n = n.parent) n.height += diff;\n }\n\n function setValue(code) {\n var top = {line: 0, ch: 0};\n updateLines(top, {line: doc.size - 1, ch: getLine(doc.size-1).text.length},\n splitLines(code), top, top);\n updateInput = true;\n }\n function getValue(lineSep) {\n var text = [];\n doc.iter(0, doc.size, function(line) { text.push(line.text); });\n return text.join(lineSep || \"\\n\");\n }\n\n function onScroll(e) {\n if (scroller.scrollTop) {\n scrollbar.scrollTop += scroller.scrollTop;\n scroller.scrollTop = 0;\n }\n if (lastScrollTop != scrollbar.scrollTop || lastScrollLeft != scroller.scrollLeft) {\n lastScrollTop = scrollbar.scrollTop;\n lastScrollLeft = scroller.scrollLeft;\n updateDisplay([]);\n if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + \"px\";\n if (options.onScroll) options.onScroll(instance);\n }\n }\n\n function onMouseDown(e) {\n setShift(e_prop(e, \"shiftKey\"));\n // Check whether this is a click in a widget\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == code && n != mover) return;\n\n // See if this is a click in the gutter\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == gutterText) {\n if (options.onGutterClick)\n options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e);\n return e_preventDefault(e);\n }\n\n var start = posFromMouse(e);\n\n switch (e_button(e)) {\n case 3:\n if (gecko && !mac) onContextMenu(e);\n return;\n case 2:\n if (start) setCursor(start.line, start.ch, true);\n setTimeout(focusInput, 20);\n e_preventDefault(e);\n return;\n }\n // For button 1, if it was clicked inside the editor\n // (posFromMouse returning non-null), we have to adjust the\n // selection.\n if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}\n\n if (!focused) onFocus();\n\n var now = +new Date;\n if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {\n e_preventDefault(e);\n setTimeout(focusInput, 20);\n return selectLine(start.line);\n } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) {\n lastDoubleClick = {time: now, pos: start};\n e_preventDefault(e);\n return selectWordAt(start);\n } else { lastClick = {time: now, pos: start}; }\n\n var last = start, going;\n if (options.dragDrop && dragAndDrop && !options.readOnly && !posEq(sel.from, sel.to) &&\n !posLess(start, sel.from) && !posLess(sel.to, start)) {\n // Let the drag handler handle this.\n if (webkit) scroller.draggable = true;\n function dragEnd(e2) {\n if (webkit) scroller.draggable = false;\n draggingText = false;\n up(); drop();\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2);\n setCursor(start.line, start.ch, true);\n focusInput();\n }\n }\n var up = connect(document, \"mouseup\", operation(dragEnd), true);\n var drop = connect(scroller, \"drop\", operation(dragEnd), true);\n draggingText = true;\n // IE's approach to draggable\n if (scroller.dragDrop) scroller.dragDrop();\n return;\n }\n e_preventDefault(e);\n setCursor(start.line, start.ch, true);\n\n function extend(e) {\n var cur = posFromMouse(e, true);\n if (cur && !posEq(cur, last)) {\n if (!focused) onFocus();\n last = cur;\n setSelectionUser(start, cur);\n updateInput = false;\n var visible = visibleLines();\n if (cur.line >= visible.to || cur.line < visible.from)\n going = setTimeout(operation(function(){extend(e);}), 150);\n }\n }\n\n function done(e) {\n clearTimeout(going);\n var cur = posFromMouse(e);\n if (cur) setSelectionUser(start, cur);\n e_preventDefault(e);\n focusInput();\n updateInput = true;\n move(); up();\n }\n var move = connect(document, \"mousemove\", operation(function(e) {\n clearTimeout(going);\n e_preventDefault(e);\n if (!ie && !e_button(e)) done(e);\n else extend(e);\n }), true);\n var up = connect(document, \"mouseup\", operation(done), true);\n }\n function onDoubleClick(e) {\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == gutterText) return e_preventDefault(e);\n var start = posFromMouse(e);\n if (!start) return;\n lastDoubleClick = {time: +new Date, pos: start};\n e_preventDefault(e);\n selectWordAt(start);\n }\n function onDrop(e) {\n if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;\n e.preventDefault();\n var pos = posFromMouse(e, true), files = e.dataTransfer.files;\n if (!pos || options.readOnly) return;\n if (files && files.length && window.FileReader && window.File) {\n function loadFile(file, i) {\n var reader = new FileReader;\n reader.onload = function() {\n text[i] = reader.result;\n if (++read == n) {\n pos = clipPos(pos);\n operation(function() {\n var end = replaceRange(text.join(\"\"), pos, pos);\n setSelectionUser(pos, end);\n })();\n }\n };\n reader.readAsText(file);\n }\n var n = files.length, text = Array(n), read = 0;\n for (var i = 0; i < n; ++i) loadFile(files[i], i);\n } else {\n // Don't do a replace if the drop happened inside of the selected text.\n if (draggingText && !(posLess(pos, sel.from) || posLess(sel.to, pos))) return;\n try {\n var text = e.dataTransfer.getData(\"Text\");\n if (text) {\n compoundChange(function() {\n var curFrom = sel.from, curTo = sel.to;\n setSelectionUser(pos, pos);\n if (draggingText) replaceRange(\"\", curFrom, curTo);\n replaceSelection(text);\n focusInput();\n });\n }\n }\n catch(e){}\n }\n }\n function onDragStart(e) {\n var txt = getSelection();\n e.dataTransfer.setData(\"Text\", txt);\n \n // Use dummy image instead of default browsers image.\n if (gecko || chrome || opera) {\n var img = document.createElement('img');\n img.scr = 'data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs='; //1x1 image\n e.dataTransfer.setDragImage(img, 0, 0);\n }\n }\n\n function doHandleBinding(bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) return false;\n }\n var prevShift = shiftSelecting;\n try {\n if (options.readOnly) suppressEdits = true;\n if (dropShift) shiftSelecting = null;\n bound(instance);\n } catch(e) {\n if (e != Pass) throw e;\n return false;\n } finally {\n shiftSelecting = prevShift;\n suppressEdits = false;\n }\n return true;\n }\n function handleKeyBinding(e) {\n // Handle auto keymap transitions\n var startMap = getKeyMap(options.keyMap), next = startMap.auto;\n clearTimeout(maybeTransition);\n if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() {\n if (getKeyMap(options.keyMap) == startMap) {\n options.keyMap = (next.call ? next.call(null, instance) : next);\n }\n }, 50);\n\n var name = keyNames[e_prop(e, \"keyCode\")], handled = false;\n if (name == null || e.altGraphKey) return false;\n if (e_prop(e, \"altKey\")) name = \"Alt-\" + name;\n if (e_prop(e, \"ctrlKey\")) name = \"Ctrl-\" + name;\n if (e_prop(e, \"metaKey\")) name = \"Cmd-\" + name;\n\n var stopped = false;\n function stop() { stopped = true; }\n\n if (e_prop(e, \"shiftKey\")) {\n handled = lookupKey(\"Shift-\" + name, options.extraKeys, options.keyMap,\n function(b) {return doHandleBinding(b, true);}, stop)\n || lookupKey(name, options.extraKeys, options.keyMap, function(b) {\n if (typeof b == \"string\" && /^go[A-Z]/.test(b)) return doHandleBinding(b);\n }, stop);\n } else {\n handled = lookupKey(name, options.extraKeys, options.keyMap, doHandleBinding, stop);\n }\n if (stopped) handled = false;\n if (handled) {\n e_preventDefault(e);\n restartBlink();\n if (ie) { e.oldKeyCode = e.keyCode; e.keyCode = 0; }\n }\n return handled;\n }\n function handleCharBinding(e, ch) {\n var handled = lookupKey(\"'\" + ch + \"'\", options.extraKeys,\n options.keyMap, function(b) { return doHandleBinding(b, true); });\n if (handled) {\n e_preventDefault(e);\n restartBlink();\n }\n return handled;\n }\n\n var lastStoppedKey = null, maybeTransition;\n function onKeyDown(e) {\n if (!focused) onFocus();\n if (ie && e.keyCode == 27) { e.returnValue = false; }\n if (pollingFast) { if (readInput()) pollingFast = false; }\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n var code = e_prop(e, \"keyCode\");\n // IE does strange things with escape.\n setShift(code == 16 || e_prop(e, \"shiftKey\"));\n // First give onKeyEvent option a chance to handle this.\n var handled = handleKeyBinding(e);\n if (opera) {\n lastStoppedKey = handled ? code : null;\n // Opera has no cut event... we try to at least catch the key combo\n if (!handled && code == 88 && e_prop(e, mac ? \"metaKey\" : \"ctrlKey\"))\n replaceSelection(\"\");\n }\n }\n function onKeyPress(e) {\n if (pollingFast) readInput();\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n var keyCode = e_prop(e, \"keyCode\"), charCode = e_prop(e, \"charCode\");\n if (opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}\n if (((opera && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(e)) return;\n var ch = String.fromCharCode(charCode == null ? keyCode : charCode);\n if (options.electricChars && mode.electricChars && options.smartIndent && !options.readOnly) {\n if (mode.electricChars.indexOf(ch) > -1)\n setTimeout(operation(function() {indentLine(sel.to.line, \"smart\");}), 75);\n }\n if (handleCharBinding(e, ch)) return;\n fastPoll();\n }\n function onKeyUp(e) {\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n if (e_prop(e, \"keyCode\") == 16) shiftSelecting = null;\n }\n\n function onFocus() {\n if (options.readOnly == \"nocursor\") return;\n if (!focused) {\n if (options.onFocus) options.onFocus(instance);\n focused = true;\n if (scroller.className.search(/\\bCodeMirror-focused\\b/) == -1)\n scroller.className += \" CodeMirror-focused\";\n if (!leaveInputAlone) resetInput(true);\n }\n slowPoll();\n restartBlink();\n }\n function onBlur() {\n if (focused) {\n if (options.onBlur) options.onBlur(instance);\n focused = false;\n if (bracketHighlighted)\n operation(function(){\n if (bracketHighlighted) { bracketHighlighted(); bracketHighlighted = null; }\n })();\n scroller.className = scroller.className.replace(\" CodeMirror-focused\", \"\");\n }\n clearInterval(blinker);\n setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);\n }\n\n function chopDelta(delta) {\n // Make sure we always scroll a little bit for any nonzero delta.\n if (delta > 0.0 && delta < 1.0) return 1;\n else if (delta > -1.0 && delta < 0.0) return -1;\n else return Math.round(delta);\n }\n\n function onMouseWheel(e) {\n var deltaX = 0, deltaY = 0;\n if (e.type == \"DOMMouseScroll\") { // Firefox\n var delta = -e.detail * 8.0;\n if (e.axis == e.HORIZONTAL_AXIS) deltaX = delta;\n else if (e.axis == e.VERTICAL_AXIS) deltaY = delta;\n } else if (e.wheelDeltaX !== undefined && e.wheelDeltaY !== undefined) { // WebKit\n deltaX = e.wheelDeltaX / 3.0;\n deltaY = e.wheelDeltaY / 3.0;\n } else if (e.wheelDelta !== undefined) { // IE or Opera\n deltaY = e.wheelDelta / 3.0;\n }\n\n var scrolled = false;\n deltaX = chopDelta(deltaX);\n deltaY = chopDelta(deltaY);\n if ((deltaX > 0 && scroller.scrollLeft > 0) ||\n (deltaX < 0 && scroller.scrollLeft + scroller.clientWidth < scroller.scrollWidth)) {\n scroller.scrollLeft -= deltaX;\n scrolled = true;\n }\n if ((deltaY > 0 && scrollbar.scrollTop > 0) ||\n (deltaY < 0 && scrollbar.scrollTop + scrollbar.clientHeight < scrollbar.scrollHeight)) {\n scrollbar.scrollTop -= deltaY;\n scrolled = true;\n }\n if (scrolled) e_stop(e);\n }\n\n // Replace the range from from to to by the strings in newText.\n // Afterwards, set the selection to selFrom, selTo.\n function updateLines(from, to, newText, selFrom, selTo) {\n if (suppressEdits) return;\n if (history) {\n var old = [];\n doc.iter(from.line, to.line + 1, function(line) { old.push(line.text); });\n history.addChange(from.line, newText.length, old);\n while (history.done.length > options.undoDepth) history.done.shift();\n }\n updateLinesNoUndo(from, to, newText, selFrom, selTo);\n }\n function unredoHelper(from, to) {\n if (!from.length) return;\n var set = from.pop(), out = [];\n for (var i = set.length - 1; i >= 0; i -= 1) {\n var change = set[i];\n var replaced = [], end = change.start + change.added;\n doc.iter(change.start, end, function(line) { replaced.push(line.text); });\n out.push({start: change.start, added: change.old.length, old: replaced});\n var pos = {line: change.start + change.old.length - 1,\n ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])};\n updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: getLine(end-1).text.length}, change.old, pos, pos);\n }\n updateInput = true;\n to.push(out);\n }\n function undo() {unredoHelper(history.done, history.undone);}\n function redo() {unredoHelper(history.undone, history.done);}\n\n function updateLinesNoUndo(from, to, newText, selFrom, selTo) {\n if (suppressEdits) return;\n var recomputeMaxLength = false, maxLineLength = maxLine.length;\n if (!options.lineWrapping)\n doc.iter(from.line, to.line + 1, function(line) {\n if (!line.hidden && line.text.length == maxLineLength) {recomputeMaxLength = true; return true;}\n });\n if (from.line != to.line || newText.length > 1) gutterDirty = true;\n\n var nlines = to.line - from.line, firstLine = getLine(from.line), lastLine = getLine(to.line);\n // First adjust the line structure, taking some care to leave highlighting intact.\n if (from.ch == 0 && to.ch == 0 && newText[newText.length - 1] == \"\") {\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 = [], prevLine = null;\n if (from.line) {\n prevLine = getLine(from.line - 1);\n prevLine.fixMarkEnds(lastLine);\n } else lastLine.fixMarkStarts();\n for (var i = 0, e = newText.length - 1; i < e; ++i)\n added.push(Line.inheritMarks(newText[i], prevLine));\n if (nlines) doc.remove(from.line, nlines, callbacks);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (newText.length == 1)\n firstLine.replace(from.ch, to.ch, newText[0]);\n else {\n lastLine = firstLine.split(to.ch, newText[newText.length-1]);\n firstLine.replace(from.ch, null, newText[0]);\n firstLine.fixMarkEnds(lastLine);\n var added = [];\n for (var i = 1, e = newText.length - 1; i < e; ++i)\n added.push(Line.inheritMarks(newText[i], firstLine));\n added.push(lastLine);\n doc.insert(from.line + 1, added);\n }\n } else if (newText.length == 1) {\n firstLine.replace(from.ch, null, newText[0]);\n lastLine.replace(null, to.ch, \"\");\n firstLine.append(lastLine);\n doc.remove(from.line + 1, nlines, callbacks);\n } else {\n var added = [];\n firstLine.replace(from.ch, null, newText[0]);\n lastLine.replace(null, to.ch, newText[newText.length-1]);\n firstLine.fixMarkEnds(lastLine);\n for (var i = 1, e = newText.length - 1; i < e; ++i)\n added.push(Line.inheritMarks(newText[i], firstLine));\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1, callbacks);\n doc.insert(from.line + 1, added);\n }\n if (options.lineWrapping) {\n var perLine = Math.max(5, scroller.clientWidth / charWidth() - 3);\n doc.iter(from.line, from.line + newText.length, function(line) {\n if (line.hidden) return;\n var guess = Math.ceil(line.text.length / perLine) || 1;\n if (guess != line.height) updateLineHeight(line, guess);\n });\n } else {\n doc.iter(from.line, from.line + newText.length, function(line) {\n var l = line.text;\n if (!line.hidden && l.length > maxLineLength) {\n maxLine = l; maxLineLength = l.length; maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) updateMaxLine = true;\n }\n\n // Add these lines to the work array, so that they will be\n // highlighted. Adjust work lines if lines were added/removed.\n var newWork = [], lendiff = newText.length - nlines - 1;\n for (var i = 0, l = work.length; i < l; ++i) {\n var task = work[i];\n if (task < from.line) newWork.push(task);\n else if (task > to.line) newWork.push(task + lendiff);\n }\n var hlEnd = from.line + Math.min(newText.length, 500);\n highlightLines(from.line, hlEnd);\n newWork.push(hlEnd);\n work = newWork;\n startWorker(100);\n // Remember that these lines changed, for updating the display\n changes.push({from: from.line, to: to.line + 1, diff: lendiff});\n var changeObj = {from: from, to: to, text: newText};\n if (textChanged) {\n for (var cur = textChanged; cur.next; cur = cur.next) {}\n cur.next = changeObj;\n } else textChanged = changeObj;\n\n // Update the selection\n function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}\n setSelection(clipPos(selFrom), clipPos(selTo),\n updateLine(sel.from.line), updateLine(sel.to.line));\n }\n\n function updateVerticalScroll(scrollTop) {\n var th = textHeight(), virtualHeight = Math.floor(doc.height * th + 2 * paddingTop()), scrollbarHeight = scroller.clientHeight;\n scrollbar.style.height = scrollbarHeight + \"px\";\n if (scroller.clientHeight)\n scrollbarInner.style.height = virtualHeight + \"px\";\n // Position the mover div to align with the current virtual scroll position\n if (scrollTop != null) scrollbar.scrollTop = scrollTop;\n mover.style.top = (displayOffset * th - scrollbar.scrollTop) + \"px\";\n scrollbar.style.display = (virtualHeight > scrollbarHeight) ? \"block\" : \"none\";\n }\n \n // On Mac OS X Lion and up, detect whether the mouse is plugged in by measuring \n // the width of a div with a scrollbar in it. If the width is <= 1, then\n // the mouse isn't plugged in and scrollbars should overlap the content.\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 }\n\n function computeMaxLength() {\n var maxLineLength = 0; \n maxLine = \"\"; maxLineChanged = true;\n doc.iter(0, doc.size, function(line) {\n var l = line.text;\n if (!line.hidden && l.length > maxLineLength) {\n maxLineLength = l.length; maxLine = l;\n }\n });\n updateMaxLine = false;\n }\n\n function replaceRange(code, from, to) {\n from = clipPos(from);\n if (!to) to = from; else to = clipPos(to);\n code = splitLines(code);\n function adjustPos(pos) {\n if (posLess(pos, from)) return pos;\n if (!posLess(to, pos)) return end;\n var line = pos.line + code.length - (to.line - from.line) - 1;\n var ch = pos.ch;\n if (pos.line == to.line)\n ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));\n return {line: line, ch: ch};\n }\n var end;\n replaceRange1(code, from, to, function(end1) {\n end = end1;\n return {from: adjustPos(sel.from), to: adjustPos(sel.to)};\n });\n return end;\n }\n function replaceSelection(code, collapse) {\n replaceRange1(splitLines(code), sel.from, sel.to, function(end) {\n if (collapse == \"end\") return {from: end, to: end};\n else if (collapse == \"start\") return {from: sel.from, to: sel.from};\n else return {from: sel.from, to: end};\n });\n }\n function replaceRange1(code, from, to, computeSel) {\n var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;\n var newSel = computeSel({line: from.line + code.length - 1, ch: endch});\n updateLines(from, to, code, newSel.from, newSel.to);\n }\n\n function getRange(from, to, lineSep) {\n var l1 = from.line, l2 = to.line;\n if (l1 == l2) return getLine(l1).text.slice(from.ch, to.ch);\n var code = [getLine(l1).text.slice(from.ch)];\n doc.iter(l1 + 1, l2, function(line) { code.push(line.text); });\n code.push(getLine(l2).text.slice(0, to.ch));\n return code.join(lineSep || \"\\n\");\n }\n function getSelection(lineSep) {\n return getRange(sel.from, sel.to, lineSep);\n }\n\n var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll\n function slowPoll() {\n if (pollingFast) return;\n poll.set(options.pollInterval, function() {\n startOperation();\n readInput();\n if (focused) slowPoll();\n endOperation();\n });\n }\n function fastPoll() {\n var missed = false;\n pollingFast = true;\n function p() {\n startOperation();\n var changed = readInput();\n if (!changed && !missed) {missed = true; poll.set(60, p);}\n else {pollingFast = false; slowPoll();}\n endOperation();\n }\n poll.set(20, p);\n }\n\n // Previnput is a hack to work with IME. If we reset the textarea\n // on every change, that breaks IME. So we look for changes\n // compared to the previous content instead. (Modern browsers have\n // events that indicate IME taking place, but these are not widely\n // supported or compatible enough yet to rely on.)\n var prevInput = \"\";\n function readInput() {\n if (leaveInputAlone || !focused || hasSelection(input) || options.readOnly) return false;\n var text = input.value;\n if (text == prevInput) return false;\n shiftSelecting = null;\n var same = 0, l = Math.min(prevInput.length, text.length);\n while (same < l && prevInput[same] == text[same]) ++same;\n if (same < prevInput.length)\n sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)};\n else if (overwrite && posEq(sel.from, sel.to))\n sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))};\n replaceSelection(text.slice(same), \"end\");\n if (text.length > 1000) { input.value = prevInput = \"\"; }\n else prevInput = text;\n return true;\n }\n function resetInput(user) {\n if (!posEq(sel.from, sel.to)) {\n prevInput = \"\";\n input.value = getSelection();\n selectInput(input);\n } else if (user) prevInput = input.value = \"\";\n }\n\n function focusInput() {\n if (options.readOnly != \"nocursor\") input.focus();\n }\n\n function scrollEditorIntoView() {\n if (!cursor.getBoundingClientRect) return;\n var rect = cursor.getBoundingClientRect();\n // IE returns bogus coordinates when the instance sits inside of an iframe and the cursor is hidden\n if (ie && rect.top == rect.bottom) return;\n var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);\n if (rect.top < 0 || rect.bottom > winH) scrollCursorIntoView();\n }\n function scrollCursorIntoView() {\n var coords = calculateCursorCoords();\n return scrollIntoView(coords.x, coords.y, coords.x, coords.yBot);\n }\n function calculateCursorCoords() {\n var cursor = localCoords(sel.inverted ? sel.from : sel.to);\n var x = options.lineWrapping ? Math.min(cursor.x, lineSpace.offsetWidth) : cursor.x;\n return {x: x, y: cursor.y, yBot: cursor.yBot};\n }\n function scrollIntoView(x1, y1, x2, y2) {\n var scrollPos = calculateScrollPos(x1, y1, x2, y2), scrolled = false;\n if (scrollPos.scrollLeft != null) {scroller.scrollLeft = scrollPos.scrollLeft; scrolled = true;}\n if (scrollPos.scrollTop != null) {scrollbar.scrollTop = scrollPos.scrollTop; scrolled = true;}\n if (scrolled && options.onScroll) options.onScroll(instance);\n }\n function calculateScrollPos(x1, y1, x2, y2) {\n var pl = paddingLeft(), pt = paddingTop();\n y1 += pt; y2 += pt; x1 += pl; x2 += pl;\n var screen = scroller.clientHeight, screentop = scrollbar.scrollTop, result = {};\n var atTop = y1 < paddingTop() + 10;\n if (y1 < screentop) result.scrollTop = atTop ? 0 : Math.max(0, y1);\n else if (y2 > screentop + screen) result.scrollTop = y2 - screen;\n\n var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;\n var gutterw = options.fixedGutter ? gutter.clientWidth : 0;\n var atLeft = x1 < gutterw + pl + 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 }\n\n function visibleLines(scrollTop) {\n var lh = textHeight(), top = (scrollTop != null ? scrollTop : scrollbar.scrollTop) - paddingTop();\n var fromHeight = Math.max(0, Math.floor(top / lh));\n var toHeight = Math.ceil((top + scroller.clientHeight) / lh);\n return {from: lineAtHeight(doc, fromHeight),\n to: lineAtHeight(doc, toHeight)};\n }\n // Uses a set of changes plus the current scroll position to\n // determine which DOM updates have to be made, and makes the\n // updates.\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 }\n\n function computeIntact(intact, changes) {\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 && change.diff)\n intact2.push({from: range.from + diff, to: range.to + diff,\n domStart: range.domStart});\n else if (change.to <= range.from || change.from >= range.to)\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 return intact;\n }\n\n function patchDisplay(from, to, intact) {\n // The first pass removes the DOM nodes that aren't intact.\n if (!intact.length) lineDiv.innerHTML = \"\";\n else {\n function killNode(node) {\n var tmp = node.nextSibling;\n node.parentNode.removeChild(node);\n return tmp;\n }\n var domPos = 0, curNode = lineDiv.firstChild, n;\n for (var i = 0; i < intact.length; ++i) {\n var cur = intact[i];\n while (cur.domStart > domPos) {curNode = killNode(curNode); domPos++;}\n for (var j = 0, e = cur.to - cur.from; j < e; ++j) {curNode = curNode.nextSibling; domPos++;}\n }\n while (curNode) curNode = killNode(curNode);\n }\n // This pass fills in the lines that actually changed.\n var nextIntact = intact.shift(), curNode = lineDiv.firstChild, j = from;\n var scratch = document.createElement(\"div\");\n doc.iter(from, to, function(line) {\n if (nextIntact && nextIntact.to == j) nextIntact = intact.shift();\n if (!nextIntact || nextIntact.from > j) {\n if (line.hidden) var html = scratch.innerHTML = \"<pre></pre>\";\n else {\n var html = '<pre' + (line.className ? ' class=\"' + line.className + '\"' : '') + '>'\n + line.getHTML(makeTab) + '</pre>';\n // Kludge to make sure the styled element lies behind the selection (by z-index)\n if (line.bgClassName)\n html = '<div style=\"position: relative\"><pre class=\"' + line.bgClassName +\n '\" style=\"position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2\">&#160;</pre>' + html + \"</div>\";\n }\n scratch.innerHTML = html;\n lineDiv.insertBefore(scratch.firstChild, curNode);\n } else {\n curNode = curNode.nextSibling;\n }\n ++j;\n });\n }\n\n function updateGutter() {\n if (!options.gutter && !options.lineNumbers) return;\n var hText = mover.offsetHeight, hEditor = scroller.clientHeight;\n gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + \"px\";\n var html = [], i = showingFrom, normalNode;\n doc.iter(showingFrom, Math.max(showingTo, showingFrom + 1), function(line) {\n if (line.hidden) {\n html.push(\"<pre></pre>\");\n } else {\n var marker = line.gutterMarker;\n var text = options.lineNumbers ? options.lineNumberFormatter(i + options.firstLineNumber) : null;\n if (marker && marker.text)\n text = marker.text.replace(\"%N%\", text != null ? text : \"\");\n else if (text == null)\n text = \"\\u00a0\";\n html.push((marker && marker.style ? '<pre class=\"' + marker.style + '\">' : \"<pre>\"), text);\n for (var j = 1; j < line.height; ++j) html.push(\"<br/>&#160;\");\n html.push(\"</pre>\");\n if (!marker) normalNode = i;\n }\n ++i;\n });\n gutter.style.display = \"none\";\n gutterText.innerHTML = html.join(\"\");\n // Make sure scrolling doesn't cause number gutter size to pop\n if (normalNode != null && options.lineNumbers) {\n var node = gutterText.childNodes[normalNode - showingFrom];\n var minwidth = String(doc.size).length, val = eltText(node.firstChild), pad = \"\";\n while (val.length + pad.length < minwidth) pad += \"\\u00a0\";\n if (pad) node.insertBefore(document.createTextNode(pad), node.firstChild);\n }\n gutter.style.display = \"\";\n var resized = Math.abs((parseInt(lineSpace.style.marginLeft) || 0) - gutter.offsetWidth) > 2;\n lineSpace.style.marginLeft = gutter.offsetWidth + \"px\";\n gutterDirty = false;\n return resized;\n }\n function updateSelection() {\n var collapsed = posEq(sel.from, sel.to);\n var fromPos = localCoords(sel.from, true);\n var toPos = collapsed ? fromPos : localCoords(sel.to, true);\n var headPos = sel.inverted ? fromPos : toPos, th = textHeight();\n var wrapOff = eltOffset(wrapper), lineOff = eltOffset(lineDiv);\n inputDiv.style.top = Math.max(0, Math.min(scroller.offsetHeight, headPos.y + lineOff.top - wrapOff.top)) + \"px\";\n inputDiv.style.left = Math.max(0, Math.min(scroller.offsetWidth, headPos.x + lineOff.left - wrapOff.left)) + \"px\";\n if (collapsed) {\n cursor.style.top = headPos.y + \"px\";\n cursor.style.left = (options.lineWrapping ? Math.min(headPos.x, lineSpace.offsetWidth) : headPos.x) + \"px\";\n cursor.style.display = \"\";\n selectionDiv.style.display = \"none\";\n } else {\n var sameLine = fromPos.y == toPos.y, html = \"\";\n var clientWidth = lineSpace.clientWidth || lineSpace.offsetWidth;\n var clientHeight = lineSpace.clientHeight || lineSpace.offsetHeight;\n function add(left, top, right, height) {\n var rstyle = quirksMode ? \"width: \" + (!right ? clientWidth : clientWidth - right - left) + \"px\"\n : \"right: \" + right + \"px\";\n html += '<div class=\"CodeMirror-selected\" style=\"position: absolute; left: ' + left +\n 'px; top: ' + top + 'px; ' + rstyle + '; height: ' + height + 'px\"></div>';\n }\n if (sel.from.ch && fromPos.y >= 0) {\n var right = sameLine ? clientWidth - toPos.x : 0;\n add(fromPos.x, fromPos.y, right, th);\n }\n var middleStart = Math.max(0, fromPos.y + (sel.from.ch ? th : 0));\n var middleHeight = Math.min(toPos.y, clientHeight) - middleStart;\n if (middleHeight > 0.2 * th)\n add(0, middleStart, 0, middleHeight);\n if ((!sameLine || !sel.from.ch) && toPos.y < clientHeight - .5 * th)\n add(0, toPos.y, clientWidth - toPos.x, th);\n selectionDiv.innerHTML = html;\n cursor.style.display = \"none\";\n selectionDiv.style.display = \"\";\n }\n }\n\n function setShift(val) {\n if (val) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);\n else shiftSelecting = null;\n }\n function setSelectionUser(from, to) {\n var sh = shiftSelecting && clipPos(shiftSelecting);\n if (sh) {\n if (posLess(sh, from)) from = sh;\n else if (posLess(to, sh)) to = sh;\n }\n setSelection(from, to);\n userSelChange = true;\n }\n // Update the selection. Last two args are only used by\n // updateLines, since they have to be expressed in the line\n // numbers before the update.\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 }\n function skipHidden(pos, oldLine, oldCh) {\n function getNonHidden(dir) {\n var lNo = pos.line + dir, end = dir == 1 ? doc.size : -1;\n while (lNo != end) {\n var line = getLine(lNo);\n if (!line.hidden) {\n var ch = pos.ch;\n if (toEnd || ch > oldCh || ch > line.text.length) ch = line.text.length;\n return {line: lNo, ch: ch};\n }\n lNo += dir;\n }\n }\n var line = getLine(pos.line);\n var toEnd = pos.ch == line.text.length && pos.ch != oldCh;\n if (!line.hidden) return pos;\n if (pos.line >= oldLine) return getNonHidden(1) || getNonHidden(-1);\n else return getNonHidden(-1) || getNonHidden(1);\n }\n function setCursor(line, ch, user) {\n var pos = clipPos({line: line, ch: ch || 0});\n (user ? setSelectionUser : setSelection)(pos, pos);\n }\n\n function clipLine(n) {return Math.max(0, Math.min(n, doc.size-1));}\n function clipPos(pos) {\n if (pos.line < 0) return {line: 0, ch: 0};\n if (pos.line >= doc.size) return {line: doc.size-1, ch: getLine(doc.size-1).text.length};\n var ch = pos.ch, linelen = getLine(pos.line).text.length;\n if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};\n else if (ch < 0) return {line: pos.line, ch: 0};\n else return pos;\n }\n\n function findPosH(dir, unit) {\n var end = sel.inverted ? sel.from : sel.to, line = end.line, ch = end.ch;\n var lineObj = getLine(line);\n function findNextLine() {\n for (var l = line + dir, e = dir < 0 ? -1 : doc.size; l != e; l += dir) {\n var lo = getLine(l);\n if (!lo.hidden) { line = l; lineObj = lo; return true; }\n }\n }\n function moveOnce(boundToLine) {\n if (ch == (dir < 0 ? 0 : lineObj.text.length)) {\n if (!boundToLine && findNextLine()) ch = dir < 0 ? lineObj.text.length : 0;\n else return false;\n } else ch += dir;\n return true;\n }\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\") {\n var sawWord = false;\n for (;;) {\n if (dir < 0) if (!moveOnce()) break;\n if (isWordChar(lineObj.text.charAt(ch))) sawWord = true;\n else if (sawWord) {if (dir < 0) {dir = 1; moveOnce();} break;}\n if (dir > 0) if (!moveOnce()) break;\n }\n }\n return {line: line, ch: ch};\n }\n function moveH(dir, unit) {\n var pos = dir < 0 ? sel.from : sel.to;\n if (shiftSelecting || posEq(sel.from, sel.to)) pos = findPosH(dir, unit);\n setCursor(pos.line, pos.ch, true);\n }\n function deleteH(dir, unit) {\n if (!posEq(sel.from, sel.to)) replaceRange(\"\", sel.from, sel.to);\n else if (dir < 0) replaceRange(\"\", findPosH(dir, unit), sel.to);\n else replaceRange(\"\", sel.from, findPosH(dir, unit));\n userSelChange = true;\n }\n var goalColumn = null;\n function moveV(dir, unit) {\n var dist = 0, pos = localCoords(sel.inverted ? sel.from : sel.to, true);\n if (goalColumn != null) pos.x = goalColumn;\n if (unit == \"page\") dist = Math.min(scroller.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n else if (unit == \"line\") dist = textHeight();\n var target = coordsChar(pos.x, pos.y + dist * dir + 2);\n if (unit == \"page\") scrollbar.scrollTop += localCoords(target, true).y - pos.y;\n setCursor(target.line, target.ch, true);\n goalColumn = pos.x;\n }\n\n function selectWordAt(pos) {\n var line = getLine(pos.line).text;\n var start = pos.ch, end = pos.ch;\n while (start > 0 && isWordChar(line.charAt(start - 1))) --start;\n while (end < line.length && isWordChar(line.charAt(end))) ++end;\n setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end});\n }\n function selectLine(line) {\n setSelectionUser({line: line, ch: 0}, clipPos({line: line + 1, ch: 0}));\n }\n function indentSelected(mode) {\n if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);\n var e = sel.to.line - (sel.to.ch ? 0 : 1);\n for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);\n }\n\n function indentLine(n, how) {\n if (!how) how = \"add\";\n if (how == \"smart\") {\n if (!mode.indent) how = \"prev\";\n else var state = getStateBefore(n);\n }\n\n var line = getLine(n), curSpace = line.indentation(options.tabSize),\n curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (how == \"smart\") {\n indentation = mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass) how = \"prev\";\n }\n if (how == \"prev\") {\n if (n) indentation = getLine(n-1).indentation(options.tabSize);\n else indentation = 0;\n }\n else if (how == \"add\") indentation = curSpace + options.indentUnit;\n else if (how == \"subtract\") indentation = curSpace - options.indentUnit;\n indentation = Math.max(0, indentation);\n var diff = indentation - curSpace;\n\n if (!diff) {\n if (sel.from.line != n && sel.to.line != n) return;\n var indentString = curSpaceString;\n } else {\n var indentString = \"\", pos = 0;\n if (options.indentWithTabs)\n for (var i = Math.floor(indentation / options.tabSize); i; --i) {pos += options.tabSize; indentString += \"\\t\";}\n while (pos < indentation) {++pos; indentString += \" \";}\n }\n\n replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});\n }\n\n function loadMode() {\n mode = CodeMirror.getMode(options, options.mode);\n doc.iter(0, doc.size, function(line) { line.stateAfter = null; });\n work = [0];\n startWorker();\n }\n function gutterChanged() {\n var visible = options.gutter || options.lineNumbers;\n gutter.style.display = visible ? \"\" : \"none\";\n if (visible) gutterDirty = true;\n else lineDiv.parentNode.style.marginLeft = 0;\n }\n function wrappingChanged(from, to) {\n if (options.lineWrapping) {\n wrapper.className += \" CodeMirror-wrap\";\n var perLine = scroller.clientWidth / charWidth() - 3;\n doc.iter(0, doc.size, function(line) {\n if (line.hidden) return;\n var guess = Math.ceil(line.text.length / perLine) || 1;\n if (guess != 1) updateLineHeight(line, guess);\n });\n lineSpace.style.width = code.style.width = \"\";\n widthForcer.style.left = \"\";\n } else {\n wrapper.className = wrapper.className.replace(\" CodeMirror-wrap\", \"\");\n maxLine = \"\"; maxLineChanged = true;\n doc.iter(0, doc.size, function(line) {\n if (line.height != 1 && !line.hidden) updateLineHeight(line, 1);\n if (line.text.length > maxLine.length) maxLine = line.text;\n });\n }\n changes.push({from: 0, to: doc.size});\n }\n function makeTab(col) {\n var w = options.tabSize - col % options.tabSize, cached = tabCache[w];\n if (cached) return cached;\n for (var str = '<span class=\"cm-tab\">', i = 0; i < w; ++i) str += \" \";\n return (tabCache[w] = {html: str + \"</span>\", width: w});\n }\n function themeChanged() {\n scroller.className = scroller.className.replace(/\\s*cm-s-\\S+/g, \"\") +\n options.theme.replace(/(^|\\s)\\s*/g, \" cm-s-\");\n }\n function keyMapChanged() {\n var style = keyMap[options.keyMap].style;\n wrapper.className = wrapper.className.replace(/\\s*cm-keymap-\\S+/g, \"\") +\n (style ? \" cm-keymap-\" + style : \"\");\n }\n\n function TextMarker() { this.set = []; }\n TextMarker.prototype.clear = operation(function() {\n var min = Infinity, max = -Infinity;\n for (var i = 0, e = this.set.length; i < e; ++i) {\n var line = this.set[i], mk = line.marked;\n if (!mk || !line.parent) continue;\n var lineN = lineNo(line);\n min = Math.min(min, lineN); max = Math.max(max, lineN);\n for (var j = 0; j < mk.length; ++j)\n if (mk[j].marker == this) mk.splice(j--, 1);\n }\n if (min != Infinity)\n changes.push({from: min, to: max + 1});\n });\n TextMarker.prototype.find = function() {\n var from, to;\n for (var i = 0, e = this.set.length; i < e; ++i) {\n var line = this.set[i], mk = line.marked;\n for (var j = 0; j < mk.length; ++j) {\n var mark = mk[j];\n if (mark.marker == this) {\n if (mark.from != null || mark.to != null) {\n var found = lineNo(line);\n if (found != null) {\n if (mark.from != null) from = {line: found, ch: mark.from};\n if (mark.to != null) to = {line: found, ch: mark.to};\n }\n }\n }\n }\n }\n return {from: from, to: to};\n };\n\n function markText(from, to, className) {\n from = clipPos(from); to = clipPos(to);\n var tm = new TextMarker();\n if (!posLess(from, to)) return tm;\n function add(line, from, to, className) {\n getLine(line).addMark(new MarkedText(from, to, className, tm));\n }\n if (from.line == to.line) add(from.line, from.ch, to.ch, className);\n else {\n add(from.line, from.ch, null, className);\n for (var i = from.line + 1, e = to.line; i < e; ++i)\n add(i, null, null, className);\n add(to.line, null, to.ch, className);\n }\n changes.push({from: from.line, to: to.line + 1});\n return tm;\n }\n\n function setBookmark(pos) {\n pos = clipPos(pos);\n var bm = new Bookmark(pos.ch);\n getLine(pos.line).addMark(bm);\n return bm;\n }\n\n function findMarksAt(pos) {\n pos = clipPos(pos);\n var markers = [], marked = getLine(pos.line).marked;\n if (!marked) return markers;\n for (var i = 0, e = marked.length; i < e; ++i) {\n var m = marked[i];\n if ((m.from == null || m.from <= pos.ch) &&\n (m.to == null || m.to >= pos.ch))\n markers.push(m.marker || m);\n }\n return markers;\n }\n\n function addGutterMarker(line, text, className) {\n if (typeof line == \"number\") line = getLine(clipLine(line));\n line.gutterMarker = {text: text, style: className};\n gutterDirty = true;\n return line;\n }\n function removeGutterMarker(line) {\n if (typeof line == \"number\") line = getLine(clipLine(line));\n line.gutterMarker = null;\n gutterDirty = true;\n }\n\n function changeLine(handle, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") line = getLine(clipLine(handle));\n else no = lineNo(handle);\n if (no == null) return null;\n if (op(line, no)) changes.push({from: no, to: no + 1});\n else return null;\n return line;\n }\n function setLineClass(handle, className, bgClassName) {\n return changeLine(handle, function(line) {\n if (line.className != className || line.bgClassName != bgClassName) {\n line.className = className;\n line.bgClassName = bgClassName;\n return true;\n }\n });\n }\n function setLineHidden(handle, hidden) {\n return changeLine(handle, function(line, no) {\n if (line.hidden != hidden) {\n line.hidden = hidden;\n if (!options.lineWrapping) {\n var l = line.text;\n if (hidden && l.length == maxLine.length) {\n updateMaxLine = true;\n } else if (!hidden && l.length > maxLine.length) {\n maxLine = l; maxWidth = null; updateMaxLine = false;\n }\n }\n updateLineHeight(line, hidden ? 0 : 1);\n var fline = sel.from.line, tline = sel.to.line;\n if (hidden && (fline == no || tline == no)) {\n var from = fline == no ? skipHidden({line: fline, ch: 0}, fline, 0) : sel.from;\n var to = tline == no ? skipHidden({line: tline, ch: 0}, tline, 0) : sel.to;\n // Can't hide the last visible line, we'd have no place to put the cursor\n if (!to) return;\n setSelection(from, to);\n }\n return (gutterDirty = true);\n }\n });\n }\n\n function lineInfo(line) {\n if (typeof line == \"number\") {\n if (!isLine(line)) return null;\n var n = line;\n line = getLine(line);\n if (!line) return null;\n } else {\n var n = lineNo(line);\n if (n == null) return null;\n }\n var marker = line.gutterMarker;\n return {line: n, handle: line, text: line.text, markerText: marker && marker.text,\n markerClass: marker && marker.style, lineClass: line.className, bgClass: line.bgClassName};\n }\n\n function stringWidth(str) {\n measure.innerHTML = \"<pre><span>x</span></pre>\";\n measure.firstChild.firstChild.firstChild.nodeValue = str;\n return measure.firstChild.firstChild.offsetWidth || 10;\n }\n // These are used to go from pixel positions to character\n // positions, taking varying character widths into account.\n function charFromX(line, x) {\n if (x <= 0) return 0;\n var lineObj = getLine(line), text = lineObj.text;\n function getX(len) {\n return measureLine(lineObj, len).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 / charWidth()));\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 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 (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 }\n\n var tempId = \"CodeMirror-temp-\" + Math.floor(Math.random() * 0xffffff).toString(16);\n function measureLine(line, ch) {\n if (ch == 0) return {top: 0, left: 0};\n var wbr = options.lineWrapping && ch < line.text.length &&\n spanAffectsWrapping.test(line.text.slice(ch - 1, ch + 1));\n measure.innerHTML = \"<pre>\" + line.getHTML(makeTab, ch, tempId, wbr) + \"</pre>\";\n var elt = document.getElementById(tempId);\n var top = elt.offsetTop, left = elt.offsetLeft;\n // Older IEs report zero offsets for spans directly after a wrap\n if (ie && top == 0 && left == 0) {\n var backup = document.createElement(\"span\");\n backup.innerHTML = \"x\";\n elt.parentNode.insertBefore(backup, elt.nextSibling);\n top = backup.offsetTop;\n }\n return {top: top, left: left};\n }\n function localCoords(pos, inLineWrap) {\n var x, lh = textHeight(), y = lh * (heightAtLine(doc, pos.line) - (inLineWrap ? displayOffset : 0));\n if (pos.ch == 0) x = 0;\n else {\n var sp = measureLine(getLine(pos.line), pos.ch);\n x = sp.left;\n if (options.lineWrapping) y += Math.max(0, sp.top);\n }\n return {x: x, y: y, yBot: y + lh};\n }\n // Coords must be lineSpace-local\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 }\n function pageCoords(pos) {\n var local = localCoords(pos, true), off = eltOffset(lineSpace);\n return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};\n }\n\n var cachedHeight, cachedHeightFor, measureText;\n function textHeight() {\n if (measureText == null) {\n measureText = \"<pre>\";\n for (var i = 0; i < 49; ++i) measureText += \"x<br/>\";\n measureText += \"x</pre>\";\n }\n var offsetHeight = lineDiv.clientHeight;\n if (offsetHeight == cachedHeightFor) return cachedHeight;\n cachedHeightFor = offsetHeight;\n measure.innerHTML = measureText;\n cachedHeight = measure.firstChild.offsetHeight / 50 || 1;\n measure.innerHTML = \"\";\n return cachedHeight;\n }\n var cachedWidth, cachedWidthFor = 0;\n function charWidth() {\n if (scroller.clientWidth == cachedWidthFor) return cachedWidth;\n cachedWidthFor = scroller.clientWidth;\n return (cachedWidth = stringWidth(\"x\"));\n }\n function paddingTop() {return lineSpace.offsetTop;}\n function paddingLeft() {return lineSpace.offsetLeft;}\n\n function posFromMouse(e, liberal) {\n var offW = eltOffset(scroller, true), x, y;\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX; y = e.clientY; } catch (e) { return null; }\n // This is a mess of a heuristic to try and determine whether a\n // scroll-bar was clicked or not, and to return null if one was\n // (and !liberal).\n if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))\n return null;\n var offL = eltOffset(lineSpace, true);\n return coordsChar(x - offL.left, y - offL.top);\n }\n function onContextMenu(e) {\n var pos = posFromMouse(e), scrollPos = scrollbar.scrollTop;\n if (!pos || opera) return; // Opera is difficult.\n if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))\n operation(setCursor)(pos.line, pos.ch);\n\n var oldCSS = input.style.cssText;\n inputDiv.style.position = \"absolute\";\n input.style.cssText = \"position: fixed; width: 30px; height: 30px; top: \" + (e.clientY - 5) +\n \"px; left: \" + (e.clientX - 5) + \"px; z-index: 1000; background: white; \" +\n \"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n leaveInputAlone = true;\n var val = input.value = getSelection();\n focusInput();\n selectInput(input);\n function rehide() {\n var newVal = splitLines(input.value).join(\"\\n\");\n if (newVal != val && !options.readOnly) operation(replaceSelection)(newVal, \"end\");\n inputDiv.style.position = \"relative\";\n input.style.cssText = oldCSS;\n if (ie_lt9) scrollbar.scrollTop = scrollPos;\n leaveInputAlone = false;\n resetInput(true);\n slowPoll();\n }\n\n if (gecko) {\n e_stop(e);\n var mouseup = connect(window, \"mouseup\", function() {\n mouseup();\n setTimeout(rehide, 20);\n }, true);\n } else {\n setTimeout(rehide, 50);\n }\n }\n\n // Cursor-blinking\n function restartBlink() {\n clearInterval(blinker);\n var on = true;\n cursor.style.visibility = \"\";\n blinker = setInterval(function() {\n cursor.style.visibility = (on = !on) ? \"\" : \"hidden\";\n }, 650);\n }\n\n var matching = {\"(\": \")>\", \")\": \"(<\", \"[\": \"]>\", \"]\": \"[<\", \"{\": \"}>\", \"}\": \"{<\"};\n function matchBrackets(autoclear) {\n var head = sel.inverted ? sel.from : sel.to, line = getLine(head.line), pos = head.ch - 1;\n var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];\n if (!match) return;\n var ch = match.charAt(0), forward = match.charAt(1) == \">\", d = forward ? 1 : -1, st = line.styles;\n for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)\n if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}\n\n var stack = [line.text.charAt(pos)], re = /[(){}[\\]]/;\n function scan(line, from, to) {\n if (!line.text) return;\n var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;\n for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {\n var text = st[i];\n if (st[i+1] != style) {pos += d * text.length; continue;}\n for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {\n if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {\n var match = matching[cur];\n if (match.charAt(1) == \">\" == forward) stack.push(cur);\n else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};\n else if (!stack.length) return {pos: pos, match: true};\n }\n }\n }\n }\n for (var i = head.line, e = forward ? Math.min(i + 100, doc.size) : Math.max(-1, i - 100); i != e; i+=d) {\n var line = getLine(i), first = i == head.line;\n var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);\n if (found) break;\n }\n if (!found) found = {pos: null, match: false};\n var style = found.match ? \"CodeMirror-matchingbracket\" : \"CodeMirror-nonmatchingbracket\";\n var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),\n two = found.pos != null && markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style);\n var clear = operation(function(){one.clear(); two && two.clear();});\n if (autoclear) setTimeout(clear, 800);\n else bracketHighlighted = clear;\n }\n\n // Finds the line to start with when starting a parse. Tries to\n // find a line with a stateAfter, so that it can start with a\n // valid state. If that fails, it returns the line with the\n // smallest indentation, which tends to need the least context to\n // parse correctly.\n function findStartLine(n) {\n var minindent, minline;\n for (var search = n, lim = n - 40; search > lim; --search) {\n if (search == 0) return 0;\n var line = getLine(search-1);\n if (line.stateAfter) return search;\n var indented = line.indentation(options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline;\n }\n function getStateBefore(n) {\n var start = findStartLine(n), state = start && getLine(start-1).stateAfter;\n if (!state) state = startState(mode);\n else state = copyState(mode, state);\n doc.iter(start, n, function(line) {\n line.highlight(mode, state, options.tabSize);\n line.stateAfter = copyState(mode, state);\n });\n if (start < n) changes.push({from: start, to: n});\n if (n < doc.size && !getLine(n).stateAfter) work.push(n);\n return state;\n }\n function highlightLines(start, end) {\n var state = getStateBefore(start);\n doc.iter(start, end, function(line) {\n line.highlight(mode, state, options.tabSize);\n line.stateAfter = copyState(mode, state);\n });\n }\n function highlightWorker() {\n var end = +new Date + options.workTime;\n var foundWork = work.length;\n while (work.length) {\n if (!getLine(showingFrom).stateAfter) var task = showingFrom;\n else var task = work.pop();\n if (task >= doc.size) continue;\n var start = findStartLine(task), state = start && getLine(start-1).stateAfter;\n if (state) state = copyState(mode, state);\n else state = startState(mode);\n\n var unchanged = 0, compare = mode.compareStates, realChange = false,\n i = start, bail = false;\n doc.iter(i, doc.size, function(line) {\n var hadState = line.stateAfter;\n if (+new Date > end) {\n work.push(i);\n startWorker(options.workDelay);\n if (realChange) changes.push({from: task, to: i + 1});\n return (bail = true);\n }\n var changed = line.highlight(mode, state, options.tabSize);\n if (changed) realChange = true;\n line.stateAfter = copyState(mode, state);\n var done = null;\n if (compare) {\n var same = hadState && compare(hadState, state);\n if (same != Pass) done = !!same;\n }\n if (done == null) {\n if (changed !== false || !hadState) unchanged = 0;\n else if (++unchanged > 3 && (!mode.indent || mode.indent(hadState, \"\") == mode.indent(state, \"\")))\n done = true;\n }\n if (done) return true;\n ++i;\n });\n if (bail) return;\n if (realChange) changes.push({from: task, to: i + 1});\n }\n if (foundWork && options.onHighlightComplete)\n options.onHighlightComplete(instance);\n }\n function startWorker(time) {\n if (!work.length) return;\n highlight.set(time, operation(highlightWorker));\n }\n\n // Operations are used to wrap changes in such a way that each\n // change won't have to update the cursor and display (which would\n // be awkward, slow, and error-prone), but instead updates are\n // batched and then all combined and executed at once.\n function startOperation() {\n updateInput = userSelChange = textChanged = null;\n changes = []; selectionChanged = false; callbacks = [];\n }\n function endOperation() {\n if (updateMaxLine) computeMaxLength();\n if (maxLineChanged && !options.lineWrapping) {\n widthForcer.style.left = stringWidth(maxLine) + \"px\";\n maxLineChanged = false;\n }\n var newScrollPos, updated;\n if (selectionChanged) {\n var coords = calculateCursorCoords();\n newScrollPos = calculateScrollPos(coords.x, coords.y, coords.x, coords.yBot);\n }\n if (changes.length) updated = updateDisplay(changes, true, (newScrollPos ? newScrollPos.scrollTop : null));\n else {\n if (selectionChanged) updateSelection();\n if (gutterDirty) updateGutter();\n }\n if (newScrollPos) scrollCursorIntoView();\n if (selectionChanged) {scrollEditorIntoView(); restartBlink();}\n\n if (focused && !leaveInputAlone &&\n (updateInput === true || (updateInput !== false && selectionChanged)))\n resetInput(userSelChange);\n\n if (selectionChanged && options.matchBrackets)\n setTimeout(operation(function() {\n if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}\n if (posEq(sel.from, sel.to)) matchBrackets(false);\n }), 20);\n var sc = selectionChanged, cbs = callbacks; // these can be reset by callbacks\n if (textChanged && options.onChange && instance)\n options.onChange(instance, textChanged);\n if (sc && options.onCursorActivity)\n options.onCursorActivity(instance);\n for (var i = 0; i < cbs.length; ++i) cbs[i](instance);\n if (updated && options.onUpdate) options.onUpdate(instance);\n }\n var nestedOperation = 0;\n function operation(f) {\n return function() {\n if (!nestedOperation++) startOperation();\n try {var result = f.apply(this, arguments);}\n finally {if (!--nestedOperation) endOperation();}\n return result;\n };\n }\n\n function compoundChange(f) {\n history.startCompound();\n try { return f(); } finally { history.endCompound(); }\n }\n\n for (var ext in extensions)\n if (extensions.propertyIsEnumerable(ext) &&\n !instance.propertyIsEnumerable(ext))\n instance[ext] = extensions[ext];\n return instance;\n } // (end of function CodeMirror)", "function CodeMirror(place, givenOptions) {\n // Determine effective options based on given values and defaults.\n var options = {}, defaults = CodeMirror.defaults;\n for (var opt in defaults)\n if (defaults.hasOwnProperty(opt))\n options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];\n\n var targetDocument = options[\"document\"];\n // The element in which the editor lives.\n var wrapper = targetDocument.createElement(\"div\");\n wrapper.className = \"CodeMirror\";\n // This mess creates the base DOM structure for the editor.\n wrapper.innerHTML =\n '<div style=\"overflow: hidden; position: relative; width: 1px; height: 0px;\">' + // Wraps and hides input textarea\n '<textarea style=\"position: absolute; width: 10000px;\" wrap=\"off\" ' +\n 'autocorrect=\"off\" autocapitalize=\"off\"></textarea></div>' +\n '<div class=\"CodeMirror-scroll cm-s-' + options.theme + '\">' +\n '<div style=\"position: relative\">' + // Set to the height of the text, causes scrolling\n '<div style=\"position: absolute; height: 0; width: 0; overflow: hidden;\"></div>' +\n '<div style=\"position: relative\">' + // Moved around its parent to cover visible view\n '<div class=\"CodeMirror-gutter\"><div class=\"CodeMirror-gutter-text\"></div></div>' +\n // Provides positioning relative to (visible) text origin\n '<div class=\"CodeMirror-lines\"><div style=\"position: relative\" draggable=\"true\">' +\n '<pre class=\"CodeMirror-cursor\">&#160;</pre>' + // Absolutely positioned blinky cursor\n '<div></div>' + // This DIV contains the actual code\n '</div></div></div></div></div>';\n if (place.appendChild) place.appendChild(wrapper); else place(wrapper);\n // I've never seen more elegant code in my life.\n var inputDiv = wrapper.firstChild, input = inputDiv.firstChild,\n scroller = wrapper.lastChild, code = scroller.firstChild,\n measure = code.firstChild, mover = measure.nextSibling,\n gutter = mover.firstChild, gutterText = gutter.firstChild,\n lineSpace = gutter.nextSibling.firstChild,\n cursor = lineSpace.firstChild, lineDiv = cursor.nextSibling;\n if (options.tabindex != null) input.tabindex = options.tabindex;\n if (!options.gutter && !options.lineNumbers) gutter.style.display = \"none\";\n\n // Check for problem with IE innerHTML not working when we have a\n // P (or similar) parent node.\n try { stringWidth(\"x\"); }\n catch (e) {\n if (e.message.match(/unknown runtime/i))\n e = new Error(\"A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)\");\n throw e;\n }\n\n // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.\n var poll = new Delayed(), highlight = new Delayed(), blinker;\n\n // mode holds a mode API object. lines an array of Line objects\n // (see Line constructor), work an array of lines that should be\n // parsed, and history the undo history (instance of History\n // constructor).\n var mode, lines = [new Line(\"\")], work, focused;\n loadMode();\n // The selection. These are always maintained to point at valid\n // positions. Inverted is used to remember that the user is\n // selecting bottom-to-top.\n var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};\n // Selection-related flags. shiftSelecting obviously tracks\n // whether the user is holding shift. reducedSelection is a hack\n // to get around the fact that we can't create inverted\n // selections. See below.\n var shiftSelecting, reducedSelection, lastClick, lastDoubleClick, draggingText;\n // Variables used by startOperation/endOperation to track what\n // happened during the operation.\n var updateInput, changes, textChanged, selectionChanged, leaveInputAlone, gutterDirty;\n // Current visible range (may be bigger than the view window).\n var showingFrom = 0, showingTo = 0, lastHeight = 0, curKeyId = null;\n // editing will hold an object describing the things we put in the\n // textarea, to help figure out whether something changed.\n // bracketHighlighted is used to remember that a backet has been\n // marked.\n var editing, bracketHighlighted;\n // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n var maxLine = \"\", maxWidth;\n\n // Initialize the content.\n operation(function(){setValue(options.value || \"\"); updateInput = false;})();\n var history = new History();\n\n // Register our event handlers.\n connect(scroller, \"mousedown\", operation(onMouseDown));\n connect(scroller, \"dblclick\", operation(onDoubleClick));\n connect(lineSpace, \"dragstart\", onDragStart);\n // Gecko browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for Gecko.\n if (!gecko) connect(scroller, \"contextmenu\", onContextMenu);\n connect(scroller, \"scroll\", function() {\n updateDisplay([]);\n if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + \"px\";\n if (options.onScroll) options.onScroll(instance);\n });\n connect(window, \"resize\", function() {updateDisplay(true);});\n connect(input, \"keyup\", operation(onKeyUp));\n connect(input, \"input\", function() {fastPoll(curKeyId);});\n connect(input, \"keydown\", operation(onKeyDown));\n connect(input, \"keypress\", operation(onKeyPress));\n connect(input, \"focus\", onFocus);\n connect(input, \"blur\", onBlur);\n\n connect(scroller, \"dragenter\", e_stop);\n connect(scroller, \"dragover\", e_stop);\n connect(scroller, \"drop\", operation(onDrop));\n connect(scroller, \"paste\", function(){focusInput(); fastPoll();});\n connect(input, \"paste\", function(){fastPoll();});\n connect(input, \"cut\", function(){fastPoll();});\n\n // IE throws unspecified error in certain cases, when\n // trying to access activeElement before onload\n var hasFocus; try { hasFocus = (targetDocument.activeElement == input); } catch(e) { }\n if (hasFocus) setTimeout(onFocus, 20);\n else onBlur();\n\n function isLine(l) {return l >= 0 && l < lines.length;}\n // The instance object that we'll return. Mostly calls out to\n // local functions in the CodeMirror function. Some do some extra\n // range checking and/or clipping. operation is used to wrap the\n // call so that changes it makes are tracked, and the display is\n // updated afterwards.\n var instance = wrapper.CodeMirror = {\n getValue: getValue,\n setValue: operation(setValue),\n getSelection: getSelection,\n replaceSelection: operation(replaceSelection),\n focus: function(){focusInput(); onFocus(); fastPoll();},\n setOption: function(option, value) {\n options[option] = value;\n if (option == \"lineNumbers\" || option == \"gutter\" || option == \"firstLineNumber\")\n operation(gutterChanged)();\n else if (option == \"mode\" || option == \"indentUnit\") loadMode();\n else if (option == \"readOnly\" && value == \"nocursor\") input.blur();\n else if (option == \"theme\") scroller.className = scroller.className.replace(/cm-s-\\w+/, \"cm-s-\" + value);\n },\n getOption: function(option) {return options[option];},\n undo: operation(undo),\n redo: operation(redo),\n indentLine: operation(function(n, dir) {\n if (isLine(n)) indentLine(n, dir == null ? \"smart\" : dir ? \"add\" : \"subtract\");\n }),\n historySize: function() {return {undo: history.done.length, redo: history.undone.length};},\n clearHistory: function() {history = new History();},\n matchBrackets: operation(function(){matchBrackets(true);}),\n getTokenAt: function(pos) {\n pos = clipPos(pos);\n return lines[pos.line].getTokenAt(mode, getStateBefore(pos.line), pos.ch);\n },\n getStateAfter: function(line) {\n line = clipLine(line == null ? lines.length - 1: line);\n return getStateBefore(line + 1);\n },\n cursorCoords: function(start){\n if (start == null) start = sel.inverted;\n return pageCoords(start ? sel.from : sel.to);\n },\n charCoords: function(pos){return pageCoords(clipPos(pos));},\n coordsChar: function(coords) {\n var off = eltOffset(lineSpace);\n var line = clipLine(Math.min(lines.length - 1, showingFrom + Math.floor((coords.y - off.top) / lineHeight())));\n return clipPos({line: line, ch: charFromX(clipLine(line), coords.x - off.left)});\n },\n getSearchCursor: function(query, pos, caseFold) {return new SearchCursor(query, pos, caseFold);},\n markText: operation(markText),\n setMarker: operation(addGutterMarker),\n clearMarker: operation(removeGutterMarker),\n setLineClass: operation(setLineClass),\n lineInfo: lineInfo,\n addWidget: function(pos, node, scroll, vert, horiz) {\n pos = localCoords(clipPos(pos));\n var top = pos.yBot, left = pos.x;\n node.style.position = \"absolute\";\n code.appendChild(node);\n if (vert == \"over\") top = pos.y;\n else if (vert == \"near\") {\n var vspace = Math.max(scroller.offsetHeight, lines.length * lineHeight()),\n hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft();\n if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)\n top = pos.y - node.offsetHeight;\n if (left + node.offsetWidth > hspace)\n left = hspace - node.offsetWidth;\n }\n node.style.top = (top + paddingTop()) + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = code.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") left = 0;\n else if (horiz == \"middle\") left = (code.clientWidth - node.offsetWidth) / 2;\n node.style.left = (left + paddingLeft()) + \"px\";\n }\n if (scroll)\n scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);\n },\n\n lineCount: function() {return lines.length;},\n getCursor: function(start) {\n if (start == null) start = sel.inverted;\n return copyPos(start ? sel.from : sel.to);\n },\n somethingSelected: function() {return !posEq(sel.from, sel.to);},\n setCursor: operation(function(line, ch) {\n if (ch == null && typeof line.line == \"number\") setCursor(line.line, line.ch);\n else setCursor(line, ch);\n }),\n setSelection: operation(function(from, to) {setSelection(clipPos(from), clipPos(to || from));}),\n getLine: function(line) {if (isLine(line)) return lines[line].text;},\n setLine: operation(function(line, text) {\n if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: lines[line].text.length});\n }),\n removeLine: operation(function(line) {\n if (isLine(line)) replaceRange(\"\", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));\n }),\n replaceRange: operation(replaceRange),\n getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},\n\n coordsFromIndex: function(index) { \n var total = lines.length, pos = 0, line, ch, len;\n \n for (line = 0; line < total; line++) {\n len = lines[line].text.length + 1;\n if (pos + len > index) { ch = index - pos; break; }\n pos += len;\n }\n return clipPos({line: line, ch: ch});\n },\n\n operation: function(f){return operation(f)();},\n refresh: function(){updateDisplay(true);},\n getInputField: function(){return input;},\n getWrapperElement: function(){return wrapper;},\n getScrollerElement: function(){return scroller;},\n getGutterElement: function(){return gutter;}\n };\n\n function setValue(code) {\n var top = {line: 0, ch: 0};\n updateLines(top, {line: lines.length - 1, ch: lines[lines.length-1].text.length},\n splitLines(code), top, top);\n updateInput = true;\n }\n function getValue(code) {\n var text = [];\n for (var i = 0, l = lines.length; i < l; ++i)\n text.push(lines[i].text);\n return text.join(\"\\n\");\n }\n\n function onMouseDown(e) {\n // Check whether this is a click in a widget\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == code && n != mover) return;\n\n // First, see if this is a click in the gutter\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == gutterText) {\n if (options.onGutterClick)\n options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e);\n return e_preventDefault(e);\n }\n\n var start = posFromMouse(e);\n\n switch (e_button(e)) {\n case 3:\n if (gecko && !mac) onContextMenu(e);\n return;\n case 2:\n if (start) setCursor(start.line, start.ch, true);\n return;\n }\n // For button 1, if it was clicked inside the editor\n // (posFromMouse returning non-null), we have to adjust the\n // selection.\n if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}\n\n if (!focused) onFocus();\n\n var now = +new Date;\n if (lastDoubleClick > now - 400) {\n e_preventDefault(e);\n return selectLine(start.line);\n } else if (lastClick > now - 400) {\n lastDoubleClick = now;\n e_preventDefault(e);\n return selectWordAt(start);\n } else { lastClick = now; }\n\n var last = start, going;\n if (dragAndDrop && !posEq(sel.from, sel.to) &&\n !posLess(start, sel.from) && !posLess(sel.to, start)) {\n // Let the drag handler handle this.\n var up = connect(targetDocument, \"mouseup\", operation(function(e2) {\n draggingText = false;\n up();\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2);\n setCursor(start.line, start.ch, true);\n focusInput();\n }\n }), true);\n draggingText = true;\n return;\n }\n e_preventDefault(e);\n setCursor(start.line, start.ch, true);\n\n function extend(e) {\n var cur = posFromMouse(e, true);\n if (cur && !posEq(cur, last)) {\n if (!focused) onFocus();\n last = cur;\n setSelectionUser(start, cur);\n updateInput = false;\n var visible = visibleLines();\n if (cur.line >= visible.to || cur.line < visible.from)\n going = setTimeout(operation(function(){extend(e);}), 150);\n }\n }\n\n var move = connect(targetDocument, \"mousemove\", operation(function(e) {\n clearTimeout(going);\n e_preventDefault(e);\n extend(e);\n }), true);\n var up = connect(targetDocument, \"mouseup\", operation(function(e) {\n clearTimeout(going);\n var cur = posFromMouse(e);\n if (cur) setSelectionUser(start, cur);\n e_preventDefault(e);\n focusInput();\n updateInput = true;\n move(); up();\n }), true);\n }\n function onDoubleClick(e) {\n var start = posFromMouse(e);\n if (!start) return;\n lastDoubleClick = +new Date;\n e_preventDefault(e);\n selectWordAt(start);\n }\n function onDrop(e) {\n e.preventDefault();\n var pos = posFromMouse(e, true), files = e.dataTransfer.files;\n if (!pos || options.readOnly) return;\n if (files && files.length && window.FileReader && window.File) {\n function loadFile(file, i) {\n var reader = new FileReader;\n reader.onload = function() {\n text[i] = reader.result;\n if (++read == n) {\n\t pos = clipPos(pos);\n\t var end = replaceRange(text.join(\"\"), pos, pos);\n\t setSelectionUser(pos, end);\n\t }\n };\n reader.readAsText(file);\n }\n var n = files.length, text = Array(n), read = 0;\n for (var i = 0; i < n; ++i) loadFile(files[i], i);\n }\n else {\n try {\n var text = e.dataTransfer.getData(\"Text\");\n if (text) {\n\t var end = replaceRange(text, pos, pos);\n\t var curFrom = sel.from, curTo = sel.to;\n\t setSelectionUser(pos, end);\n if (draggingText) replaceRange(\"\", curFrom, curTo);\n\t focusInput();\n\t }\n }\n catch(e){}\n }\n }\n function onDragStart(e) {\n var txt = getSelection();\n // This will reset escapeElement\n htmlEscape(txt);\n e.dataTransfer.setDragImage(escapeElement, 0, 0);\n e.dataTransfer.setData(\"Text\", txt);\n }\n function onKeyDown(e) {\n if (!focused) onFocus();\n\n var code = e.keyCode;\n // IE does strange things with escape.\n if (ie && code == 27) { e.returnValue = false; }\n // Tries to detect ctrl on non-mac, cmd on mac.\n var mod = (mac ? e.metaKey : e.ctrlKey) && !e.altKey, anyMod = e.ctrlKey || e.altKey || e.metaKey;\n if (code == 16 || e.shiftKey) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);\n else shiftSelecting = null;\n // First give onKeyEvent option a chance to handle this.\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n\n if (code == 33 || code == 34) {scrollPage(code == 34); return e_preventDefault(e);} // page up/down\n if (mod && ((code == 36 || code == 35) || // ctrl-home/end\n mac && (code == 38 || code == 40))) { // cmd-up/down\n scrollEnd(code == 36 || code == 38); return e_preventDefault(e);\n }\n if (mod && code == 65) {selectAll(); return e_preventDefault(e);} // ctrl-a\n if (!options.readOnly) {\n if (!anyMod && code == 13) {return;} // enter\n if (!anyMod && code == 9 && handleTab(e.shiftKey)) return e_preventDefault(e); // tab\n if (mod && code == 90) {undo(); return e_preventDefault(e);} // ctrl-z\n if (mod && ((e.shiftKey && code == 90) || code == 89)) {redo(); return e_preventDefault(e);} // ctrl-shift-z, ctrl-y\n }\n if (code == 36) { if (options.smartHome) { smartHome(); return e_preventDefault(e); } }\n\n // Key id to use in the movementKeys map. We also pass it to\n // fastPoll in order to 'self learn'. We need this because\n // reducedSelection, the hack where we collapse the selection to\n // its start when it is inverted and a movement key is pressed\n // (and later restore it again), shouldn't be used for\n // non-movement keys.\n curKeyId = (mod ? \"c\" : \"\") + (e.altKey ? \"a\" : \"\") + code;\n if (sel.inverted && movementKeys[curKeyId] === true) {\n var range = selRange(input);\n if (range) {\n reducedSelection = {anchor: range.start};\n setSelRange(input, range.start, range.start);\n }\n }\n // Don't save the key as a movementkey unless it had a modifier\n if (!mod && !e.altKey) curKeyId = null;\n fastPoll(curKeyId);\n }\n function onKeyUp(e) {\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n if (reducedSelection) {\n reducedSelection = null;\n updateInput = true;\n }\n if (e.keyCode == 16) shiftSelecting = null;\n }\n function onKeyPress(e) {\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n if (options.electricChars && mode.electricChars) {\n var ch = String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode);\n if (mode.electricChars.indexOf(ch) > -1)\n setTimeout(operation(function() {indentLine(sel.to.line, \"smart\");}), 50);\n }\n var code = e.keyCode;\n // Re-stop tab and enter. Necessary on some browsers.\n if (code == 13) {if (!options.readOnly) handleEnter(); e_preventDefault(e);}\n else if (!e.ctrlKey && !e.altKey && !e.metaKey && code == 9 && options.tabMode != \"default\") e_preventDefault(e);\n else fastPoll(curKeyId);\n }\n\n function onFocus() {\n if (options.readOnly == \"nocursor\") return;\n if (!focused) {\n if (options.onFocus) options.onFocus(instance);\n focused = true;\n if (wrapper.className.search(/\\bCodeMirror-focused\\b/) == -1)\n wrapper.className += \" CodeMirror-focused\";\n if (!leaveInputAlone) prepareInput();\n }\n slowPoll();\n restartBlink();\n }\n function onBlur() {\n if (focused) {\n if (options.onBlur) options.onBlur(instance);\n focused = false;\n wrapper.className = wrapper.className.replace(\" CodeMirror-focused\", \"\");\n }\n clearInterval(blinker);\n setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);\n }\n\n // Replace the range from from to to by the strings in newText.\n // Afterwards, set the selection to selFrom, selTo.\n function updateLines(from, to, newText, selFrom, selTo) {\n if (history) {\n var old = [];\n for (var i = from.line, e = to.line + 1; i < e; ++i) old.push(lines[i].text);\n history.addChange(from.line, newText.length, old);\n while (history.done.length > options.undoDepth) history.done.shift();\n }\n updateLinesNoUndo(from, to, newText, selFrom, selTo);\n }\n function unredoHelper(from, to) {\n var change = from.pop();\n if (change) {\n var replaced = [], end = change.start + change.added;\n for (var i = change.start; i < end; ++i) replaced.push(lines[i].text);\n to.push({start: change.start, added: change.old.length, old: replaced});\n var pos = clipPos({line: change.start + change.old.length - 1,\n ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])});\n updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: lines[end-1].text.length}, change.old, pos, pos);\n updateInput = true;\n }\n }\n function undo() {unredoHelper(history.done, history.undone);}\n function redo() {unredoHelper(history.undone, history.done);}\n\n function updateLinesNoUndo(from, to, newText, selFrom, selTo) {\n var recomputeMaxLength = false, maxLineLength = maxLine.length;\n for (var i = from.line; i <= to.line; ++i) {\n if (lines[i].text.length == maxLineLength) {recomputeMaxLength = true; break;}\n }\n\n var nlines = to.line - from.line, firstLine = lines[from.line], lastLine = lines[to.line];\n // First adjust the line structure, taking some care to leave highlighting intact.\n if (firstLine == lastLine) {\n if (newText.length == 1)\n firstLine.replace(from.ch, to.ch, newText[0]);\n else {\n lastLine = firstLine.split(to.ch, newText[newText.length-1]);\n var spliceargs = [from.line + 1, nlines];\n firstLine.replace(from.ch, null, newText[0]);\n for (var i = 1, e = newText.length - 1; i < e; ++i)\n spliceargs.push(Line.inheritMarks(newText[i], firstLine));\n spliceargs.push(lastLine);\n lines.splice.apply(lines, spliceargs);\n }\n }\n else if (newText.length == 1) {\n firstLine.replace(from.ch, null, newText[0]);\n lastLine.replace(null, to.ch, \"\");\n firstLine.append(lastLine);\n lines.splice(from.line + 1, nlines);\n }\n else {\n var spliceargs = [from.line + 1, nlines - 1];\n firstLine.replace(from.ch, null, newText[0]);\n lastLine.replace(null, to.ch, newText[newText.length-1]);\n for (var i = 1, e = newText.length - 1; i < e; ++i)\n spliceargs.push(Line.inheritMarks(newText[i], firstLine));\n lines.splice.apply(lines, spliceargs);\n }\n\n\n for (var i = from.line, e = i + newText.length; i < e; ++i) {\n var l = lines[i].text;\n if (l.length > maxLineLength) {\n maxLine = l; maxLineLength = l.length; maxWidth = null;\n recomputeMaxLength = false;\n }\n }\n if (recomputeMaxLength) {\n maxLineLength = 0; maxLine = \"\"; maxWidth = null;\n for (var i = 0, e = lines.length; i < e; ++i) {\n var l = lines[i].text;\n if (l.length > maxLineLength) {\n maxLineLength = l.length; maxLine = l;\n }\n }\n }\n\n // Add these lines to the work array, so that they will be\n // highlighted. Adjust work lines if lines were added/removed.\n var newWork = [], lendiff = newText.length - nlines - 1;\n for (var i = 0, l = work.length; i < l; ++i) {\n var task = work[i];\n if (task < from.line) newWork.push(task);\n else if (task > to.line) newWork.push(task + lendiff);\n }\n if (newText.length < 5) {\n highlightLines(from.line, from.line + newText.length);\n newWork.push(from.line + newText.length);\n } else {\n newWork.push(from.line);\n }\n work = newWork;\n startWorker(100);\n // Remember that these lines changed, for updating the display\n changes.push({from: from.line, to: to.line + 1, diff: lendiff});\n textChanged = {from: from, to: to, text: newText};\n\n // Update the selection\n function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}\n setSelection(selFrom, selTo, updateLine(sel.from.line), updateLine(sel.to.line));\n\n // Make sure the scroll-size div has the correct height.\n code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + \"px\";\n }\n\n function replaceRange(code, from, to) {\n from = clipPos(from);\n if (!to) to = from; else to = clipPos(to);\n code = splitLines(code);\n function adjustPos(pos) {\n if (posLess(pos, from)) return pos;\n if (!posLess(to, pos)) return end;\n var line = pos.line + code.length - (to.line - from.line) - 1;\n var ch = pos.ch;\n if (pos.line == to.line)\n ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));\n return {line: line, ch: ch};\n }\n var end;\n replaceRange1(code, from, to, function(end1) {\n end = end1;\n return {from: adjustPos(sel.from), to: adjustPos(sel.to)};\n });\n return end;\n }\n function replaceSelection(code, collapse) {\n replaceRange1(splitLines(code), sel.from, sel.to, function(end) {\n if (collapse == \"end\") return {from: end, to: end};\n else if (collapse == \"start\") return {from: sel.from, to: sel.from};\n else return {from: sel.from, to: end};\n });\n }\n function replaceRange1(code, from, to, computeSel) {\n var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;\n var newSel = computeSel({line: from.line + code.length - 1, ch: endch});\n updateLines(from, to, code, newSel.from, newSel.to);\n }\n\n function getRange(from, to) {\n var l1 = from.line, l2 = to.line;\n if (l1 == l2) return lines[l1].text.slice(from.ch, to.ch);\n var code = [lines[l1].text.slice(from.ch)];\n for (var i = l1 + 1; i < l2; ++i) code.push(lines[i].text);\n code.push(lines[l2].text.slice(0, to.ch));\n return code.join(\"\\n\");\n }\n function getSelection() {\n return getRange(sel.from, sel.to);\n }\n\n var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll\n function slowPoll() {\n if (pollingFast) return;\n poll.set(2000, function() {\n startOperation();\n readInput();\n if (focused) slowPoll();\n endOperation();\n });\n }\n function fastPoll(keyId) {\n var missed = false;\n pollingFast = true;\n function p() {\n startOperation();\n var changed = readInput();\n if (changed && keyId) {\n if (changed == \"moved\" && movementKeys[keyId] == null) movementKeys[keyId] = true;\n if (changed == \"changed\") movementKeys[keyId] = false;\n }\n if (!changed && !missed) {missed = true; poll.set(80, p);}\n else {pollingFast = false; slowPoll();}\n endOperation();\n }\n poll.set(20, p);\n }\n\n // Inspects the textarea, compares its state (content, selection)\n // to the data in the editing variable, and updates the editor\n // content or cursor if something changed.\n function readInput() {\n if (leaveInputAlone || !focused) return;\n var changed = false, text = input.value, sr = selRange(input);\n if (!sr) return false;\n var changed = editing.text != text, rs = reducedSelection;\n var moved = changed || sr.start != editing.start || sr.end != (rs ? editing.start : editing.end);\n if (!moved && !rs) return false;\n if (changed) {\n shiftSelecting = reducedSelection = null;\n if (options.readOnly) {updateInput = true; return \"changed\";}\n }\n\n // Compute selection start and end based on start/end offsets in textarea\n function computeOffset(n, startLine) {\n var pos = 0;\n for (;;) {\n var found = text.indexOf(\"\\n\", pos);\n if (found == -1 || (text.charAt(found-1) == \"\\r\" ? found - 1 : found) >= n)\n return {line: startLine, ch: n - pos};\n ++startLine;\n pos = found + 1;\n }\n }\n var from = computeOffset(sr.start, editing.from),\n to = computeOffset(sr.end, editing.from);\n // Here we have to take the reducedSelection hack into account,\n // so that you can, for example, press shift-up at the start of\n // your selection and have the right thing happen.\n if (rs) {\n var head = sr.start == rs.anchor ? to : from;\n var tail = shiftSelecting ? sel.to : sr.start == rs.anchor ? from : to;\n if (sel.inverted = posLess(head, tail)) { from = head; to = tail; }\n else { reducedSelection = null; from = tail; to = head; }\n }\n\n // In some cases (cursor on same line as before), we don't have\n // to update the textarea content at all.\n if (from.line == to.line && from.line == sel.from.line && from.line == sel.to.line && !shiftSelecting)\n updateInput = false;\n\n // Magic mess to extract precise edited range from the changed\n // string.\n if (changed) {\n var start = 0, end = text.length, len = Math.min(end, editing.text.length);\n var c, line = editing.from, nl = -1;\n while (start < len && (c = text.charAt(start)) == editing.text.charAt(start)) {\n ++start;\n if (c == \"\\n\") {line++; nl = start;}\n }\n var ch = nl > -1 ? start - nl : start, endline = editing.to - 1, edend = editing.text.length;\n for (;;) {\n c = editing.text.charAt(edend);\n if (text.charAt(end) != c) {++end; ++edend; break;}\n if (c == \"\\n\") endline--;\n if (edend <= start || end <= start) break;\n --end; --edend;\n }\n var nl = editing.text.lastIndexOf(\"\\n\", edend - 1), endch = nl == -1 ? edend : edend - nl - 1;\n updateLines({line: line, ch: ch}, {line: endline, ch: endch}, splitLines(text.slice(start, end)), from, to);\n if (line != endline || from.line != line) updateInput = true;\n }\n else setSelection(from, to);\n\n editing.text = text; editing.start = sr.start; editing.end = sr.end;\n return changed ? \"changed\" : moved ? \"moved\" : false;\n }\n\n // Set the textarea content and selection range to match the\n // editor state.\n function prepareInput() {\n var text = [];\n var from = Math.max(0, sel.from.line - 1), to = Math.min(lines.length, sel.to.line + 2);\n for (var i = from; i < to; ++i) text.push(lines[i].text);\n text = input.value = text.join(lineSep);\n var startch = sel.from.ch, endch = sel.to.ch;\n for (var i = from; i < sel.from.line; ++i)\n startch += lineSep.length + lines[i].text.length;\n for (var i = from; i < sel.to.line; ++i)\n endch += lineSep.length + lines[i].text.length;\n editing = {text: text, from: from, to: to, start: startch, end: endch};\n setSelRange(input, startch, reducedSelection ? startch : endch);\n }\n function focusInput() {\n if (options.readOnly != \"nocursor\") input.focus();\n }\n\n function scrollEditorIntoView() {\n if (!cursor.getBoundingClientRect) return;\n var rect = cursor.getBoundingClientRect();\n var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);\n if (rect.top < 0 || rect.bottom > winH) cursor.scrollIntoView();\n }\n function scrollCursorIntoView() {\n var cursor = localCoords(sel.inverted ? sel.from : sel.to);\n return scrollIntoView(cursor.x, cursor.y, cursor.x, cursor.yBot);\n }\n function scrollIntoView(x1, y1, x2, y2) {\n var pl = paddingLeft(), pt = paddingTop(), lh = lineHeight();\n y1 += pt; y2 += pt; x1 += pl; x2 += pl;\n var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true;\n if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1 - 2*lh); scrolled = true;}\n else if (y2 > screentop + screen) {scroller.scrollTop = y2 + lh - screen; scrolled = true;}\n\n var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;\n var gutterw = options.fixedGutter ? gutter.clientWidth : 0;\n if (x1 < screenleft + gutterw) {\n if (x1 < 50) x1 = 0;\n scroller.scrollLeft = Math.max(0, x1 - 10 - gutterw);\n scrolled = true;\n }\n else if (x2 > screenw + screenleft) {\n scroller.scrollLeft = x2 + 10 - screenw;\n scrolled = true;\n if (x2 > code.clientWidth) result = false;\n }\n if (scrolled && options.onScroll) options.onScroll(instance);\n return result;\n }\n\n function visibleLines() {\n var lh = lineHeight(), top = scroller.scrollTop - paddingTop();\n return {from: Math.min(lines.length, Math.max(0, Math.floor(top / lh))),\n to: Math.min(lines.length, Math.ceil((top + scroller.clientHeight) / lh))};\n }\n // Uses a set of changes plus the current scroll position to\n // determine which DOM updates have to be made, and makes the\n // updates.\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 }\n\n function refreshDisplay(from, to) {\n var html = [], start = {line: from, ch: 0}, inSel = posLess(sel.from, start) && !posLess(sel.to, start);\n for (var i = from; i < to; ++i) {\n var ch1 = null, ch2 = null;\n if (inSel) {\n ch1 = 0;\n if (sel.to.line == i) {inSel = false; ch2 = sel.to.ch;}\n }\n else if (sel.from.line == i) {\n if (sel.to.line == i) {ch1 = sel.from.ch; ch2 = sel.to.ch;}\n else {inSel = true; ch1 = sel.from.ch;}\n }\n html.push(lines[i].getHTML(ch1, ch2, true));\n }\n lineDiv.innerHTML = html.join(\"\");\n }\n function patchDisplay(updates) {\n // Slightly different algorithm for IE (badInnerHTML), since\n // there .innerHTML on PRE nodes is dumb, and discards\n // whitespace.\n var sfrom = sel.from.line, sto = sel.to.line, off = 0,\n scratch = badInnerHTML && targetDocument.createElement(\"div\");\n for (var i = 0, e = updates.length; i < e; ++i) {\n var rec = updates[i];\n var extra = (rec.to - rec.from) - rec.domSize;\n var nodeAfter = lineDiv.childNodes[rec.domStart + rec.domSize + off] || null;\n if (badInnerHTML)\n for (var j = Math.max(-extra, rec.domSize); j > 0; --j)\n lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild);\n else if (extra) {\n for (var j = Math.max(0, extra); j > 0; --j)\n lineDiv.insertBefore(targetDocument.createElement(\"pre\"), nodeAfter);\n for (var j = Math.max(0, -extra); j > 0; --j)\n lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild);\n }\n var node = lineDiv.childNodes[rec.domStart + off], inSel = sfrom < rec.from && sto >= rec.from;\n for (var j = rec.from; j < rec.to; ++j) {\n var ch1 = null, ch2 = null;\n if (inSel) {\n ch1 = 0;\n if (sto == j) {inSel = false; ch2 = sel.to.ch;}\n }\n else if (sfrom == j) {\n if (sto == j) {ch1 = sel.from.ch; ch2 = sel.to.ch;}\n else {inSel = true; ch1 = sel.from.ch;}\n }\n if (badInnerHTML) {\n scratch.innerHTML = lines[j].getHTML(ch1, ch2, true);\n lineDiv.insertBefore(scratch.firstChild, nodeAfter);\n }\n else {\n node.innerHTML = lines[j].getHTML(ch1, ch2, false);\n node.className = lines[j].className || \"\";\n node = node.nextSibling;\n }\n }\n off += extra;\n }\n }\n\n function updateGutter() {\n if (!options.gutter && !options.lineNumbers) return;\n var hText = mover.offsetHeight, hEditor = scroller.clientHeight;\n gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + \"px\";\n var html = [];\n for (var i = showingFrom; i < Math.max(showingTo, showingFrom + 1); ++i) {\n var marker = lines[i].gutterMarker;\n var text = options.lineNumbers ? i + options.firstLineNumber : null;\n if (marker && marker.text)\n text = marker.text.replace(\"%N%\", text != null ? text : \"\");\n else if (text == null)\n text = \"\\u00a0\";\n html.push((marker && marker.style ? '<pre class=\"' + marker.style + '\">' : \"<pre>\"), text, \"</pre>\");\n }\n gutter.style.display = \"none\";\n gutterText.innerHTML = html.join(\"\");\n var minwidth = String(lines.length).length, firstNode = gutterText.firstChild, val = eltText(firstNode), pad = \"\";\n while (val.length + pad.length < minwidth) pad += \"\\u00a0\";\n if (pad) firstNode.insertBefore(targetDocument.createTextNode(pad), firstNode.firstChild);\n gutter.style.display = \"\";\n lineSpace.style.marginLeft = gutter.offsetWidth + \"px\";\n gutterDirty = false;\n }\n function updateCursor() {\n var head = sel.inverted ? sel.from : sel.to, lh = lineHeight();\n var x = charX(head.line, head.ch);\n var top = head.line * lh - scroller.scrollTop;\n inputDiv.style.top = Math.max(Math.min(top, scroller.offsetHeight), 0) + \"px\";\n inputDiv.style.left = (x - scroller.scrollLeft) + \"px\";\n if (posEq(sel.from, sel.to)) {\n cursor.style.top = (head.line - showingFrom) * lh + \"px\";\n cursor.style.left = x + \"px\";\n cursor.style.display = \"\";\n }\n else cursor.style.display = \"none\";\n }\n\n function setSelectionUser(from, to) {\n var sh = shiftSelecting && clipPos(shiftSelecting);\n if (sh) {\n if (posLess(sh, from)) from = sh;\n else if (posLess(to, sh)) to = sh;\n }\n setSelection(from, to);\n }\n // Update the selection. Last two args are only used by\n // updateLines, since they have to be expressed in the line\n // numbers before the update.\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 }\n function setCursor(line, ch, user) {\n var pos = clipPos({line: line, ch: ch || 0});\n (user ? setSelectionUser : setSelection)(pos, pos);\n }\n\n function clipLine(n) {return Math.max(0, Math.min(n, lines.length-1));}\n function clipPos(pos) {\n if (pos.line < 0) return {line: 0, ch: 0};\n if (pos.line >= lines.length) return {line: lines.length-1, ch: lines[lines.length-1].text.length};\n var ch = pos.ch, linelen = lines[pos.line].text.length;\n if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};\n else if (ch < 0) return {line: pos.line, ch: 0};\n else return pos;\n }\n\n function scrollPage(down) {\n var linesPerPage = Math.floor(scroller.clientHeight / lineHeight()), head = sel.inverted ? sel.from : sel.to;\n setCursor(head.line + (Math.max(linesPerPage - 1, 1) * (down ? 1 : -1)), head.ch, true);\n }\n function scrollEnd(top) {\n var pos = top ? {line: 0, ch: 0} : {line: lines.length - 1, ch: lines[lines.length-1].text.length};\n setSelectionUser(pos, pos);\n }\n function selectAll() {\n var endLine = lines.length - 1;\n setSelection({line: 0, ch: 0}, {line: endLine, ch: lines[endLine].text.length});\n }\n function selectWordAt(pos) {\n var line = lines[pos.line].text;\n var start = pos.ch, end = pos.ch;\n while (start > 0 && /\\w/.test(line.charAt(start - 1))) --start;\n while (end < line.length && /\\w/.test(line.charAt(end))) ++end;\n setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end});\n }\n function selectLine(line) {\n setSelectionUser({line: line, ch: 0}, {line: line, ch: lines[line].text.length});\n }\n function handleEnter() {\n replaceSelection(\"\\n\", \"end\");\n if (options.enterMode != \"flat\")\n indentLine(sel.from.line, options.enterMode == \"keep\" ? \"prev\" : \"smart\");\n }\n function handleTab(shift) {\n function indentSelected(mode) {\n if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);\n var e = sel.to.line - (sel.to.ch ? 0 : 1);\n for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);\n }\n shiftSelecting = null;\n switch (options.tabMode) {\n case \"default\":\n return false;\n case \"indent\":\n indentSelected(\"smart\");\n break;\n case \"classic\":\n if (posEq(sel.from, sel.to)) {\n if (shift) indentLine(sel.from.line, \"smart\");\n else replaceSelection(\"\\t\", \"end\");\n break;\n }\n case \"shift\":\n indentSelected(shift ? \"subtract\" : \"add\");\n break;\n }\n return true;\n }\n function smartHome() {\n var firstNonWS = Math.max(0, lines[sel.from.line].text.search(/\\S/));\n setCursor(sel.from.line, sel.from.ch <= firstNonWS && sel.from.ch ? 0 : firstNonWS, true);\n }\n\n function indentLine(n, how) {\n if (how == \"smart\") {\n if (!mode.indent) how = \"prev\";\n else var state = getStateBefore(n);\n }\n\n var line = lines[n], curSpace = line.indentation(), curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (how == \"prev\") {\n if (n) indentation = lines[n-1].indentation();\n else indentation = 0;\n }\n else if (how == \"smart\") indentation = mode.indent(state, line.text.slice(curSpaceString.length));\n else if (how == \"add\") indentation = curSpace + options.indentUnit;\n else if (how == \"subtract\") indentation = curSpace - options.indentUnit;\n indentation = Math.max(0, indentation);\n var diff = indentation - curSpace;\n\n if (!diff) {\n if (sel.from.line != n && sel.to.line != n) return;\n var indentString = curSpaceString;\n }\n else {\n var indentString = \"\", pos = 0;\n if (options.indentWithTabs)\n for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n while (pos < indentation) {++pos; indentString += \" \";}\n }\n\n replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});\n }\n\n function loadMode() {\n mode = CodeMirror.getMode(options, options.mode);\n for (var i = 0, l = lines.length; i < l; ++i)\n lines[i].stateAfter = null;\n work = [0];\n startWorker();\n }\n function gutterChanged() {\n var visible = options.gutter || options.lineNumbers;\n gutter.style.display = visible ? \"\" : \"none\";\n if (visible) gutterDirty = true;\n else lineDiv.parentNode.style.marginLeft = 0;\n }\n\n function markText(from, to, className) {\n from = clipPos(from); to = clipPos(to);\n var set = [];\n function add(line, from, to, className) {\n mark = lines[line].addMark(from, to, className, set);\n }\n if (from.line == to.line) add(from.line, from.ch, to.ch, className);\n else {\n add(from.line, from.ch, null, className);\n for (var i = from.line + 1, e = to.line; i < e; ++i)\n add(i, 0, null, className);\n add(to.line, 0, to.ch, className);\n }\n changes.push({from: from.line, to: to.line + 1});\n return new TextMarker(set);\n }\n\n function TextMarker(set) { this.set = set; }\n TextMarker.prototype.clear = operation(function() {\n for (var i = 0, e = this.set.length; i < e; ++i) {\n var mk = this.set[i].marked;\n for (var j = 0; j < mk.length; ++j) {\n if (mk[j].set == this.set) mk.splice(j--, 1);\n }\n }\n // We don't know the exact lines that changed. Refreshing is\n // cheaper than finding them.\n changes.push({from: 0, to: lines.length});\n });\n TextMarker.prototype.find = function() {\n var from, to;\n for (var i = 0, e = this.set.length; i < e; ++i) {\n var line = this.set[i], mk = line.marked;\n for (var j = 0; j < mk.length; ++j) {\n var mark = mk[j];\n if (mark.set == this.set) {\n if (mark.from != null || mark.to != null) {\n var found = indexOf(lines, line);\n if (found > -1) {\n if (mark.from != null) from = {line: found, ch: mark.from};\n if (mark.to != null) to = {line: found, ch: mark.to};\n }\n }\n }\n }\n }\n return {from: from, to: to};\n };\n\n function addGutterMarker(line, text, className) {\n if (typeof line == \"number\") line = lines[clipLine(line)];\n line.gutterMarker = {text: text, style: className};\n gutterDirty = true;\n return line;\n }\n function removeGutterMarker(line) {\n if (typeof line == \"number\") line = lines[clipLine(line)];\n line.gutterMarker = null;\n gutterDirty = true;\n }\n function setLineClass(line, className) {\n if (typeof line == \"number\") {\n var no = line;\n line = lines[clipLine(line)];\n }\n else {\n var no = indexOf(lines, line);\n if (no == -1) return null;\n }\n if (line.className != className) {\n line.className = className;\n changes.push({from: no, to: no + 1});\n }\n return line;\n }\n\n function lineInfo(line) {\n if (typeof line == \"number\") {\n var n = line;\n line = lines[line];\n if (!line) return null;\n }\n else {\n var n = indexOf(lines, line);\n if (n == -1) return null;\n }\n var marker = line.gutterMarker;\n return {line: n, text: line.text, markerText: marker && marker.text, markerClass: marker && marker.style};\n }\n\n function stringWidth(str) {\n measure.innerHTML = \"<pre><span>x</span></pre>\";\n measure.firstChild.firstChild.firstChild.nodeValue = str;\n return measure.firstChild.firstChild.offsetWidth || 10;\n }\n // These are used to go from pixel positions to character\n // positions, taking varying character widths into account.\n function charX(line, pos) {\n if (pos == 0) return 0;\n measure.innerHTML = \"<pre><span>\" + lines[line].getHTML(null, null, false, pos) + \"</span></pre>\";\n return measure.firstChild.firstChild.offsetWidth;\n }\n function charFromX(line, x) {\n if (x <= 0) return 0;\n var lineObj = lines[line], text = lineObj.text;\n function getX(len) {\n measure.innerHTML = \"<pre><span>\" + lineObj.getHTML(null, null, false, len) + \"</span></pre>\";\n return measure.firstChild.firstChild.offsetWidth;\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 / stringWidth(\"x\")));\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 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 (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 }\n\n function localCoords(pos, inLineWrap) {\n var lh = lineHeight(), line = pos.line - (inLineWrap ? showingFrom : 0);\n return {x: charX(pos.line, pos.ch), y: line * lh, yBot: (line + 1) * lh};\n }\n function pageCoords(pos) {\n var local = localCoords(pos, true), off = eltOffset(lineSpace);\n return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};\n }\n\n function lineHeight() {\n var nlines = lineDiv.childNodes.length;\n if (nlines) return (lineDiv.offsetHeight / nlines) || 1;\n measure.innerHTML = \"<pre>x</pre>\";\n return measure.firstChild.offsetHeight || 1;\n }\n function paddingTop() {return lineSpace.offsetTop;}\n function paddingLeft() {return lineSpace.offsetLeft;}\n\n function posFromMouse(e, liberal) {\n var offW = eltOffset(scroller, true), x, y;\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX; y = e.clientY; } catch (e) { return null; }\n // This is a mess of a heuristic to try and determine whether a\n // scroll-bar was clicked or not, and to return null if one was\n // (and !liberal).\n if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))\n return null;\n var offL = eltOffset(lineSpace, true);\n var line = showingFrom + Math.floor((y - offL.top) / lineHeight());\n return clipPos({line: line, ch: charFromX(clipLine(line), x - offL.left)});\n }\n function onContextMenu(e) {\n var pos = posFromMouse(e);\n if (!pos || window.opera) return; // Opera is difficult.\n if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))\n operation(setCursor)(pos.line, pos.ch);\n\n var oldCSS = input.style.cssText;\n inputDiv.style.position = \"absolute\";\n input.style.cssText = \"position: fixed; width: 30px; height: 30px; top: \" + (e.clientY - 5) +\n \"px; left: \" + (e.clientX - 5) + \"px; z-index: 1000; background: white; \" +\n \"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n leaveInputAlone = true;\n var val = input.value = getSelection();\n focusInput();\n setSelRange(input, 0, input.value.length);\n function rehide() {\n var newVal = splitLines(input.value).join(\"\\n\");\n if (newVal != val) operation(replaceSelection)(newVal, \"end\");\n inputDiv.style.position = \"relative\";\n input.style.cssText = oldCSS;\n leaveInputAlone = false;\n prepareInput();\n slowPoll();\n }\n\n if (gecko) {\n e_stop(e);\n var mouseup = connect(window, \"mouseup\", function() {\n mouseup();\n setTimeout(rehide, 20);\n }, true);\n }\n else {\n setTimeout(rehide, 50);\n }\n }\n\n // Cursor-blinking\n function restartBlink() {\n clearInterval(blinker);\n var on = true;\n cursor.style.visibility = \"\";\n blinker = setInterval(function() {\n cursor.style.visibility = (on = !on) ? \"\" : \"hidden\";\n }, 650);\n }\n\n var matching = {\"(\": \")>\", \")\": \"(<\", \"[\": \"]>\", \"]\": \"[<\", \"{\": \"}>\", \"}\": \"{<\"};\n function matchBrackets(autoclear) {\n var head = sel.inverted ? sel.from : sel.to, line = lines[head.line], pos = head.ch - 1;\n var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];\n if (!match) return;\n var ch = match.charAt(0), forward = match.charAt(1) == \">\", d = forward ? 1 : -1, st = line.styles;\n for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)\n if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}\n\n var stack = [line.text.charAt(pos)], re = /[(){}[\\]]/;\n function scan(line, from, to) {\n if (!line.text) return;\n var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;\n for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {\n var text = st[i];\n if (st[i+1] != null && st[i+1] != style) {pos += d * text.length; continue;}\n for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {\n if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {\n var match = matching[cur];\n if (match.charAt(1) == \">\" == forward) stack.push(cur);\n else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};\n else if (!stack.length) return {pos: pos, match: true};\n }\n }\n }\n }\n for (var i = head.line, e = forward ? Math.min(i + 100, lines.length) : Math.max(-1, i - 100); i != e; i+=d) {\n var line = lines[i], first = i == head.line;\n var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);\n if (found) break;\n }\n if (!found) found = {pos: null, match: false};\n var style = found.match ? \"CodeMirror-matchingbracket\" : \"CodeMirror-nonmatchingbracket\";\n var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),\n two = found.pos != null && markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style);\n var clear = operation(function(){one.clear(); two && two.clear();});\n if (autoclear) setTimeout(clear, 800);\n else bracketHighlighted = clear;\n }\n\n // Finds the line to start with when starting a parse. Tries to\n // find a line with a stateAfter, so that it can start with a\n // valid state. If that fails, it returns the line with the\n // smallest indentation, which tends to need the least context to\n // parse correctly.\n function findStartLine(n) {\n var minindent, minline;\n for (var search = n, lim = n - 40; search > lim; --search) {\n if (search == 0) return 0;\n var line = lines[search-1];\n if (line.stateAfter) return search;\n var indented = line.indentation();\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline;\n }\n function getStateBefore(n) {\n var start = findStartLine(n), state = start && lines[start-1].stateAfter;\n if (!state) state = startState(mode);\n else state = copyState(mode, state);\n for (var i = start; i < n; ++i) {\n var line = lines[i];\n line.highlight(mode, state);\n line.stateAfter = copyState(mode, state);\n }\n changes.push({from: start, to: n});\n if (n < lines.length && !lines[n].stateAfter) work.push(n);\n return state;\n }\n function highlightLines(start, end) {\n var state = getStateBefore(start);\n for (var i = start; i < end; ++i) {\n var line = lines[i];\n line.highlight(mode, state);\n line.stateAfter = copyState(mode, state);\n }\n }\n function highlightWorker() {\n var end = +new Date + options.workTime;\n var foundWork = work.length;\n while (work.length) {\n if (!lines[showingFrom].stateAfter) var task = showingFrom;\n else var task = work.pop();\n if (task >= lines.length) continue;\n var start = findStartLine(task), state = start && lines[start-1].stateAfter;\n if (state) state = copyState(mode, state);\n else state = startState(mode);\n\n var unchanged = 0, compare = mode.compareStates, realChange = false;\n for (var i = start, l = lines.length; i < l; ++i) {\n var line = lines[i], hadState = line.stateAfter;\n if (+new Date > end) {\n work.push(i);\n startWorker(options.workDelay);\n if (realChange) changes.push({from: task, to: i + 1});\n return;\n }\n var changed = line.highlight(mode, state);\n if (changed) realChange = true;\n line.stateAfter = copyState(mode, state);\n if (compare) {\n if (hadState && compare(hadState, state)) break;\n } else {\n if (changed !== false || !hadState) unchanged = 0;\n else if (++unchanged > 3) break;\n }\n }\n if (realChange) changes.push({from: task, to: i + 1});\n }\n if (foundWork && options.onHighlightComplete)\n options.onHighlightComplete(instance);\n }\n function startWorker(time) {\n if (!work.length) return;\n highlight.set(time, operation(highlightWorker));\n }\n\n // Operations are used to wrap changes in such a way that each\n // change won't have to update the cursor and display (which would\n // be awkward, slow, and error-prone), but instead updates are\n // batched and then all combined and executed at once.\n function startOperation() {\n updateInput = null; changes = []; textChanged = selectionChanged = false;\n }\n function endOperation() {\n var reScroll = false;\n if (selectionChanged) reScroll = !scrollCursorIntoView();\n if (changes.length) updateDisplay(changes);\n else {\n if (selectionChanged) updateCursor();\n if (gutterDirty) updateGutter();\n }\n if (reScroll) scrollCursorIntoView();\n if (selectionChanged) {scrollEditorIntoView(); restartBlink();}\n\n // updateInput can be set to a boolean value to force/prevent an\n // update.\n if (focused && !leaveInputAlone &&\n (updateInput === true || (updateInput !== false && selectionChanged)))\n prepareInput();\n\n if (selectionChanged && options.matchBrackets)\n setTimeout(operation(function() {\n if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}\n matchBrackets(false);\n }), 20);\n var tc = textChanged; // textChanged can be reset by cursoractivity callback\n if (selectionChanged && options.onCursorActivity)\n options.onCursorActivity(instance);\n if (tc && options.onChange && instance)\n options.onChange(instance, tc);\n }\n var nestedOperation = 0;\n function operation(f) {\n return function() {\n if (!nestedOperation++) startOperation();\n try {var result = f.apply(this, arguments);}\n finally {if (!--nestedOperation) endOperation();}\n return result;\n };\n }\n\n function SearchCursor(query, pos, caseFold) {\n this.atOccurrence = false;\n if (caseFold == null) caseFold = typeof query == \"string\" && query == query.toLowerCase();\n\n if (pos && typeof pos == \"object\") pos = clipPos(pos);\n else pos = {line: 0, ch: 0};\n this.pos = {from: pos, to: pos};\n\n // The matches method is filled in based on the type of query.\n // It takes a position and a direction, and returns an object\n // describing the next occurrence of the query, or null if no\n // more matches were found.\n if (typeof query != \"string\") // Regexp match\n this.matches = function(reverse, pos) {\n if (reverse) {\n var line = lines[pos.line].text.slice(0, pos.ch), match = line.match(query), start = 0;\n while (match) {\n var ind = line.indexOf(match[0]);\n start += ind;\n line = line.slice(ind + 1);\n var newmatch = line.match(query);\n if (newmatch) match = newmatch;\n else break;\n start++;\n }\n }\n else {\n var line = lines[pos.line].text.slice(pos.ch), match = line.match(query),\n start = match && pos.ch + line.indexOf(match[0]);\n }\n if (match)\n return {from: {line: pos.line, ch: start},\n to: {line: pos.line, ch: start + match[0].length},\n match: match};\n };\n else { // String query\n if (caseFold) query = query.toLowerCase();\n var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};\n var target = query.split(\"\\n\");\n // Different methods for single-line and multi-line queries\n if (target.length == 1)\n this.matches = function(reverse, pos) {\n var line = fold(lines[pos.line].text), len = query.length, match;\n if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)\n : (match = line.indexOf(query, pos.ch)) != -1)\n return {from: {line: pos.line, ch: match},\n to: {line: pos.line, ch: match + len}};\n };\n else\n this.matches = function(reverse, pos) {\n var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(lines[ln].text);\n var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));\n if (reverse ? offsetA >= pos.ch || offsetA != match.length\n : offsetA <= pos.ch || offsetA != line.length - match.length)\n return;\n for (;;) {\n if (reverse ? !ln : ln == lines.length - 1) return;\n line = fold(lines[ln += reverse ? -1 : 1].text);\n match = target[reverse ? --idx : ++idx];\n if (idx > 0 && idx < target.length - 1) {\n if (line != match) return;\n else continue;\n }\n var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);\n if (reverse ? offsetB != line.length - match.length : offsetB != match.length)\n return;\n var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB};\n return {from: reverse ? end : start, to: reverse ? start : end};\n }\n };\n }\n }\n\n SearchCursor.prototype = {\n findNext: function() {return this.find(false);},\n findPrevious: function() {return this.find(true);},\n\n find: function(reverse) {\n var self = this, pos = clipPos(reverse ? this.pos.from : this.pos.to);\n function savePosAndFail(line) {\n var pos = {line: line, ch: 0};\n self.pos = {from: pos, to: pos};\n self.atOccurrence = false;\n return false;\n }\n\n for (;;) {\n if (this.pos = this.matches(reverse, pos)) {\n this.atOccurrence = true;\n return this.pos.match || true;\n }\n if (reverse) {\n if (!pos.line) return savePosAndFail(0);\n pos = {line: pos.line-1, ch: lines[pos.line-1].text.length};\n }\n else {\n if (pos.line == lines.length - 1) return savePosAndFail(lines.length);\n pos = {line: pos.line+1, ch: 0};\n }\n }\n },\n\n from: function() {if (this.atOccurrence) return copyPos(this.pos.from);},\n to: function() {if (this.atOccurrence) return copyPos(this.pos.to);},\n\n replace: function(newText) {\n var self = this;\n if (this.atOccurrence)\n operation(function() {\n self.pos.to = replaceRange(newText, self.pos.from, self.pos.to);\n })();\n }\n };\n\n for (var ext in extensions)\n if (extensions.propertyIsEnumerable(ext) &&\n !instance.propertyIsEnumerable(ext))\n instance[ext] = extensions[ext];\n return instance;\n } // (end of function CodeMirror)", "function CodeMirror(place, givenOptions) {\n // Determine effective options based on given values and defaults.\n var options = {}, defaults = CodeMirror.defaults;\n for (var opt in defaults)\n if (defaults.hasOwnProperty(opt))\n options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];\n\n var targetDocument = options[\"document\"];\n // The element in which the editor lives.\n var wrapper = targetDocument.createElement(\"div\");\n wrapper.className = \"CodeMirror\";\n // This mess creates the base DOM structure for the editor.\n wrapper.innerHTML =\n '<div style=\"overflow: hidden; position: relative; width: 1px; height: 0px;\">' + // Wraps and hides input textarea\n '<textarea style=\"position: absolute; width: 2px;\" wrap=\"off\"></textarea></div>' +\n '<div class=\"CodeMirror-scroll cm-s-' + options.theme + '\">' +\n '<div style=\"position: relative\">' + // Set to the height of the text, causes scrolling\n '<div style=\"position: absolute; height: 0; width: 0; overflow: hidden;\"></div>' +\n '<div style=\"position: relative\">' + // Moved around its parent to cover visible view\n '<div class=\"CodeMirror-gutter\"><div class=\"CodeMirror-gutter-text\"></div></div>' +\n // Provides positioning relative to (visible) text origin\n '<div class=\"CodeMirror-lines\"><div style=\"position: relative\">' +\n '<pre class=\"CodeMirror-cursor\">&#160;</pre>' + // Absolutely positioned blinky cursor\n '<div></div>' + // This DIV contains the actual code\n '</div></div></div></div></div>';\n if (place.appendChild) place.appendChild(wrapper); else place(wrapper);\n // I've never seen more elegant code in my life.\n var inputDiv = wrapper.firstChild, input = inputDiv.firstChild,\n scroller = wrapper.lastChild, code = scroller.firstChild,\n measure = code.firstChild, mover = measure.nextSibling,\n gutter = mover.firstChild, gutterText = gutter.firstChild,\n lineSpace = gutter.nextSibling.firstChild,\n cursor = lineSpace.firstChild, lineDiv = cursor.nextSibling;\n if (options.tabindex != null) input.tabindex = options.tabindex;\n if (!options.gutter && !options.lineNumbers) gutter.style.display = \"none\";\n\n // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.\n var poll = new Delayed(), highlight = new Delayed(), blinker;\n\n // mode holds a mode API object. lines an array of Line objects\n // (see Line constructor), work an array of lines that should be\n // parsed, and history the undo history (instance of History\n // constructor).\n var mode, lines = [new Line(\"\")], work, history = new History(), focused;\n loadMode();\n // The selection. These are always maintained to point at valid\n // positions. Inverted is used to remember that the user is\n // selecting bottom-to-top.\n var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};\n // Selection-related flags. shiftSelecting obviously tracks\n // whether the user is holding shift. reducedSelection is a hack\n // to get around the fact that we can't create inverted\n // selections. See below.\n var shiftSelecting, reducedSelection, lastDoubleClick;\n // Variables used by startOperation/endOperation to track what\n // happened during the operation.\n var updateInput, changes, textChanged, selectionChanged, leaveInputAlone;\n // Current visible range (may be bigger than the view window).\n var showingFrom = 0, showingTo = 0, lastHeight = 0, curKeyId = null;\n // editing will hold an object describing the things we put in the\n // textarea, to help figure out whether something changed.\n // bracketHighlighted is used to remember that a backet has been\n // marked.\n var editing, bracketHighlighted;\n // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n var maxLine = \"\", maxWidth;\n\n // Initialize the content.\n operation(function(){setValue(options.value || \"\"); updateInput = false;})();\n\n // Register our event handlers.\n connect(scroller, \"mousedown\", operation(onMouseDown));\n // Gecko browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for Gecko.\n if (!gecko) connect(scroller, \"contextmenu\", onContextMenu);\n connect(code, \"dblclick\", operation(onDblClick));\n connect(scroller, \"scroll\", function() {updateDisplay([]); if (options.onScroll) options.onScroll(instance);});\n connect(window, \"resize\", function() {updateDisplay(true);});\n connect(input, \"keyup\", operation(onKeyUp));\n connect(input, \"keydown\", operation(onKeyDown));\n connect(input, \"keypress\", operation(onKeyPress));\n connect(input, \"focus\", onFocus);\n connect(input, \"blur\", onBlur);\n\n connect(scroller, \"dragenter\", e_stop);\n connect(scroller, \"dragover\", e_stop);\n connect(scroller, \"drop\", operation(onDrop));\n connect(scroller, \"paste\", function(){focusInput(); fastPoll();});\n connect(input, \"paste\", function(){fastPoll();});\n connect(input, \"cut\", function(){fastPoll();});\n \n // IE throws unspecified error in certain cases, when \n // trying to access activeElement before onload\n var hasFocus; try { hasFocus = (targetDocument.activeElement == input); } catch(e) { }\n if (hasFocus) setTimeout(onFocus, 20);\n else onBlur();\n\n function isLine(l) {return l >= 0 && l < lines.length;}\n // The instance object that we'll return. Mostly calls out to\n // local functions in the CodeMirror function. Some do some extra\n // range checking and/or clipping. operation is used to wrap the\n // call so that changes it makes are tracked, and the display is\n // updated afterwards.\n var instance = {\n getValue: getValue,\n setValue: operation(setValue),\n getSelection: getSelection,\n replaceSelection: operation(replaceSelection),\n focus: function(){focusInput(); onFocus(); fastPoll();},\n setOption: function(option, value) {\n options[option] = value;\n if (option == \"lineNumbers\" || option == \"gutter\") gutterChanged();\n else if (option == \"mode\" || option == \"indentUnit\") loadMode();\n else if (option == \"readOnly\" && value == \"nocursor\") input.blur();\n else if (option == \"theme\") scroller.className = scroller.className.replace(/cm-s-\\w+/, \"cm-s-\" + value);\n },\n getOption: function(option) {return options[option];},\n undo: operation(undo),\n redo: operation(redo),\n indentLine: operation(function(n) {if (isLine(n)) indentLine(n, \"smart\");}),\n historySize: function() {return {undo: history.done.length, redo: history.undone.length};},\n matchBrackets: operation(function(){matchBrackets(true);}),\n getTokenAt: function(pos) {\n pos = clipPos(pos);\n return lines[pos.line].getTokenAt(mode, getStateBefore(pos.line), pos.ch);\n },\n getStateAfter: function(line) {\n line = clipLine(line == null ? lines.length - 1: line);\n return getStateBefore(line + 1);\n },\n cursorCoords: function(start){\n if (start == null) start = sel.inverted;\n return pageCoords(start ? sel.from : sel.to);\n },\n charCoords: function(pos){return pageCoords(clipPos(pos));},\n coordsChar: function(coords) {\n var off = eltOffset(lineSpace);\n var line = clipLine(Math.min(lines.length - 1, showingFrom + Math.floor((coords.y - off.top) / lineHeight())));\n return clipPos({line: line, ch: charFromX(clipLine(line), coords.x - off.left)});\n },\n getSearchCursor: function(query, pos, caseFold) {return new SearchCursor(query, pos, caseFold);},\n markText: operation(function(a, b, c){return operation(markText(a, b, c));}),\n setMarker: addGutterMarker,\n clearMarker: removeGutterMarker,\n setLineClass: operation(setLineClass),\n lineInfo: lineInfo,\n addWidget: function(pos, node, scroll, where) {\n pos = localCoords(clipPos(pos));\n var top = pos.yBot, left = pos.x;\n node.style.position = \"absolute\";\n code.appendChild(node);\n node.style.left = left + \"px\";\n if (where == \"over\") top = pos.y;\n else if (where == \"near\") {\n var vspace = Math.max(scroller.offsetHeight, lines.length * lineHeight()),\n hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft();\n if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)\n top = pos.y - node.offsetHeight;\n if (left + node.offsetWidth > hspace)\n left = hspace - node.offsetWidth;\n }\n node.style.top = (top + paddingTop()) + \"px\";\n node.style.left = (left + paddingLeft()) + \"px\";\n if (scroll)\n scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);\n },\n\n lineCount: function() {return lines.length;},\n getCursor: function(start) {\n if (start == null) start = sel.inverted;\n return copyPos(start ? sel.from : sel.to);\n },\n somethingSelected: function() {return !posEq(sel.from, sel.to);},\n setCursor: operation(function(line, ch) {\n if (ch == null && typeof line.line == \"number\") setCursor(line.line, line.ch);\n else setCursor(line, ch);\n }),\n setSelection: operation(function(from, to) {setSelection(clipPos(from), clipPos(to || from));}),\n getLine: function(line) {if (isLine(line)) return lines[line].text;},\n setLine: operation(function(line, text) {\n if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: lines[line].text.length});\n }),\n removeLine: operation(function(line) {\n if (isLine(line)) replaceRange(\"\", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));\n }),\n replaceRange: operation(replaceRange),\n getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},\n\n operation: function(f){return operation(f)();},\n refresh: function(){updateDisplay(true);},\n getInputField: function(){return input;},\n getWrapperElement: function(){return wrapper;},\n getScrollerElement: function(){return scroller;}\n };\n\n function setValue(code) {\n history = null;\n var top = {line: 0, ch: 0};\n updateLines(top, {line: lines.length - 1, ch: lines[lines.length-1].text.length},\n splitLines(code), top, top);\n history = new History();\n }\n function getValue(code) {\n var text = [];\n for (var i = 0, l = lines.length; i < l; ++i)\n text.push(lines[i].text);\n return text.join(\"\\n\");\n }\n\n function onMouseDown(e) {\n // Check whether this is a click in a widget\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == code && n != mover) return;\n var ld = lastDoubleClick; lastDoubleClick = null;\n // First, see if this is a click in the gutter\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == gutterText) {\n if (options.onGutterClick)\n options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom);\n return e_preventDefault(e);\n }\n\n var start = posFromMouse(e);\n \n switch (e_button(e)) {\n case 3:\n if (gecko && !mac) onContextMenu(e);\n return;\n case 2:\n if (start) setCursor(start.line, start.ch, true);\n return;\n }\n // For button 1, if it was clicked inside the editor\n // (posFromMouse returning non-null), we have to adjust the\n // selection.\n if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}\n\n if (!focused) onFocus();\n e_preventDefault(e);\n if (ld && +new Date - ld < 400) return selectLine(start.line);\n\n setCursor(start.line, start.ch, true);\n var last = start, going;\n // And then we have to see if it's a drag event, in which case\n // the dragged-over text must be selected.\n function end() {\n focusInput();\n updateInput = true;\n move(); up();\n }\n function extend(e) {\n var cur = posFromMouse(e, true);\n if (cur && !posEq(cur, last)) {\n if (!focused) onFocus();\n last = cur;\n setSelectionUser(start, cur);\n updateInput = false;\n var visible = visibleLines();\n if (cur.line >= visible.to || cur.line < visible.from)\n going = setTimeout(operation(function(){extend(e);}), 150);\n }\n }\n\n var move = connect(targetDocument, \"mousemove\", operation(function(e) {\n clearTimeout(going);\n e_preventDefault(e);\n extend(e);\n }), true);\n var up = connect(targetDocument, \"mouseup\", operation(function(e) {\n clearTimeout(going);\n var cur = posFromMouse(e);\n if (cur) setSelectionUser(start, cur);\n e_preventDefault(e);\n end();\n }), true);\n }\n function onDblClick(e) {\n var pos = posFromMouse(e);\n if (!pos) return;\n selectWordAt(pos);\n e_preventDefault(e);\n lastDoubleClick = +new Date;\n }\n function onDrop(e) {\n e.preventDefault();\n var pos = posFromMouse(e, true), files = e.dataTransfer.files;\n if (!pos || options.readOnly) return;\n if (files && files.length && window.FileReader && window.File) {\n function loadFile(file, i) {\n var reader = new FileReader;\n reader.onload = function() {\n text[i] = reader.result;\n if (++read == n) replaceRange(text.join(\"\"), clipPos(pos), clipPos(pos));\n };\n reader.readAsText(file);\n }\n var n = files.length, text = Array(n), read = 0;\n for (var i = 0; i < n; ++i) loadFile(files[i], i);\n }\n else {\n try {\n var text = e.dataTransfer.getData(\"Text\");\n if (text) replaceRange(text, pos, pos);\n }\n catch(e){}\n }\n }\n function onKeyDown(e) {\n if (!focused) onFocus();\n\n var code = e.keyCode;\n // IE does strange things with escape.\n if (ie && code == 27) { e.returnValue = false; }\n // Tries to detect ctrl on non-mac, cmd on mac.\n var mod = (mac ? e.metaKey : e.ctrlKey) && !e.altKey, anyMod = e.ctrlKey || e.altKey || e.metaKey;\n if (code == 16 || e.shiftKey) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);\n else shiftSelecting = null;\n // First give onKeyEvent option a chance to handle this.\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n\n if (code == 33 || code == 34) {scrollPage(code == 34); return e_preventDefault(e);} // page up/down\n if (mod && ((code == 36 || code == 35) || // ctrl-home/end\n mac && (code == 38 || code == 40))) { // cmd-up/down\n scrollEnd(code == 36 || code == 38); return e_preventDefault(e);\n }\n if (mod && code == 65) {selectAll(); return e_preventDefault(e);} // ctrl-a\n if (!options.readOnly) {\n if (!anyMod && code == 13) {return;} // enter\n if (!anyMod && code == 9 && handleTab(e.shiftKey)) return e_preventDefault(e); // tab\n if (mod && code == 90) {undo(); return e_preventDefault(e);} // ctrl-z\n if (mod && ((e.shiftKey && code == 90) || code == 89)) {redo(); return e_preventDefault(e);} // ctrl-shift-z, ctrl-y\n }\n\n // Key id to use in the movementKeys map. We also pass it to\n // fastPoll in order to 'self learn'. We need this because\n // reducedSelection, the hack where we collapse the selection to\n // its start when it is inverted and a movement key is pressed\n // (and later restore it again), shouldn't be used for\n // non-movement keys.\n curKeyId = (mod ? \"c\" : \"\") + code;\n if (sel.inverted && movementKeys.hasOwnProperty(curKeyId)) {\n var range = selRange(input);\n if (range) {\n reducedSelection = {anchor: range.start};\n setSelRange(input, range.start, range.start);\n }\n }\n fastPoll(curKeyId);\n }\n function onKeyUp(e) {\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n if (reducedSelection) {\n reducedSelection = null;\n updateInput = true;\n }\n if (e.keyCode == 16) shiftSelecting = null;\n }\n function onKeyPress(e) {\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n if (options.electricChars && mode.electricChars) {\n var ch = String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode);\n if (mode.electricChars.indexOf(ch) > -1)\n setTimeout(operation(function() {indentLine(sel.to.line, \"smart\");}), 50);\n }\n var code = e.keyCode;\n // Re-stop tab and enter. Necessary on some browsers.\n if (code == 13) {if (!options.readOnly) handleEnter(); e_preventDefault(e);}\n else if (!e.ctrlKey && !e.altKey && !e.metaKey && code == 9 && options.tabMode != \"default\") e_preventDefault(e);\n else fastPoll(curKeyId);\n }\n\n function onFocus() {\n if (options.readOnly == \"nocursor\") return;\n if (!focused) {\n if (options.onFocus) options.onFocus(instance);\n focused = true;\n if (wrapper.className.search(/\\bCodeMirror-focused\\b/) == -1)\n wrapper.className += \" CodeMirror-focused\";\n if (!leaveInputAlone) prepareInput();\n }\n slowPoll();\n restartBlink();\n }\n function onBlur() {\n if (focused) {\n if (options.onBlur) options.onBlur(instance);\n focused = false;\n wrapper.className = wrapper.className.replace(\" CodeMirror-focused\", \"\");\n }\n clearInterval(blinker);\n setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);\n }\n\n // Replace the range from from to to by the strings in newText.\n // Afterwards, set the selection to selFrom, selTo.\n function updateLines(from, to, newText, selFrom, selTo) {\n if (history) {\n var old = [];\n for (var i = from.line, e = to.line + 1; i < e; ++i) old.push(lines[i].text);\n history.addChange(from.line, newText.length, old);\n while (history.done.length > options.undoDepth) history.done.shift();\n }\n updateLinesNoUndo(from, to, newText, selFrom, selTo);\n }\n function unredoHelper(from, to) {\n var change = from.pop();\n if (change) {\n var replaced = [], end = change.start + change.added;\n for (var i = change.start; i < end; ++i) replaced.push(lines[i].text);\n to.push({start: change.start, added: change.old.length, old: replaced});\n var pos = clipPos({line: change.start + change.old.length - 1,\n ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])});\n updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: lines[end-1].text.length}, change.old, pos, pos);\n updateInput = true;\n }\n }\n function undo() {unredoHelper(history.done, history.undone);}\n function redo() {unredoHelper(history.undone, history.done);}\n\n function updateLinesNoUndo(from, to, newText, selFrom, selTo) {\n var recomputeMaxLength = false, maxLineLength = maxLine.length;\n for (var i = from.line; i <= to.line; ++i) {\n if (lines[i].text.length == maxLineLength) {recomputeMaxLength = true; break;}\n }\n\n var nlines = to.line - from.line, firstLine = lines[from.line], lastLine = lines[to.line];\n // First adjust the line structure, taking some care to leave highlighting intact.\n if (firstLine == lastLine) {\n if (newText.length == 1)\n firstLine.replace(from.ch, to.ch, newText[0]);\n else {\n lastLine = firstLine.split(to.ch, newText[newText.length-1]);\n var spliceargs = [from.line + 1, nlines];\n firstLine.replace(from.ch, firstLine.text.length, newText[0]);\n for (var i = 1, e = newText.length - 1; i < e; ++i) spliceargs.push(new Line(newText[i]));\n spliceargs.push(lastLine);\n lines.splice.apply(lines, spliceargs);\n }\n }\n else if (newText.length == 1) {\n firstLine.replace(from.ch, firstLine.text.length, newText[0] + lastLine.text.slice(to.ch));\n lines.splice(from.line + 1, nlines);\n }\n else {\n var spliceargs = [from.line + 1, nlines - 1];\n firstLine.replace(from.ch, firstLine.text.length, newText[0]);\n lastLine.replace(0, to.ch, newText[newText.length-1]);\n for (var i = 1, e = newText.length - 1; i < e; ++i) spliceargs.push(new Line(newText[i]));\n lines.splice.apply(lines, spliceargs);\n }\n\n\n for (var i = from.line, e = i + newText.length; i < e; ++i) {\n var l = lines[i].text;\n if (l.length > maxLineLength) {\n maxLine = l; maxLineLength = l.length; maxWidth = null;\n recomputeMaxLength = false;\n }\n }\n if (recomputeMaxLength) {\n maxLineLength = 0; maxLine = \"\"; maxWidth = null;\n for (var i = 0, e = lines.length; i < e; ++i) {\n var l = lines[i].text;\n if (l.length > maxLineLength) {\n maxLineLength = l.length; maxLine = l;\n }\n }\n }\n\n // Add these lines to the work array, so that they will be\n // highlighted. Adjust work lines if lines were added/removed.\n var newWork = [], lendiff = newText.length - nlines - 1;\n for (var i = 0, l = work.length; i < l; ++i) {\n var task = work[i];\n if (task < from.line) newWork.push(task);\n else if (task > to.line) newWork.push(task + lendiff);\n }\n if (newText.length < 5) {\n highlightLines(from.line, from.line + newText.length);\n newWork.push(from.line + newText.length);\n } else {\n newWork.push(from.line);\n }\n work = newWork;\n startWorker(100);\n // Remember that these lines changed, for updating the display\n changes.push({from: from.line, to: to.line + 1, diff: lendiff});\n textChanged = {from: from, to: to, text: newText};\n\n // Update the selection\n function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}\n setSelection(selFrom, selTo, updateLine(sel.from.line), updateLine(sel.to.line));\n\n // Make sure the scroll-size div has the correct height.\n code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + \"px\";\n }\n\n function replaceRange(code, from, to) {\n from = clipPos(from);\n if (!to) to = from; else to = clipPos(to);\n code = splitLines(code);\n function adjustPos(pos) {\n if (posLess(pos, from)) return pos;\n if (!posLess(to, pos)) return end;\n var line = pos.line + code.length - (to.line - from.line) - 1;\n var ch = pos.ch;\n if (pos.line == to.line)\n ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));\n return {line: line, ch: ch};\n }\n var end;\n replaceRange1(code, from, to, function(end1) {\n end = end1;\n return {from: adjustPos(sel.from), to: adjustPos(sel.to)};\n });\n return end;\n }\n function replaceSelection(code, collapse) {\n replaceRange1(splitLines(code), sel.from, sel.to, function(end) {\n if (collapse == \"end\") return {from: end, to: end};\n else if (collapse == \"start\") return {from: sel.from, to: sel.from};\n else return {from: sel.from, to: end};\n });\n }\n function replaceRange1(code, from, to, computeSel) {\n var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;\n var newSel = computeSel({line: from.line + code.length - 1, ch: endch});\n updateLines(from, to, code, newSel.from, newSel.to);\n }\n\n function getRange(from, to) {\n var l1 = from.line, l2 = to.line;\n if (l1 == l2) return lines[l1].text.slice(from.ch, to.ch);\n var code = [lines[l1].text.slice(from.ch)];\n for (var i = l1 + 1; i < l2; ++i) code.push(lines[i].text);\n code.push(lines[l2].text.slice(0, to.ch));\n return code.join(\"\\n\");\n }\n function getSelection() {\n return getRange(sel.from, sel.to);\n }\n\n var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll\n function slowPoll() {\n if (pollingFast) return;\n poll.set(2000, function() {\n startOperation();\n readInput();\n if (focused) slowPoll();\n endOperation();\n });\n }\n function fastPoll(keyId) {\n var missed = false;\n pollingFast = true;\n function p() {\n startOperation();\n var changed = readInput();\n if (changed == \"moved\" && keyId) movementKeys[keyId] = true;\n if (!changed && !missed) {missed = true; poll.set(80, p);}\n else {pollingFast = false; slowPoll();}\n endOperation();\n }\n poll.set(20, p);\n }\n\n // Inspects the textarea, compares its state (content, selection)\n // to the data in the editing variable, and updates the editor\n // content or cursor if something changed.\n function readInput() {\n if (leaveInputAlone || !focused) return;\n var changed = false, text = input.value, sr = selRange(input);\n if (!sr) return false;\n var changed = editing.text != text, rs = reducedSelection;\n var moved = changed || sr.start != editing.start || sr.end != (rs ? editing.start : editing.end);\n if (!moved && !rs) return false;\n if (changed) {\n shiftSelecting = reducedSelection = null;\n if (options.readOnly) {updateInput = true; return \"changed\";}\n }\n\n // Compute selection start and end based on start/end offsets in textarea\n function computeOffset(n, startLine) {\n var pos = 0;\n for (;;) {\n var found = text.indexOf(\"\\n\", pos);\n if (found == -1 || (text.charAt(found-1) == \"\\r\" ? found - 1 : found) >= n)\n return {line: startLine, ch: n - pos};\n ++startLine;\n pos = found + 1;\n }\n }\n var from = computeOffset(sr.start, editing.from),\n to = computeOffset(sr.end, editing.from);\n // Here we have to take the reducedSelection hack into account,\n // so that you can, for example, press shift-up at the start of\n // your selection and have the right thing happen.\n if (rs) {\n var head = sr.start == rs.anchor ? to : from;\n var tail = shiftSelecting ? sel.to : sr.start == rs.anchor ? from : to;\n if (sel.inverted = posLess(head, tail)) { from = head; to = tail; }\n else { reducedSelection = null; from = tail; to = head; }\n }\n\n // In some cases (cursor on same line as before), we don't have\n // to update the textarea content at all.\n if (from.line == to.line && from.line == sel.from.line && from.line == sel.to.line && !shiftSelecting)\n updateInput = false;\n\n // Magic mess to extract precise edited range from the changed\n // string.\n if (changed) {\n var start = 0, end = text.length, len = Math.min(end, editing.text.length);\n var c, line = editing.from, nl = -1;\n while (start < len && (c = text.charAt(start)) == editing.text.charAt(start)) {\n ++start;\n if (c == \"\\n\") {line++; nl = start;}\n }\n var ch = nl > -1 ? start - nl : start, endline = editing.to - 1, edend = editing.text.length;\n for (;;) {\n c = editing.text.charAt(edend);\n if (text.charAt(end) != c) {++end; ++edend; break;}\n if (c == \"\\n\") endline--;\n if (edend <= start || end <= start) break;\n --end; --edend;\n }\n var nl = editing.text.lastIndexOf(\"\\n\", edend - 1), endch = nl == -1 ? edend : edend - nl - 1;\n updateLines({line: line, ch: ch}, {line: endline, ch: endch}, splitLines(text.slice(start, end)), from, to);\n if (line != endline || from.line != line) updateInput = true;\n }\n else setSelection(from, to);\n\n editing.text = text; editing.start = sr.start; editing.end = sr.end;\n return changed ? \"changed\" : moved ? \"moved\" : false;\n }\n\n // Set the textarea content and selection range to match the\n // editor state.\n function prepareInput() {\n var text = [];\n var from = Math.max(0, sel.from.line - 1), to = Math.min(lines.length, sel.to.line + 2);\n for (var i = from; i < to; ++i) text.push(lines[i].text);\n text = input.value = text.join(lineSep);\n var startch = sel.from.ch, endch = sel.to.ch;\n for (var i = from; i < sel.from.line; ++i)\n startch += lineSep.length + lines[i].text.length;\n for (var i = from; i < sel.to.line; ++i)\n endch += lineSep.length + lines[i].text.length;\n editing = {text: text, from: from, to: to, start: startch, end: endch};\n setSelRange(input, startch, reducedSelection ? startch : endch);\n }\n function focusInput() {\n if (options.readOnly != \"nocursor\") input.focus();\n }\n\n function scrollCursorIntoView() {\n var cursor = localCoords(sel.inverted ? sel.from : sel.to);\n return scrollIntoView(cursor.x, cursor.y, cursor.x, cursor.yBot);\n }\n function scrollIntoView(x1, y1, x2, y2) {\n var pl = paddingLeft(), pt = paddingTop(), lh = lineHeight();\n y1 += pt; y2 += pt; x1 += pl; x2 += pl;\n var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true;\n if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1 - 2*lh); scrolled = true;}\n else if (y2 > screentop + screen) {scroller.scrollTop = y2 + lh - screen; scrolled = true;}\n\n var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;\n if (x1 < screenleft) {\n if (x1 < 50) x1 = 0;\n scroller.scrollLeft = Math.max(0, x1 - 10);\n scrolled = true;\n }\n else if (x2 > screenw + screenleft) {\n scroller.scrollLeft = x2 + 10 - screenw;\n scrolled = true;\n if (x2 > code.clientWidth) result = false;\n }\n if (scrolled && options.onScroll) options.onScroll(instance);\n return result;\n }\n\n function visibleLines() {\n var lh = lineHeight(), top = scroller.scrollTop - paddingTop();\n return {from: Math.min(lines.length, Math.max(0, Math.floor(top / lh))),\n to: Math.min(lines.length, Math.ceil((top + scroller.clientHeight) / lh))};\n }\n // Uses a set of changes plus the current scroll position to\n // determine which DOM updates have to be made, and makes the\n // updates.\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 }\n\n function refreshDisplay(from, to) {\n var html = [], start = {line: from, ch: 0}, inSel = posLess(sel.from, start) && !posLess(sel.to, start);\n for (var i = from; i < to; ++i) {\n var ch1 = null, ch2 = null;\n if (inSel) {\n ch1 = 0;\n if (sel.to.line == i) {inSel = false; ch2 = sel.to.ch;}\n }\n else if (sel.from.line == i) {\n if (sel.to.line == i) {ch1 = sel.from.ch; ch2 = sel.to.ch;}\n else {inSel = true; ch1 = sel.from.ch;}\n }\n html.push(lines[i].getHTML(ch1, ch2, true));\n }\n lineDiv.innerHTML = html.join(\"\");\n }\n function patchDisplay(updates) {\n // Slightly different algorithm for IE (badInnerHTML), since\n // there .innerHTML on PRE nodes is dumb, and discards\n // whitespace.\n var sfrom = sel.from.line, sto = sel.to.line, off = 0,\n scratch = badInnerHTML && targetDocument.createElement(\"div\");\n for (var i = 0, e = updates.length; i < e; ++i) {\n var rec = updates[i];\n var extra = (rec.to - rec.from) - rec.domSize;\n var nodeAfter = lineDiv.childNodes[rec.domStart + rec.domSize + off] || null;\n if (badInnerHTML)\n for (var j = Math.max(-extra, rec.domSize); j > 0; --j)\n lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild);\n else if (extra) {\n for (var j = Math.max(0, extra); j > 0; --j)\n lineDiv.insertBefore(targetDocument.createElement(\"pre\"), nodeAfter);\n for (var j = Math.max(0, -extra); j > 0; --j)\n lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild);\n }\n var node = lineDiv.childNodes[rec.domStart + off], inSel = sfrom < rec.from && sto >= rec.from;\n for (var j = rec.from; j < rec.to; ++j) {\n var ch1 = null, ch2 = null;\n if (inSel) {\n ch1 = 0;\n if (sto == j) {inSel = false; ch2 = sel.to.ch;}\n }\n else if (sfrom == j) {\n if (sto == j) {ch1 = sel.from.ch; ch2 = sel.to.ch;}\n else {inSel = true; ch1 = sel.from.ch;}\n }\n if (badInnerHTML) {\n scratch.innerHTML = lines[j].getHTML(ch1, ch2, true);\n lineDiv.insertBefore(scratch.firstChild, nodeAfter);\n }\n else {\n node.innerHTML = lines[j].getHTML(ch1, ch2, false);\n node.className = lines[j].className || \"\";\n node = node.nextSibling;\n }\n }\n off += extra;\n }\n }\n\n function updateGutter() {\n if (!options.gutter && !options.lineNumbers) return;\n var hText = mover.offsetHeight, hEditor = scroller.clientHeight;\n gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + \"px\";\n var html = [];\n for (var i = showingFrom; i < Math.max(showingTo, showingFrom + 1); ++i) {\n var marker = lines[i].gutterMarker;\n var text = options.lineNumbers ? i + options.firstLineNumber : null;\n if (marker && marker.text)\n text = marker.text.replace(\"%N%\", text != null ? text : \"\");\n else if (text == null)\n text = \"\\u00a0\";\n html.push((marker && marker.style ? '<pre class=\"' + marker.style + '\">' : \"<pre>\"), text, \"</pre>\");\n }\n gutter.style.display = \"none\";\n gutterText.innerHTML = html.join(\"\");\n var minwidth = String(lines.length).length, firstNode = gutterText.firstChild, val = eltText(firstNode), pad = \"\";\n while (val.length + pad.length < minwidth) pad += \"\\u00a0\";\n if (pad) firstNode.insertBefore(targetDocument.createTextNode(pad), firstNode.firstChild);\n gutter.style.display = \"\";\n lineSpace.style.marginLeft = gutter.offsetWidth + \"px\";\n }\n function updateCursor() {\n var head = sel.inverted ? sel.from : sel.to, lh = lineHeight();\n var x = charX(head.line, head.ch) + \"px\", y = (head.line - showingFrom) * lh + \"px\";\n inputDiv.style.top = (head.line * lh - scroller.scrollTop) + \"px\";\n if (posEq(sel.from, sel.to)) {\n cursor.style.top = y; cursor.style.left = x;\n cursor.style.display = \"\";\n }\n else cursor.style.display = \"none\";\n }\n\n function setSelectionUser(from, to) {\n var sh = shiftSelecting && clipPos(shiftSelecting);\n if (sh) {\n if (posLess(sh, from)) from = sh;\n else if (posLess(to, sh)) to = sh;\n }\n setSelection(from, to);\n }\n // Update the selection. Last two args are only used by\n // updateLines, since they have to be expressed in the line\n // numbers before the update.\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 }\n function setCursor(line, ch, user) {\n var pos = clipPos({line: line, ch: ch || 0});\n (user ? setSelectionUser : setSelection)(pos, pos);\n }\n\n function clipLine(n) {return Math.max(0, Math.min(n, lines.length-1));}\n function clipPos(pos) {\n if (pos.line < 0) return {line: 0, ch: 0};\n if (pos.line >= lines.length) return {line: lines.length-1, ch: lines[lines.length-1].text.length};\n var ch = pos.ch, linelen = lines[pos.line].text.length;\n if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};\n else if (ch < 0) return {line: pos.line, ch: 0};\n else return pos;\n }\n\n function scrollPage(down) {\n var linesPerPage = Math.floor(scroller.clientHeight / lineHeight()), head = sel.inverted ? sel.from : sel.to;\n setCursor(head.line + (Math.max(linesPerPage - 1, 1) * (down ? 1 : -1)), head.ch, true);\n }\n function scrollEnd(top) {\n var pos = top ? {line: 0, ch: 0} : {line: lines.length - 1, ch: lines[lines.length-1].text.length};\n setSelectionUser(pos, pos);\n }\n function selectAll() {\n var endLine = lines.length - 1;\n setSelection({line: 0, ch: 0}, {line: endLine, ch: lines[endLine].text.length});\n }\n function selectWordAt(pos) {\n var line = lines[pos.line].text;\n var start = pos.ch, end = pos.ch;\n while (start > 0 && /\\w/.test(line.charAt(start - 1))) --start;\n while (end < line.length && /\\w/.test(line.charAt(end))) ++end;\n setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end});\n }\n function selectLine(line) {\n setSelectionUser({line: line, ch: 0}, {line: line, ch: lines[line].text.length});\n }\n function handleEnter() {\n replaceSelection(\"\\n\", \"end\");\n if (options.enterMode != \"flat\")\n indentLine(sel.from.line, options.enterMode == \"keep\" ? \"prev\" : \"smart\");\n }\n function handleTab(shift) {\n function indentSelected(mode) {\n if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);\n var e = sel.to.line - (sel.to.ch ? 0 : 1);\n for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);\n }\n shiftSelecting = null;\n switch (options.tabMode) {\n case \"default\":\n return false;\n case \"indent\":\n indentSelected(\"smart\");\n break;\n case \"classic\":\n if (posEq(sel.from, sel.to)) {\n if (shift) indentLine(sel.from.line, \"smart\");\n else replaceSelection(\"\\t\", \"end\");\n break;\n }\n case \"shift\":\n indentSelected(shift ? \"subtract\" : \"add\");\n break;\n }\n return true;\n }\n\n function indentLine(n, how) {\n if (how == \"smart\") {\n if (!mode.indent) how = \"prev\";\n else var state = getStateBefore(n);\n }\n\n var line = lines[n], curSpace = line.indentation(), curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (how == \"prev\") {\n if (n) indentation = lines[n-1].indentation();\n else indentation = 0;\n }\n else if (how == \"smart\") indentation = mode.indent(state, line.text.slice(curSpaceString.length));\n else if (how == \"add\") indentation = curSpace + options.indentUnit;\n else if (how == \"subtract\") indentation = curSpace - options.indentUnit;\n indentation = Math.max(0, indentation);\n var diff = indentation - curSpace;\n\n if (!diff) {\n if (sel.from.line != n && sel.to.line != n) return;\n var indentString = curSpaceString;\n }\n else {\n var indentString = \"\", pos = 0;\n if (options.indentWithTabs)\n for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n while (pos < indentation) {++pos; indentString += \" \";}\n }\n\n replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});\n }\n\n function loadMode() {\n mode = CodeMirror.getMode(options, options.mode);\n for (var i = 0, l = lines.length; i < l; ++i)\n lines[i].stateAfter = null;\n work = [0];\n startWorker();\n }\n function gutterChanged() {\n var visible = options.gutter || options.lineNumbers;\n gutter.style.display = visible ? \"\" : \"none\";\n if (visible) updateGutter();\n else lineDiv.parentNode.style.marginLeft = 0;\n }\n\n function markText(from, to, className) {\n from = clipPos(from); to = clipPos(to);\n var accum = [];\n function add(line, from, to, className) {\n var line = lines[line], mark = line.addMark(from, to, className);\n mark.line = line;\n accum.push(mark);\n }\n if (from.line == to.line) add(from.line, from.ch, to.ch, className);\n else {\n add(from.line, from.ch, null, className);\n for (var i = from.line + 1, e = to.line; i < e; ++i)\n add(i, 0, null, className);\n add(to.line, 0, to.ch, className);\n }\n changes.push({from: from.line, to: to.line + 1});\n return function() {\n var start, end;\n for (var i = 0; i < accum.length; ++i) {\n var mark = accum[i], found = indexOf(lines, mark.line);\n mark.line.removeMark(mark);\n if (found > -1) {\n if (start == null) start = found;\n end = found;\n }\n }\n if (start != null) changes.push({from: start, to: end + 1});\n };\n }\n\n function addGutterMarker(line, text, className) {\n if (typeof line == \"number\") line = lines[clipLine(line)];\n line.gutterMarker = {text: text, style: className};\n updateGutter();\n return line;\n }\n function removeGutterMarker(line) {\n if (typeof line == \"number\") line = lines[clipLine(line)];\n line.gutterMarker = null;\n updateGutter();\n }\n function setLineClass(line, className) {\n if (typeof line == \"number\") {\n var no = line;\n line = lines[clipLine(line)];\n }\n else {\n var no = indexOf(lines, line);\n if (no == -1) return null;\n }\n if (line.className != className) {\n line.className = className;\n changes.push({from: no, to: no + 1});\n }\n return line;\n }\n\n function lineInfo(line) {\n if (typeof line == \"number\") {\n var n = line;\n line = lines[line];\n if (!line) return null;\n }\n else {\n var n = indexOf(lines, line);\n if (n == -1) return null;\n }\n var marker = line.gutterMarker;\n return {line: n, text: line.text, markerText: marker && marker.text, markerClass: marker && marker.style};\n }\n\n function stringWidth(str) {\n measure.innerHTML = \"<pre><span>x</span></pre>\";\n measure.firstChild.firstChild.firstChild.nodeValue = str;\n return measure.firstChild.firstChild.offsetWidth || 10;\n }\n // These are used to go from pixel positions to character\n // positions, taking varying character widths into account.\n function charX(line, pos) {\n if (pos == 0) return 0;\n measure.innerHTML = \"<pre><span>\" + lines[line].getHTML(null, null, false, pos) + \"</span></pre>\";\n return measure.firstChild.firstChild.offsetWidth;\n }\n function charFromX(line, x) {\n if (x <= 0) return 0;\n var lineObj = lines[line], text = lineObj.text;\n function getX(len) {\n measure.innerHTML = \"<pre><span>\" + lineObj.getHTML(null, null, false, len) + \"</span></pre>\";\n return measure.firstChild.firstChild.offsetWidth;\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 / stringWidth(\"x\")));\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 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 (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 }\n\n function localCoords(pos, inLineWrap) {\n var lh = lineHeight(), line = pos.line - (inLineWrap ? showingFrom : 0);\n return {x: charX(pos.line, pos.ch), y: line * lh, yBot: (line + 1) * lh};\n }\n function pageCoords(pos) {\n var local = localCoords(pos, true), off = eltOffset(lineSpace);\n return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};\n }\n\n function lineHeight() {\n var nlines = lineDiv.childNodes.length;\n if (nlines) return (lineDiv.offsetHeight / nlines) || 1;\n measure.innerHTML = \"<pre>x</pre>\";\n return measure.firstChild.offsetHeight || 1;\n }\n function paddingTop() {return lineSpace.offsetTop;}\n function paddingLeft() {return lineSpace.offsetLeft;}\n\n function posFromMouse(e, liberal) {\n var offW = eltOffset(scroller, true), x, y;\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX; y = e.clientY; } catch (e) { return null; }\n // This is a mess of a heuristic to try and determine whether a\n // scroll-bar was clicked or not, and to return null if one was\n // (and !liberal).\n if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))\n return null;\n var offL = eltOffset(lineSpace, true);\n var line = showingFrom + Math.floor((y - offL.top) / lineHeight());\n return clipPos({line: line, ch: charFromX(clipLine(line), x - offL.left)});\n }\n function onContextMenu(e) {\n var pos = posFromMouse(e);\n if (!pos || window.opera) return; // Opera is difficult.\n if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))\n operation(setCursor)(pos.line, pos.ch);\n\n var oldCSS = input.style.cssText;\n inputDiv.style.position = \"absolute\";\n input.style.cssText = \"position: fixed; width: 30px; height: 30px; top: \" + (e_pageY(e) - 1) +\n \"px; left: \" + (e_pageX(e) - 1) + \"px; z-index: 1000; background: white; \" +\n \"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n leaveInputAlone = true;\n var val = input.value = getSelection();\n focusInput();\n setSelRange(input, 0, input.value.length);\n function rehide() {\n var newVal = splitLines(input.value).join(\"\\n\");\n if (newVal != val) operation(replaceSelection)(newVal, \"end\");\n inputDiv.style.position = \"relative\";\n input.style.cssText = oldCSS;\n leaveInputAlone = false;\n prepareInput();\n slowPoll();\n }\n \n if (gecko) {\n e_stop(e);\n var mouseup = connect(window, \"mouseup\", function() {\n mouseup();\n setTimeout(rehide, 20);\n }, true);\n }\n else {\n setTimeout(rehide, 50);\n }\n }\n\n // Cursor-blinking\n function restartBlink() {\n clearInterval(blinker);\n var on = true;\n cursor.style.visibility = \"\";\n blinker = setInterval(function() {\n cursor.style.visibility = (on = !on) ? \"\" : \"hidden\";\n }, 650);\n }\n\n var matching = {\"(\": \")>\", \")\": \"(<\", \"[\": \"]>\", \"]\": \"[<\", \"{\": \"}>\", \"}\": \"{<\"};\n function matchBrackets(autoclear) {\n var head = sel.inverted ? sel.from : sel.to, line = lines[head.line], pos = head.ch - 1;\n var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];\n if (!match) return;\n var ch = match.charAt(0), forward = match.charAt(1) == \">\", d = forward ? 1 : -1, st = line.styles;\n for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)\n if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}\n\n var stack = [line.text.charAt(pos)], re = /[(){}[\\]]/;\n function scan(line, from, to) {\n if (!line.text) return;\n var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;\n for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {\n var text = st[i];\n if (st[i+1] != null && st[i+1] != style) {pos += d * text.length; continue;}\n for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {\n if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {\n var match = matching[cur];\n if (match.charAt(1) == \">\" == forward) stack.push(cur);\n else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};\n else if (!stack.length) return {pos: pos, match: true};\n }\n }\n }\n }\n for (var i = head.line, e = forward ? Math.min(i + 100, lines.length) : Math.max(-1, i - 100); i != e; i+=d) {\n var line = lines[i], first = i == head.line;\n var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);\n if (found) break;\n }\n if (!found) found = {pos: null, match: false};\n var style = found.match ? \"CodeMirror-matchingbracket\" : \"CodeMirror-nonmatchingbracket\";\n var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),\n two = found.pos != null\n ? markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style)\n : function() {};\n var clear = operation(function(){one(); two();});\n if (autoclear) setTimeout(clear, 800);\n else bracketHighlighted = clear;\n }\n\n // Finds the line to start with when starting a parse. Tries to\n // find a line with a stateAfter, so that it can start with a\n // valid state. If that fails, it returns the line with the\n // smallest indentation, which tends to need the least context to\n // parse correctly.\n function findStartLine(n) {\n var minindent, minline;\n for (var search = n, lim = n - 40; search > lim; --search) {\n if (search == 0) return 0;\n var line = lines[search-1];\n if (line.stateAfter) return search;\n var indented = line.indentation();\n if (minline == null || minindent > indented) {\n minline = search;\n minindent = indented;\n }\n }\n return minline;\n }\n function getStateBefore(n) {\n var start = findStartLine(n), state = start && lines[start-1].stateAfter;\n if (!state) state = startState(mode);\n else state = copyState(mode, state);\n for (var i = start; i < n; ++i) {\n var line = lines[i];\n line.highlight(mode, state);\n line.stateAfter = copyState(mode, state);\n }\n if (n < lines.length && !lines[n].stateAfter) work.push(n);\n return state;\n }\n function highlightLines(start, end) {\n var state = getStateBefore(start);\n for (var i = start; i < end; ++i) {\n var line = lines[i];\n line.highlight(mode, state);\n line.stateAfter = copyState(mode, state);\n }\n }\n function highlightWorker() {\n var end = +new Date + options.workTime;\n var foundWork = work.length;\n while (work.length) {\n if (!lines[showingFrom].stateAfter) var task = showingFrom;\n else var task = work.pop();\n if (task >= lines.length) continue;\n var start = findStartLine(task), state = start && lines[start-1].stateAfter;\n if (state) state = copyState(mode, state);\n else state = startState(mode);\n\n var unchanged = 0, compare = mode.compareStates;\n for (var i = start, l = lines.length; i < l; ++i) {\n var line = lines[i], hadState = line.stateAfter;\n if (+new Date > end) {\n work.push(i);\n startWorker(options.workDelay);\n changes.push({from: task, to: i + 1});\n return;\n }\n var changed = line.highlight(mode, state);\n line.stateAfter = copyState(mode, state);\n if (compare) {\n if (hadState && compare(hadState, state)) break;\n } else {\n if (changed || !hadState) unchanged = 0;\n else if (++unchanged > 3) break;\n }\n }\n changes.push({from: task, to: i + 1});\n }\n if (foundWork && options.onHighlightComplete)\n options.onHighlightComplete(instance);\n }\n function startWorker(time) {\n if (!work.length) return;\n highlight.set(time, operation(highlightWorker));\n }\n\n // Operations are used to wrap changes in such a way that each\n // change won't have to update the cursor and display (which would\n // be awkward, slow, and error-prone), but instead updates are\n // batched and then all combined and executed at once.\n function startOperation() {\n updateInput = null; changes = []; textChanged = selectionChanged = false;\n }\n function endOperation() {\n var reScroll = false;\n if (selectionChanged) reScroll = !scrollCursorIntoView();\n if (changes.length) updateDisplay(changes);\n else if (selectionChanged) updateCursor();\n if (reScroll) scrollCursorIntoView();\n if (selectionChanged) restartBlink();\n\n // updateInput can be set to a boolean value to force/prevent an\n // update.\n if (focused && !leaveInputAlone &&\n (updateInput === true || (updateInput !== false && selectionChanged)))\n prepareInput();\n\n if (selectionChanged && options.matchBrackets)\n setTimeout(operation(function() {\n if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}\n matchBrackets(false);\n }), 20);\n var tc = textChanged; // textChanged can be reset by cursoractivity callback\n if (selectionChanged && options.onCursorActivity)\n options.onCursorActivity(instance);\n if (tc && options.onChange && instance)\n options.onChange(instance, tc);\n }\n var nestedOperation = 0;\n function operation(f) {\n return function() {\n if (!nestedOperation++) startOperation();\n try {var result = f.apply(this, arguments);}\n finally {if (!--nestedOperation) endOperation();}\n return result;\n };\n }\n\n function SearchCursor(query, pos, caseFold) {\n this.atOccurrence = false;\n if (caseFold == null) caseFold = typeof query == \"string\" && query == query.toLowerCase();\n\n if (pos && typeof pos == \"object\") pos = clipPos(pos);\n else pos = {line: 0, ch: 0};\n this.pos = {from: pos, to: pos};\n\n // The matches method is filled in based on the type of query.\n // It takes a position and a direction, and returns an object\n // describing the next occurrence of the query, or null if no\n // more matches were found.\n if (typeof query != \"string\") // Regexp match\n this.matches = function(reverse, pos) {\n if (reverse) {\n var line = lines[pos.line].text.slice(0, pos.ch), match = line.match(query), start = 0;\n while (match) {\n var ind = line.indexOf(match[0]);\n start += ind;\n line = line.slice(ind + 1);\n var newmatch = line.match(query);\n if (newmatch) match = newmatch;\n else break;\n start++;\n }\n }\n else {\n var line = lines[pos.line].text.slice(pos.ch), match = line.match(query),\n start = match && pos.ch + line.indexOf(match[0]);\n }\n if (match)\n return {from: {line: pos.line, ch: start},\n to: {line: pos.line, ch: start + match[0].length},\n match: match};\n };\n else { // String query\n if (caseFold) query = query.toLowerCase();\n var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};\n var target = query.split(\"\\n\");\n // Different methods for single-line and multi-line queries\n if (target.length == 1)\n this.matches = function(reverse, pos) {\n var line = fold(lines[pos.line].text), len = query.length, match;\n if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)\n : (match = line.indexOf(query, pos.ch)) != -1)\n return {from: {line: pos.line, ch: match},\n to: {line: pos.line, ch: match + len}};\n };\n else\n this.matches = function(reverse, pos) {\n var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(lines[ln].text);\n var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));\n if (reverse ? offsetA >= pos.ch || offsetA != match.length\n : offsetA <= pos.ch || offsetA != line.length - match.length)\n return;\n for (;;) {\n if (reverse ? !ln : ln == lines.length - 1) return;\n line = fold(lines[ln += reverse ? -1 : 1].text);\n match = target[reverse ? --idx : ++idx];\n if (idx > 0 && idx < target.length - 1) {\n if (line != match) return;\n else continue;\n }\n var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);\n if (reverse ? offsetB != line.length - match.length : offsetB != match.length)\n return;\n var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB};\n return {from: reverse ? end : start, to: reverse ? start : end};\n }\n };\n }\n }\n\n SearchCursor.prototype = {\n findNext: function() {return this.find(false);},\n findPrevious: function() {return this.find(true);},\n\n find: function(reverse) {\n var self = this, pos = clipPos(reverse ? this.pos.from : this.pos.to);\n function savePosAndFail(line) {\n var pos = {line: line, ch: 0};\n self.pos = {from: pos, to: pos};\n self.atOccurrence = false;\n return false;\n }\n\n for (;;) {\n if (this.pos = this.matches(reverse, pos)) {\n this.atOccurrence = true;\n return this.pos.match || true;\n }\n if (reverse) {\n if (!pos.line) return savePosAndFail(0);\n pos = {line: pos.line-1, ch: lines[pos.line-1].text.length};\n }\n else {\n if (pos.line == lines.length - 1) return savePosAndFail(lines.length);\n pos = {line: pos.line+1, ch: 0};\n }\n }\n },\n\n from: function() {if (this.atOccurrence) return copyPos(this.pos.from);},\n to: function() {if (this.atOccurrence) return copyPos(this.pos.to);},\n\n replace: function(newText) {\n var self = this;\n if (this.atOccurrence)\n operation(function() {\n self.pos.to = replaceRange(newText, self.pos.from, self.pos.to);\n })();\n }\n };\n\n for (var ext in extensions)\n if (extensions.propertyIsEnumerable(ext) &&\n !instance.propertyIsEnumerable(ext))\n instance[ext] = extensions[ext];\n return instance;\n } // (end of function CodeMirror)", "function CodeMirror(place, givenOptions) {\n // Determine effective options based on given values and defaults.\n var options = {}, defaults = CodeMirror.defaults;\n for (var opt in defaults)\n if (defaults.hasOwnProperty(opt))\n options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];\n\n var targetDocument = options[\"document\"];\n // The element in which the editor lives.\n var wrapper = targetDocument.createElement(\"div\");\n wrapper.className = \"CodeMirror\";\n // This mess creates the base DOM structure for the editor.\n wrapper.innerHTML =\n '<div style=\"overflow: hidden; position: relative; width: 1px; height: 0px;\">' + // Wraps and hides input textarea\n '<textarea style=\"position: absolute; width: 2px;\" wrap=\"off\"></textarea></div>' +\n '<div class=\"CodeMirror-scroll cm-s-' + options.theme + '\">' +\n '<div style=\"position: relative\">' + // Set to the height of the text, causes scrolling\n '<div style=\"position: absolute; height: 0; width: 0; overflow: hidden;\"></div>' +\n '<div style=\"position: relative\">' + // Moved around its parent to cover visible view\n '<div class=\"CodeMirror-gutter\"><div class=\"CodeMirror-gutter-text\"></div></div>' +\n // Provides positioning relative to (visible) text origin\n '<div class=\"CodeMirror-lines\"><div style=\"position: relative\">' +\n '<pre class=\"CodeMirror-cursor\">&#160;</pre>' + // Absolutely positioned blinky cursor\n '<div></div>' + // This DIV contains the actual code\n '</div></div></div></div></div>';\n if (place.appendChild) place.appendChild(wrapper); else place(wrapper);\n // I've never seen more elegant code in my life.\n var inputDiv = wrapper.firstChild, input = inputDiv.firstChild,\n scroller = wrapper.lastChild, code = scroller.firstChild,\n measure = code.firstChild, mover = measure.nextSibling,\n gutter = mover.firstChild, gutterText = gutter.firstChild,\n lineSpace = gutter.nextSibling.firstChild,\n cursor = lineSpace.firstChild, lineDiv = cursor.nextSibling;\n if (options.tabindex != null) input.tabindex = options.tabindex;\n if (!options.gutter && !options.lineNumbers) gutter.style.display = \"none\";\n\n // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.\n var poll = new Delayed(), highlight = new Delayed(), blinker;\n\n // mode holds a mode API object. lines an array of Line objects\n // (see Line constructor), work an array of lines that should be\n // parsed, and history the undo history (instance of History\n // constructor).\n var mode, lines = [new Line(\"\")], work, history = new History(), focused;\n loadMode();\n // The selection. These are always maintained to point at valid\n // positions. Inverted is used to remember that the user is\n // selecting bottom-to-top.\n var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};\n // Selection-related flags. shiftSelecting obviously tracks\n // whether the user is holding shift. reducedSelection is a hack\n // to get around the fact that we can't create inverted\n // selections. See below.\n var shiftSelecting, reducedSelection, lastDoubleClick;\n // Variables used by startOperation/endOperation to track what\n // happened during the operation.\n var updateInput, changes, textChanged, selectionChanged, leaveInputAlone;\n // Current visible range (may be bigger than the view window).\n var showingFrom = 0, showingTo = 0, lastHeight = 0, curKeyId = null;\n // editing will hold an object describing the things we put in the\n // textarea, to help figure out whether something changed.\n // bracketHighlighted is used to remember that a backet has been\n // marked.\n var editing, bracketHighlighted;\n // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n var maxLine = \"\", maxWidth;\n\n // Initialize the content.\n operation(function(){setValue(options.value || \"\"); updateInput = false;})();\n\n // Register our event handlers.\n connect(scroller, \"mousedown\", operation(onMouseDown));\n // Gecko browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for Gecko.\n if (!gecko) connect(scroller, \"contextmenu\", onContextMenu);\n connect(code, \"dblclick\", operation(onDblClick));\n connect(scroller, \"scroll\", function() {updateDisplay([]); if (options.onScroll) options.onScroll(instance);});\n connect(window, \"resize\", function() {updateDisplay(true);});\n connect(input, \"keyup\", operation(onKeyUp));\n connect(input, \"keydown\", operation(onKeyDown));\n connect(input, \"keypress\", operation(onKeyPress));\n connect(input, \"focus\", onFocus);\n connect(input, \"blur\", onBlur);\n\n connect(scroller, \"dragenter\", e_stop);\n connect(scroller, \"dragover\", e_stop);\n connect(scroller, \"drop\", operation(onDrop));\n connect(scroller, \"paste\", function(){focusInput(); fastPoll();});\n connect(input, \"paste\", function(){fastPoll();});\n connect(input, \"cut\", function(){fastPoll();});\n \n // IE throws unspecified error in certain cases, when \n // trying to access activeElement before onload\n var hasFocus; try { hasFocus = (targetDocument.activeElement == input); } catch(e) { }\n if (hasFocus) setTimeout(onFocus, 20);\n else onBlur();\n\n function isLine(l) {return l >= 0 && l < lines.length;}\n // The instance object that we'll return. Mostly calls out to\n // local functions in the CodeMirror function. Some do some extra\n // range checking and/or clipping. operation is used to wrap the\n // call so that changes it makes are tracked, and the display is\n // updated afterwards.\n var instance = {\n getValue: getValue,\n setValue: operation(setValue),\n getSelection: getSelection,\n replaceSelection: operation(replaceSelection),\n focus: function(){focusInput(); onFocus(); fastPoll();},\n setOption: function(option, value) {\n options[option] = value;\n if (option == \"lineNumbers\" || option == \"gutter\") gutterChanged();\n else if (option == \"mode\" || option == \"indentUnit\") loadMode();\n else if (option == \"readOnly\" && value == \"nocursor\") input.blur();\n else if (option == \"theme\") scroller.className = scroller.className.replace(/cm-s-\\w+/, \"cm-s-\" + value);\n },\n getOption: function(option) {return options[option];},\n undo: operation(undo),\n redo: operation(redo),\n indentLine: operation(function(n) {if (isLine(n)) indentLine(n, \"smart\");}),\n historySize: function() {return {undo: history.done.length, redo: history.undone.length};},\n matchBrackets: operation(function(){matchBrackets(true);}),\n getTokenAt: function(pos) {\n pos = clipPos(pos);\n return lines[pos.line].getTokenAt(mode, getStateBefore(pos.line), pos.ch);\n },\n getStateAfter: function(line) {\n line = clipLine(line == null ? lines.length - 1: line);\n return getStateBefore(line + 1);\n },\n cursorCoords: function(start){\n if (start == null) start = sel.inverted;\n return pageCoords(start ? sel.from : sel.to);\n },\n charCoords: function(pos){return pageCoords(clipPos(pos));},\n coordsChar: function(coords) {\n var off = eltOffset(lineSpace);\n var line = clipLine(Math.min(lines.length - 1, showingFrom + Math.floor((coords.y - off.top) / lineHeight())));\n return clipPos({line: line, ch: charFromX(clipLine(line), coords.x - off.left)});\n },\n getSearchCursor: function(query, pos, caseFold) {return new SearchCursor(query, pos, caseFold);},\n markText: operation(function(a, b, c){return operation(markText(a, b, c));}),\n setMarker: addGutterMarker,\n clearMarker: removeGutterMarker,\n setLineClass: operation(setLineClass),\n lineInfo: lineInfo,\n addWidget: function(pos, node, scroll, where) {\n pos = localCoords(clipPos(pos));\n var top = pos.yBot, left = pos.x;\n node.style.position = \"absolute\";\n code.appendChild(node);\n node.style.left = left + \"px\";\n if (where == \"over\") top = pos.y;\n else if (where == \"near\") {\n var vspace = Math.max(scroller.offsetHeight, lines.length * lineHeight()),\n hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft();\n if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)\n top = pos.y - node.offsetHeight;\n if (left + node.offsetWidth > hspace)\n left = hspace - node.offsetWidth;\n }\n node.style.top = (top + paddingTop()) + \"px\";\n node.style.left = (left + paddingLeft()) + \"px\";\n if (scroll)\n scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);\n },\n\n lineCount: function() {return lines.length;},\n getCursor: function(start) {\n if (start == null) start = sel.inverted;\n return copyPos(start ? sel.from : sel.to);\n },\n somethingSelected: function() {return !posEq(sel.from, sel.to);},\n setCursor: operation(function(line, ch) {\n if (ch == null && typeof line.line == \"number\") setCursor(line.line, line.ch);\n else setCursor(line, ch);\n }),\n setSelection: operation(function(from, to) {setSelection(clipPos(from), clipPos(to || from));}),\n getLine: function(line) {if (isLine(line)) return lines[line].text;},\n setLine: operation(function(line, text) {\n if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: lines[line].text.length});\n }),\n removeLine: operation(function(line) {\n if (isLine(line)) replaceRange(\"\", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));\n }),\n replaceRange: operation(replaceRange),\n getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},\n\n operation: function(f){return operation(f)();},\n refresh: function(){updateDisplay(true);},\n getInputField: function(){return input;},\n getWrapperElement: function(){return wrapper;},\n getScrollerElement: function(){return scroller;}\n };\n\n function setValue(code) {\n history = null;\n var top = {line: 0, ch: 0};\n updateLines(top, {line: lines.length - 1, ch: lines[lines.length-1].text.length},\n splitLines(code), top, top);\n history = new History();\n }\n function getValue(code) {\n var text = [];\n for (var i = 0, l = lines.length; i < l; ++i)\n text.push(lines[i].text);\n return text.join(\"\\n\");\n }\n\n function onMouseDown(e) {\n // Check whether this is a click in a widget\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == code && n != mover) return;\n var ld = lastDoubleClick; lastDoubleClick = null;\n // First, see if this is a click in the gutter\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == gutterText) {\n if (options.onGutterClick)\n options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom);\n return e_preventDefault(e);\n }\n\n var start = posFromMouse(e);\n \n switch (e_button(e)) {\n case 3:\n if (gecko && !mac) onContextMenu(e);\n return;\n case 2:\n if (start) setCursor(start.line, start.ch, true);\n return;\n }\n // For button 1, if it was clicked inside the editor\n // (posFromMouse returning non-null), we have to adjust the\n // selection.\n if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}\n\n if (!focused) onFocus();\n e_preventDefault(e);\n if (ld && +new Date - ld < 400) return selectLine(start.line);\n\n setCursor(start.line, start.ch, true);\n var last = start, going;\n // And then we have to see if it's a drag event, in which case\n // the dragged-over text must be selected.\n function end() {\n focusInput();\n updateInput = true;\n move(); up();\n }\n function extend(e) {\n var cur = posFromMouse(e, true);\n if (cur && !posEq(cur, last)) {\n if (!focused) onFocus();\n last = cur;\n setSelectionUser(start, cur);\n updateInput = false;\n var visible = visibleLines();\n if (cur.line >= visible.to || cur.line < visible.from)\n going = setTimeout(operation(function(){extend(e);}), 150);\n }\n }\n\n var move = connect(targetDocument, \"mousemove\", operation(function(e) {\n clearTimeout(going);\n e_preventDefault(e);\n extend(e);\n }), true);\n var up = connect(targetDocument, \"mouseup\", operation(function(e) {\n clearTimeout(going);\n var cur = posFromMouse(e);\n if (cur) setSelectionUser(start, cur);\n e_preventDefault(e);\n end();\n }), true);\n }\n function onDblClick(e) {\n var pos = posFromMouse(e);\n if (!pos) return;\n selectWordAt(pos);\n e_preventDefault(e);\n lastDoubleClick = +new Date;\n }\n function onDrop(e) {\n e.preventDefault();\n var pos = posFromMouse(e, true), files = e.dataTransfer.files;\n if (!pos || options.readOnly) return;\n if (files && files.length && window.FileReader && window.File) {\n function loadFile(file, i) {\n var reader = new FileReader;\n reader.onload = function() {\n text[i] = reader.result;\n if (++read == n) replaceRange(text.join(\"\"), clipPos(pos), clipPos(pos));\n };\n reader.readAsText(file);\n }\n var n = files.length, text = Array(n), read = 0;\n for (var i = 0; i < n; ++i) loadFile(files[i], i);\n }\n else {\n try {\n var text = e.dataTransfer.getData(\"Text\");\n if (text) replaceRange(text, pos, pos);\n }\n catch(e){}\n }\n }\n function onKeyDown(e) {\n if (!focused) onFocus();\n\n var code = e.keyCode;\n // IE does strange things with escape.\n if (ie && code == 27) { e.returnValue = false; }\n // Tries to detect ctrl on non-mac, cmd on mac.\n var mod = (mac ? e.metaKey : e.ctrlKey) && !e.altKey, anyMod = e.ctrlKey || e.altKey || e.metaKey;\n if (code == 16 || e.shiftKey) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);\n else shiftSelecting = null;\n // First give onKeyEvent option a chance to handle this.\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n\n if (code == 33 || code == 34) {scrollPage(code == 34); return e_preventDefault(e);} // page up/down\n if (mod && ((code == 36 || code == 35) || // ctrl-home/end\n mac && (code == 38 || code == 40))) { // cmd-up/down\n scrollEnd(code == 36 || code == 38); return e_preventDefault(e);\n }\n if (mod && code == 65) {selectAll(); return e_preventDefault(e);} // ctrl-a\n if (!options.readOnly) {\n if (!anyMod && code == 13) {return;} // enter\n if (!anyMod && code == 9 && handleTab(e.shiftKey)) return e_preventDefault(e); // tab\n if (mod && code == 90) {undo(); return e_preventDefault(e);} // ctrl-z\n if (mod && ((e.shiftKey && code == 90) || code == 89)) {redo(); return e_preventDefault(e);} // ctrl-shift-z, ctrl-y\n }\n\n // Key id to use in the movementKeys map. We also pass it to\n // fastPoll in order to 'self learn'. We need this because\n // reducedSelection, the hack where we collapse the selection to\n // its start when it is inverted and a movement key is pressed\n // (and later restore it again), shouldn't be used for\n // non-movement keys.\n curKeyId = (mod ? \"c\" : \"\") + code;\n if (sel.inverted && movementKeys.hasOwnProperty(curKeyId)) {\n var range = selRange(input);\n if (range) {\n reducedSelection = {anchor: range.start};\n setSelRange(input, range.start, range.start);\n }\n }\n fastPoll(curKeyId);\n }\n function onKeyUp(e) {\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n if (reducedSelection) {\n reducedSelection = null;\n updateInput = true;\n }\n if (e.keyCode == 16) shiftSelecting = null;\n }\n function onKeyPress(e) {\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n if (options.electricChars && mode.electricChars) {\n var ch = String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode);\n if (mode.electricChars.indexOf(ch) > -1)\n setTimeout(operation(function() {indentLine(sel.to.line, \"smart\");}), 50);\n }\n var code = e.keyCode;\n // Re-stop tab and enter. Necessary on some browsers.\n if (code == 13) {if (!options.readOnly) handleEnter(); e_preventDefault(e);}\n else if (!e.ctrlKey && !e.altKey && !e.metaKey && code == 9 && options.tabMode != \"default\") e_preventDefault(e);\n else fastPoll(curKeyId);\n }\n\n function onFocus() {\n if (options.readOnly == \"nocursor\") return;\n if (!focused) {\n if (options.onFocus) options.onFocus(instance);\n focused = true;\n if (wrapper.className.search(/\\bCodeMirror-focused\\b/) == -1)\n wrapper.className += \" CodeMirror-focused\";\n if (!leaveInputAlone) prepareInput();\n }\n slowPoll();\n restartBlink();\n }\n function onBlur() {\n if (focused) {\n if (options.onBlur) options.onBlur(instance);\n focused = false;\n wrapper.className = wrapper.className.replace(\" CodeMirror-focused\", \"\");\n }\n clearInterval(blinker);\n setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);\n }\n\n // Replace the range from from to to by the strings in newText.\n // Afterwards, set the selection to selFrom, selTo.\n function updateLines(from, to, newText, selFrom, selTo) {\n if (history) {\n var old = [];\n for (var i = from.line, e = to.line + 1; i < e; ++i) old.push(lines[i].text);\n history.addChange(from.line, newText.length, old);\n while (history.done.length > options.undoDepth) history.done.shift();\n }\n updateLinesNoUndo(from, to, newText, selFrom, selTo);\n }\n function unredoHelper(from, to) {\n var change = from.pop();\n if (change) {\n var replaced = [], end = change.start + change.added;\n for (var i = change.start; i < end; ++i) replaced.push(lines[i].text);\n to.push({start: change.start, added: change.old.length, old: replaced});\n var pos = clipPos({line: change.start + change.old.length - 1,\n ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])});\n updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: lines[end-1].text.length}, change.old, pos, pos);\n updateInput = true;\n }\n }\n function undo() {unredoHelper(history.done, history.undone);}\n function redo() {unredoHelper(history.undone, history.done);}\n\n function updateLinesNoUndo(from, to, newText, selFrom, selTo) {\n var recomputeMaxLength = false, maxLineLength = maxLine.length;\n for (var i = from.line; i <= to.line; ++i) {\n if (lines[i].text.length == maxLineLength) {recomputeMaxLength = true; break;}\n }\n\n var nlines = to.line - from.line, firstLine = lines[from.line], lastLine = lines[to.line];\n // First adjust the line structure, taking some care to leave highlighting intact.\n if (firstLine == lastLine) {\n if (newText.length == 1)\n firstLine.replace(from.ch, to.ch, newText[0]);\n else {\n lastLine = firstLine.split(to.ch, newText[newText.length-1]);\n var spliceargs = [from.line + 1, nlines];\n firstLine.replace(from.ch, firstLine.text.length, newText[0]);\n for (var i = 1, e = newText.length - 1; i < e; ++i) spliceargs.push(new Line(newText[i]));\n spliceargs.push(lastLine);\n lines.splice.apply(lines, spliceargs);\n }\n }\n else if (newText.length == 1) {\n firstLine.replace(from.ch, firstLine.text.length, newText[0] + lastLine.text.slice(to.ch));\n lines.splice(from.line + 1, nlines);\n }\n else {\n var spliceargs = [from.line + 1, nlines - 1];\n firstLine.replace(from.ch, firstLine.text.length, newText[0]);\n lastLine.replace(0, to.ch, newText[newText.length-1]);\n for (var i = 1, e = newText.length - 1; i < e; ++i) spliceargs.push(new Line(newText[i]));\n lines.splice.apply(lines, spliceargs);\n }\n\n\n for (var i = from.line, e = i + newText.length; i < e; ++i) {\n var l = lines[i].text;\n if (l.length > maxLineLength) {\n maxLine = l; maxLineLength = l.length; maxWidth = null;\n recomputeMaxLength = false;\n }\n }\n if (recomputeMaxLength) {\n maxLineLength = 0; maxLine = \"\"; maxWidth = null;\n for (var i = 0, e = lines.length; i < e; ++i) {\n var l = lines[i].text;\n if (l.length > maxLineLength) {\n maxLineLength = l.length; maxLine = l;\n }\n }\n }\n\n // Add these lines to the work array, so that they will be\n // highlighted. Adjust work lines if lines were added/removed.\n var newWork = [], lendiff = newText.length - nlines - 1;\n for (var i = 0, l = work.length; i < l; ++i) {\n var task = work[i];\n if (task < from.line) newWork.push(task);\n else if (task > to.line) newWork.push(task + lendiff);\n }\n if (newText.length < 5) {\n highlightLines(from.line, from.line + newText.length);\n newWork.push(from.line + newText.length);\n } else {\n newWork.push(from.line);\n }\n work = newWork;\n startWorker(100);\n // Remember that these lines changed, for updating the display\n changes.push({from: from.line, to: to.line + 1, diff: lendiff});\n textChanged = {from: from, to: to, text: newText};\n\n // Update the selection\n function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}\n setSelection(selFrom, selTo, updateLine(sel.from.line), updateLine(sel.to.line));\n\n // Make sure the scroll-size div has the correct height.\n code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + \"px\";\n }\n\n function replaceRange(code, from, to) {\n from = clipPos(from);\n if (!to) to = from; else to = clipPos(to);\n code = splitLines(code);\n function adjustPos(pos) {\n if (posLess(pos, from)) return pos;\n if (!posLess(to, pos)) return end;\n var line = pos.line + code.length - (to.line - from.line) - 1;\n var ch = pos.ch;\n if (pos.line == to.line)\n ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));\n return {line: line, ch: ch};\n }\n var end;\n replaceRange1(code, from, to, function(end1) {\n end = end1;\n return {from: adjustPos(sel.from), to: adjustPos(sel.to)};\n });\n return end;\n }\n function replaceSelection(code, collapse) {\n replaceRange1(splitLines(code), sel.from, sel.to, function(end) {\n if (collapse == \"end\") return {from: end, to: end};\n else if (collapse == \"start\") return {from: sel.from, to: sel.from};\n else return {from: sel.from, to: end};\n });\n }\n function replaceRange1(code, from, to, computeSel) {\n var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;\n var newSel = computeSel({line: from.line + code.length - 1, ch: endch});\n updateLines(from, to, code, newSel.from, newSel.to);\n }\n\n function getRange(from, to) {\n var l1 = from.line, l2 = to.line;\n if (l1 == l2) return lines[l1].text.slice(from.ch, to.ch);\n var code = [lines[l1].text.slice(from.ch)];\n for (var i = l1 + 1; i < l2; ++i) code.push(lines[i].text);\n code.push(lines[l2].text.slice(0, to.ch));\n return code.join(\"\\n\");\n }\n function getSelection() {\n return getRange(sel.from, sel.to);\n }\n\n var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll\n function slowPoll() {\n if (pollingFast) return;\n poll.set(2000, function() {\n startOperation();\n readInput();\n if (focused) slowPoll();\n endOperation();\n });\n }\n function fastPoll(keyId) {\n var missed = false;\n pollingFast = true;\n function p() {\n startOperation();\n var changed = readInput();\n if (changed == \"moved\" && keyId) movementKeys[keyId] = true;\n if (!changed && !missed) {missed = true; poll.set(80, p);}\n else {pollingFast = false; slowPoll();}\n endOperation();\n }\n poll.set(20, p);\n }\n\n // Inspects the textarea, compares its state (content, selection)\n // to the data in the editing variable, and updates the editor\n // content or cursor if something changed.\n function readInput() {\n if (leaveInputAlone || !focused) return;\n var changed = false, text = input.value, sr = selRange(input);\n if (!sr) return false;\n var changed = editing.text != text, rs = reducedSelection;\n var moved = changed || sr.start != editing.start || sr.end != (rs ? editing.start : editing.end);\n if (!moved && !rs) return false;\n if (changed) {\n shiftSelecting = reducedSelection = null;\n if (options.readOnly) {updateInput = true; return \"changed\";}\n }\n\n // Compute selection start and end based on start/end offsets in textarea\n function computeOffset(n, startLine) {\n var pos = 0;\n for (;;) {\n var found = text.indexOf(\"\\n\", pos);\n if (found == -1 || (text.charAt(found-1) == \"\\r\" ? found - 1 : found) >= n)\n return {line: startLine, ch: n - pos};\n ++startLine;\n pos = found + 1;\n }\n }\n var from = computeOffset(sr.start, editing.from),\n to = computeOffset(sr.end, editing.from);\n // Here we have to take the reducedSelection hack into account,\n // so that you can, for example, press shift-up at the start of\n // your selection and have the right thing happen.\n if (rs) {\n var head = sr.start == rs.anchor ? to : from;\n var tail = shiftSelecting ? sel.to : sr.start == rs.anchor ? from : to;\n if (sel.inverted = posLess(head, tail)) { from = head; to = tail; }\n else { reducedSelection = null; from = tail; to = head; }\n }\n\n // In some cases (cursor on same line as before), we don't have\n // to update the textarea content at all.\n if (from.line == to.line && from.line == sel.from.line && from.line == sel.to.line && !shiftSelecting)\n updateInput = false;\n\n // Magic mess to extract precise edited range from the changed\n // string.\n if (changed) {\n var start = 0, end = text.length, len = Math.min(end, editing.text.length);\n var c, line = editing.from, nl = -1;\n while (start < len && (c = text.charAt(start)) == editing.text.charAt(start)) {\n ++start;\n if (c == \"\\n\") {line++; nl = start;}\n }\n var ch = nl > -1 ? start - nl : start, endline = editing.to - 1, edend = editing.text.length;\n for (;;) {\n c = editing.text.charAt(edend);\n if (text.charAt(end) != c) {++end; ++edend; break;}\n if (c == \"\\n\") endline--;\n if (edend <= start || end <= start) break;\n --end; --edend;\n }\n var nl = editing.text.lastIndexOf(\"\\n\", edend - 1), endch = nl == -1 ? edend : edend - nl - 1;\n updateLines({line: line, ch: ch}, {line: endline, ch: endch}, splitLines(text.slice(start, end)), from, to);\n if (line != endline || from.line != line) updateInput = true;\n }\n else setSelection(from, to);\n\n editing.text = text; editing.start = sr.start; editing.end = sr.end;\n return changed ? \"changed\" : moved ? \"moved\" : false;\n }\n\n // Set the textarea content and selection range to match the\n // editor state.\n function prepareInput() {\n var text = [];\n var from = Math.max(0, sel.from.line - 1), to = Math.min(lines.length, sel.to.line + 2);\n for (var i = from; i < to; ++i) text.push(lines[i].text);\n text = input.value = text.join(lineSep);\n var startch = sel.from.ch, endch = sel.to.ch;\n for (var i = from; i < sel.from.line; ++i)\n startch += lineSep.length + lines[i].text.length;\n for (var i = from; i < sel.to.line; ++i)\n endch += lineSep.length + lines[i].text.length;\n editing = {text: text, from: from, to: to, start: startch, end: endch};\n setSelRange(input, startch, reducedSelection ? startch : endch);\n }\n function focusInput() {\n if (options.readOnly != \"nocursor\") input.focus();\n }\n\n function scrollCursorIntoView() {\n var cursor = localCoords(sel.inverted ? sel.from : sel.to);\n return scrollIntoView(cursor.x, cursor.y, cursor.x, cursor.yBot);\n }\n function scrollIntoView(x1, y1, x2, y2) {\n var pl = paddingLeft(), pt = paddingTop(), lh = lineHeight();\n y1 += pt; y2 += pt; x1 += pl; x2 += pl;\n var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true;\n if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1 - 2*lh); scrolled = true;}\n else if (y2 > screentop + screen) {scroller.scrollTop = y2 + lh - screen; scrolled = true;}\n\n var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;\n if (x1 < screenleft) {\n if (x1 < 50) x1 = 0;\n scroller.scrollLeft = Math.max(0, x1 - 10);\n scrolled = true;\n }\n else if (x2 > screenw + screenleft) {\n scroller.scrollLeft = x2 + 10 - screenw;\n scrolled = true;\n if (x2 > code.clientWidth) result = false;\n }\n if (scrolled && options.onScroll) options.onScroll(instance);\n return result;\n }\n\n function visibleLines() {\n var lh = lineHeight(), top = scroller.scrollTop - paddingTop();\n return {from: Math.min(lines.length, Math.max(0, Math.floor(top / lh))),\n to: Math.min(lines.length, Math.ceil((top + scroller.clientHeight) / lh))};\n }\n // Uses a set of changes plus the current scroll position to\n // determine which DOM updates have to be made, and makes the\n // updates.\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 }\n\n function refreshDisplay(from, to) {\n var html = [], start = {line: from, ch: 0}, inSel = posLess(sel.from, start) && !posLess(sel.to, start);\n for (var i = from; i < to; ++i) {\n var ch1 = null, ch2 = null;\n if (inSel) {\n ch1 = 0;\n if (sel.to.line == i) {inSel = false; ch2 = sel.to.ch;}\n }\n else if (sel.from.line == i) {\n if (sel.to.line == i) {ch1 = sel.from.ch; ch2 = sel.to.ch;}\n else {inSel = true; ch1 = sel.from.ch;}\n }\n html.push(lines[i].getHTML(ch1, ch2, true));\n }\n lineDiv.innerHTML = html.join(\"\");\n }\n function patchDisplay(updates) {\n // Slightly different algorithm for IE (badInnerHTML), since\n // there .innerHTML on PRE nodes is dumb, and discards\n // whitespace.\n var sfrom = sel.from.line, sto = sel.to.line, off = 0,\n scratch = badInnerHTML && targetDocument.createElement(\"div\");\n for (var i = 0, e = updates.length; i < e; ++i) {\n var rec = updates[i];\n var extra = (rec.to - rec.from) - rec.domSize;\n var nodeAfter = lineDiv.childNodes[rec.domStart + rec.domSize + off] || null;\n if (badInnerHTML)\n for (var j = Math.max(-extra, rec.domSize); j > 0; --j)\n lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild);\n else if (extra) {\n for (var j = Math.max(0, extra); j > 0; --j)\n lineDiv.insertBefore(targetDocument.createElement(\"pre\"), nodeAfter);\n for (var j = Math.max(0, -extra); j > 0; --j)\n lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild);\n }\n var node = lineDiv.childNodes[rec.domStart + off], inSel = sfrom < rec.from && sto >= rec.from;\n for (var j = rec.from; j < rec.to; ++j) {\n var ch1 = null, ch2 = null;\n if (inSel) {\n ch1 = 0;\n if (sto == j) {inSel = false; ch2 = sel.to.ch;}\n }\n else if (sfrom == j) {\n if (sto == j) {ch1 = sel.from.ch; ch2 = sel.to.ch;}\n else {inSel = true; ch1 = sel.from.ch;}\n }\n if (badInnerHTML) {\n scratch.innerHTML = lines[j].getHTML(ch1, ch2, true);\n lineDiv.insertBefore(scratch.firstChild, nodeAfter);\n }\n else {\n node.innerHTML = lines[j].getHTML(ch1, ch2, false);\n node.className = lines[j].className || \"\";\n node = node.nextSibling;\n }\n }\n off += extra;\n }\n }\n\n function updateGutter() {\n if (!options.gutter && !options.lineNumbers) return;\n var hText = mover.offsetHeight, hEditor = scroller.clientHeight;\n gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + \"px\";\n var html = [];\n for (var i = showingFrom; i < Math.max(showingTo, showingFrom + 1); ++i) {\n var marker = lines[i].gutterMarker;\n var text = options.lineNumbers ? i + options.firstLineNumber : null;\n if (marker && marker.text)\n text = marker.text.replace(\"%N%\", text != null ? text : \"\");\n else if (text == null)\n text = \"\\u00a0\";\n html.push((marker && marker.style ? '<pre class=\"' + marker.style + '\">' : \"<pre>\"), text, \"</pre>\");\n }\n gutter.style.display = \"none\";\n gutterText.innerHTML = html.join(\"\");\n var minwidth = String(lines.length).length, firstNode = gutterText.firstChild, val = eltText(firstNode), pad = \"\";\n while (val.length + pad.length < minwidth) pad += \"\\u00a0\";\n if (pad) firstNode.insertBefore(targetDocument.createTextNode(pad), firstNode.firstChild);\n gutter.style.display = \"\";\n lineSpace.style.marginLeft = gutter.offsetWidth + \"px\";\n }\n function updateCursor() {\n var head = sel.inverted ? sel.from : sel.to, lh = lineHeight();\n var x = charX(head.line, head.ch) + \"px\", y = (head.line - showingFrom) * lh + \"px\";\n inputDiv.style.top = (head.line * lh - scroller.scrollTop) + \"px\";\n if (posEq(sel.from, sel.to)) {\n cursor.style.top = y; cursor.style.left = x;\n cursor.style.display = \"\";\n }\n else cursor.style.display = \"none\";\n }\n\n function setSelectionUser(from, to) {\n var sh = shiftSelecting && clipPos(shiftSelecting);\n if (sh) {\n if (posLess(sh, from)) from = sh;\n else if (posLess(to, sh)) to = sh;\n }\n setSelection(from, to);\n }\n // Update the selection. Last two args are only used by\n // updateLines, since they have to be expressed in the line\n // numbers before the update.\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 }\n function setCursor(line, ch, user) {\n var pos = clipPos({line: line, ch: ch || 0});\n (user ? setSelectionUser : setSelection)(pos, pos);\n }\n\n function clipLine(n) {return Math.max(0, Math.min(n, lines.length-1));}\n function clipPos(pos) {\n if (pos.line < 0) return {line: 0, ch: 0};\n if (pos.line >= lines.length) return {line: lines.length-1, ch: lines[lines.length-1].text.length};\n var ch = pos.ch, linelen = lines[pos.line].text.length;\n if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};\n else if (ch < 0) return {line: pos.line, ch: 0};\n else return pos;\n }\n\n function scrollPage(down) {\n var linesPerPage = Math.floor(scroller.clientHeight / lineHeight()), head = sel.inverted ? sel.from : sel.to;\n setCursor(head.line + (Math.max(linesPerPage - 1, 1) * (down ? 1 : -1)), head.ch, true);\n }\n function scrollEnd(top) {\n var pos = top ? {line: 0, ch: 0} : {line: lines.length - 1, ch: lines[lines.length-1].text.length};\n setSelectionUser(pos, pos);\n }\n function selectAll() {\n var endLine = lines.length - 1;\n setSelection({line: 0, ch: 0}, {line: endLine, ch: lines[endLine].text.length});\n }\n function selectWordAt(pos) {\n var line = lines[pos.line].text;\n var start = pos.ch, end = pos.ch;\n while (start > 0 && /\\w/.test(line.charAt(start - 1))) --start;\n while (end < line.length && /\\w/.test(line.charAt(end))) ++end;\n setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end});\n }\n function selectLine(line) {\n setSelectionUser({line: line, ch: 0}, {line: line, ch: lines[line].text.length});\n }\n function handleEnter() {\n replaceSelection(\"\\n\", \"end\");\n if (options.enterMode != \"flat\")\n indentLine(sel.from.line, options.enterMode == \"keep\" ? \"prev\" : \"smart\");\n }\n function handleTab(shift) {\n function indentSelected(mode) {\n if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);\n var e = sel.to.line - (sel.to.ch ? 0 : 1);\n for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);\n }\n shiftSelecting = null;\n switch (options.tabMode) {\n case \"default\":\n return false;\n case \"indent\":\n indentSelected(\"smart\");\n break;\n case \"classic\":\n if (posEq(sel.from, sel.to)) {\n if (shift) indentLine(sel.from.line, \"smart\");\n else replaceSelection(\"\\t\", \"end\");\n break;\n }\n case \"shift\":\n indentSelected(shift ? \"subtract\" : \"add\");\n break;\n }\n return true;\n }\n\n function indentLine(n, how) {\n if (how == \"smart\") {\n if (!mode.indent) how = \"prev\";\n else var state = getStateBefore(n);\n }\n\n var line = lines[n], curSpace = line.indentation(), curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (how == \"prev\") {\n if (n) indentation = lines[n-1].indentation();\n else indentation = 0;\n }\n else if (how == \"smart\") indentation = mode.indent(state, line.text.slice(curSpaceString.length));\n else if (how == \"add\") indentation = curSpace + options.indentUnit;\n else if (how == \"subtract\") indentation = curSpace - options.indentUnit;\n indentation = Math.max(0, indentation);\n var diff = indentation - curSpace;\n\n if (!diff) {\n if (sel.from.line != n && sel.to.line != n) return;\n var indentString = curSpaceString;\n }\n else {\n var indentString = \"\", pos = 0;\n if (options.indentWithTabs)\n for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n while (pos < indentation) {++pos; indentString += \" \";}\n }\n\n replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});\n }\n\n function loadMode() {\n mode = CodeMirror.getMode(options, options.mode);\n for (var i = 0, l = lines.length; i < l; ++i)\n lines[i].stateAfter = null;\n work = [0];\n startWorker();\n }\n function gutterChanged() {\n var visible = options.gutter || options.lineNumbers;\n gutter.style.display = visible ? \"\" : \"none\";\n if (visible) updateGutter();\n else lineDiv.parentNode.style.marginLeft = 0;\n }\n\n function markText(from, to, className) {\n from = clipPos(from); to = clipPos(to);\n var accum = [];\n function add(line, from, to, className) {\n var line = lines[line], mark = line.addMark(from, to, className);\n mark.line = line;\n accum.push(mark);\n }\n if (from.line == to.line) add(from.line, from.ch, to.ch, className);\n else {\n add(from.line, from.ch, null, className);\n for (var i = from.line + 1, e = to.line; i < e; ++i)\n add(i, 0, null, className);\n add(to.line, 0, to.ch, className);\n }\n changes.push({from: from.line, to: to.line + 1});\n return function() {\n var start, end;\n for (var i = 0; i < accum.length; ++i) {\n var mark = accum[i], found = indexOf(lines, mark.line);\n mark.line.removeMark(mark);\n if (found > -1) {\n if (start == null) start = found;\n end = found;\n }\n }\n if (start != null) changes.push({from: start, to: end + 1});\n };\n }\n\n function addGutterMarker(line, text, className) {\n if (typeof line == \"number\") line = lines[clipLine(line)];\n line.gutterMarker = {text: text, style: className};\n updateGutter();\n return line;\n }\n function removeGutterMarker(line) {\n if (typeof line == \"number\") line = lines[clipLine(line)];\n line.gutterMarker = null;\n updateGutter();\n }\n function setLineClass(line, className) {\n if (typeof line == \"number\") {\n var no = line;\n line = lines[clipLine(line)];\n }\n else {\n var no = indexOf(lines, line);\n if (no == -1) return null;\n }\n if (line.className != className) {\n line.className = className;\n changes.push({from: no, to: no + 1});\n }\n return line;\n }\n\n function lineInfo(line) {\n if (typeof line == \"number\") {\n var n = line;\n line = lines[line];\n if (!line) return null;\n }\n else {\n var n = indexOf(lines, line);\n if (n == -1) return null;\n }\n var marker = line.gutterMarker;\n return {line: n, text: line.text, markerText: marker && marker.text, markerClass: marker && marker.style};\n }\n\n function stringWidth(str) {\n measure.innerHTML = \"<pre><span>x</span></pre>\";\n measure.firstChild.firstChild.firstChild.nodeValue = str;\n return measure.firstChild.firstChild.offsetWidth || 10;\n }\n // These are used to go from pixel positions to character\n // positions, taking varying character widths into account.\n function charX(line, pos) {\n if (pos == 0) return 0;\n measure.innerHTML = \"<pre><span>\" + lines[line].getHTML(null, null, false, pos) + \"</span></pre>\";\n return measure.firstChild.firstChild.offsetWidth;\n }\n function charFromX(line, x) {\n if (x <= 0) return 0;\n var lineObj = lines[line], text = lineObj.text;\n function getX(len) {\n measure.innerHTML = \"<pre><span>\" + lineObj.getHTML(null, null, false, len) + \"</span></pre>\";\n return measure.firstChild.firstChild.offsetWidth;\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 / stringWidth(\"x\")));\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 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 (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 }\n\n function localCoords(pos, inLineWrap) {\n var lh = lineHeight(), line = pos.line - (inLineWrap ? showingFrom : 0);\n return {x: charX(pos.line, pos.ch), y: line * lh, yBot: (line + 1) * lh};\n }\n function pageCoords(pos) {\n var local = localCoords(pos, true), off = eltOffset(lineSpace);\n return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};\n }\n\n function lineHeight() {\n var nlines = lineDiv.childNodes.length;\n if (nlines) return (lineDiv.offsetHeight / nlines) || 1;\n measure.innerHTML = \"<pre>x</pre>\";\n return measure.firstChild.offsetHeight || 1;\n }\n function paddingTop() {return lineSpace.offsetTop;}\n function paddingLeft() {return lineSpace.offsetLeft;}\n\n function posFromMouse(e, liberal) {\n var offW = eltOffset(scroller, true), x, y;\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX; y = e.clientY; } catch (e) { return null; }\n // This is a mess of a heuristic to try and determine whether a\n // scroll-bar was clicked or not, and to return null if one was\n // (and !liberal).\n if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))\n return null;\n var offL = eltOffset(lineSpace, true);\n var line = showingFrom + Math.floor((y - offL.top) / lineHeight());\n return clipPos({line: line, ch: charFromX(clipLine(line), x - offL.left)});\n }\n function onContextMenu(e) {\n var pos = posFromMouse(e);\n if (!pos || window.opera) return; // Opera is difficult.\n if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))\n operation(setCursor)(pos.line, pos.ch);\n\n var oldCSS = input.style.cssText;\n inputDiv.style.position = \"absolute\";\n input.style.cssText = \"position: fixed; width: 30px; height: 30px; top: \" + (e_pageY(e) - 1) +\n \"px; left: \" + (e_pageX(e) - 1) + \"px; z-index: 1000; background: white; \" +\n \"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n leaveInputAlone = true;\n var val = input.value = getSelection();\n focusInput();\n setSelRange(input, 0, input.value.length);\n function rehide() {\n var newVal = splitLines(input.value).join(\"\\n\");\n if (newVal != val) operation(replaceSelection)(newVal, \"end\");\n inputDiv.style.position = \"relative\";\n input.style.cssText = oldCSS;\n leaveInputAlone = false;\n prepareInput();\n slowPoll();\n }\n \n if (gecko) {\n e_stop(e);\n var mouseup = connect(window, \"mouseup\", function() {\n mouseup();\n setTimeout(rehide, 20);\n }, true);\n }\n else {\n setTimeout(rehide, 50);\n }\n }\n\n // Cursor-blinking\n function restartBlink() {\n clearInterval(blinker);\n var on = true;\n cursor.style.visibility = \"\";\n blinker = setInterval(function() {\n cursor.style.visibility = (on = !on) ? \"\" : \"hidden\";\n }, 650);\n }\n\n var matching = {\"(\": \")>\", \")\": \"(<\", \"[\": \"]>\", \"]\": \"[<\", \"{\": \"}>\", \"}\": \"{<\"};\n function matchBrackets(autoclear) {\n var head = sel.inverted ? sel.from : sel.to, line = lines[head.line], pos = head.ch - 1;\n var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];\n if (!match) return;\n var ch = match.charAt(0), forward = match.charAt(1) == \">\", d = forward ? 1 : -1, st = line.styles;\n for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)\n if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}\n\n var stack = [line.text.charAt(pos)], re = /[(){}[\\]]/;\n function scan(line, from, to) {\n if (!line.text) return;\n var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;\n for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {\n var text = st[i];\n if (st[i+1] != null && st[i+1] != style) {pos += d * text.length; continue;}\n for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {\n if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {\n var match = matching[cur];\n if (match.charAt(1) == \">\" == forward) stack.push(cur);\n else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};\n else if (!stack.length) return {pos: pos, match: true};\n }\n }\n }\n }\n for (var i = head.line, e = forward ? Math.min(i + 100, lines.length) : Math.max(-1, i - 100); i != e; i+=d) {\n var line = lines[i], first = i == head.line;\n var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);\n if (found) break;\n }\n if (!found) found = {pos: null, match: false};\n var style = found.match ? \"CodeMirror-matchingbracket\" : \"CodeMirror-nonmatchingbracket\";\n var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),\n two = found.pos != null\n ? markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style)\n : function() {};\n var clear = operation(function(){one(); two();});\n if (autoclear) setTimeout(clear, 800);\n else bracketHighlighted = clear;\n }\n\n // Finds the line to start with when starting a parse. Tries to\n // find a line with a stateAfter, so that it can start with a\n // valid state. If that fails, it returns the line with the\n // smallest indentation, which tends to need the least context to\n // parse correctly.\n function findStartLine(n) {\n var minindent, minline;\n for (var search = n, lim = n - 40; search > lim; --search) {\n if (search == 0) return 0;\n var line = lines[search-1];\n if (line.stateAfter) return search;\n var indented = line.indentation();\n if (minline == null || minindent > indented) {\n minline = search;\n minindent = indented;\n }\n }\n return minline;\n }\n function getStateBefore(n) {\n var start = findStartLine(n), state = start && lines[start-1].stateAfter;\n if (!state) state = startState(mode);\n else state = copyState(mode, state);\n for (var i = start; i < n; ++i) {\n var line = lines[i];\n line.highlight(mode, state);\n line.stateAfter = copyState(mode, state);\n }\n if (n < lines.length && !lines[n].stateAfter) work.push(n);\n return state;\n }\n function highlightLines(start, end) {\n var state = getStateBefore(start);\n for (var i = start; i < end; ++i) {\n var line = lines[i];\n line.highlight(mode, state);\n line.stateAfter = copyState(mode, state);\n }\n }\n function highlightWorker() {\n var end = +new Date + options.workTime;\n var foundWork = work.length;\n while (work.length) {\n if (!lines[showingFrom].stateAfter) var task = showingFrom;\n else var task = work.pop();\n if (task >= lines.length) continue;\n var start = findStartLine(task), state = start && lines[start-1].stateAfter;\n if (state) state = copyState(mode, state);\n else state = startState(mode);\n\n var unchanged = 0, compare = mode.compareStates;\n for (var i = start, l = lines.length; i < l; ++i) {\n var line = lines[i], hadState = line.stateAfter;\n if (+new Date > end) {\n work.push(i);\n startWorker(options.workDelay);\n changes.push({from: task, to: i + 1});\n return;\n }\n var changed = line.highlight(mode, state);\n line.stateAfter = copyState(mode, state);\n if (compare) {\n if (hadState && compare(hadState, state)) break;\n } else {\n if (changed || !hadState) unchanged = 0;\n else if (++unchanged > 3) break;\n }\n }\n changes.push({from: task, to: i + 1});\n }\n if (foundWork && options.onHighlightComplete)\n options.onHighlightComplete(instance);\n }\n function startWorker(time) {\n if (!work.length) return;\n highlight.set(time, operation(highlightWorker));\n }\n\n // Operations are used to wrap changes in such a way that each\n // change won't have to update the cursor and display (which would\n // be awkward, slow, and error-prone), but instead updates are\n // batched and then all combined and executed at once.\n function startOperation() {\n updateInput = null; changes = []; textChanged = selectionChanged = false;\n }\n function endOperation() {\n var reScroll = false;\n if (selectionChanged) reScroll = !scrollCursorIntoView();\n if (changes.length) updateDisplay(changes);\n else if (selectionChanged) updateCursor();\n if (reScroll) scrollCursorIntoView();\n if (selectionChanged) restartBlink();\n\n // updateInput can be set to a boolean value to force/prevent an\n // update.\n if (focused && !leaveInputAlone &&\n (updateInput === true || (updateInput !== false && selectionChanged)))\n prepareInput();\n\n if (selectionChanged && options.matchBrackets)\n setTimeout(operation(function() {\n if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}\n matchBrackets(false);\n }), 20);\n var tc = textChanged; // textChanged can be reset by cursoractivity callback\n if (selectionChanged && options.onCursorActivity)\n options.onCursorActivity(instance);\n if (tc && options.onChange && instance)\n options.onChange(instance, tc);\n }\n var nestedOperation = 0;\n function operation(f) {\n return function() {\n if (!nestedOperation++) startOperation();\n try {var result = f.apply(this, arguments);}\n finally {if (!--nestedOperation) endOperation();}\n return result;\n };\n }\n\n function SearchCursor(query, pos, caseFold) {\n this.atOccurrence = false;\n if (caseFold == null) caseFold = typeof query == \"string\" && query == query.toLowerCase();\n\n if (pos && typeof pos == \"object\") pos = clipPos(pos);\n else pos = {line: 0, ch: 0};\n this.pos = {from: pos, to: pos};\n\n // The matches method is filled in based on the type of query.\n // It takes a position and a direction, and returns an object\n // describing the next occurrence of the query, or null if no\n // more matches were found.\n if (typeof query != \"string\") // Regexp match\n this.matches = function(reverse, pos) {\n if (reverse) {\n var line = lines[pos.line].text.slice(0, pos.ch), match = line.match(query), start = 0;\n while (match) {\n var ind = line.indexOf(match[0]);\n start += ind;\n line = line.slice(ind + 1);\n var newmatch = line.match(query);\n if (newmatch) match = newmatch;\n else break;\n start++;\n }\n }\n else {\n var line = lines[pos.line].text.slice(pos.ch), match = line.match(query),\n start = match && pos.ch + line.indexOf(match[0]);\n }\n if (match)\n return {from: {line: pos.line, ch: start},\n to: {line: pos.line, ch: start + match[0].length},\n match: match};\n };\n else { // String query\n if (caseFold) query = query.toLowerCase();\n var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};\n var target = query.split(\"\\n\");\n // Different methods for single-line and multi-line queries\n if (target.length == 1)\n this.matches = function(reverse, pos) {\n var line = fold(lines[pos.line].text), len = query.length, match;\n if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)\n : (match = line.indexOf(query, pos.ch)) != -1)\n return {from: {line: pos.line, ch: match},\n to: {line: pos.line, ch: match + len}};\n };\n else\n this.matches = function(reverse, pos) {\n var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(lines[ln].text);\n var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));\n if (reverse ? offsetA >= pos.ch || offsetA != match.length\n : offsetA <= pos.ch || offsetA != line.length - match.length)\n return;\n for (;;) {\n if (reverse ? !ln : ln == lines.length - 1) return;\n line = fold(lines[ln += reverse ? -1 : 1].text);\n match = target[reverse ? --idx : ++idx];\n if (idx > 0 && idx < target.length - 1) {\n if (line != match) return;\n else continue;\n }\n var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);\n if (reverse ? offsetB != line.length - match.length : offsetB != match.length)\n return;\n var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB};\n return {from: reverse ? end : start, to: reverse ? start : end};\n }\n };\n }\n }\n\n SearchCursor.prototype = {\n findNext: function() {return this.find(false);},\n findPrevious: function() {return this.find(true);},\n\n find: function(reverse) {\n var self = this, pos = clipPos(reverse ? this.pos.from : this.pos.to);\n function savePosAndFail(line) {\n var pos = {line: line, ch: 0};\n self.pos = {from: pos, to: pos};\n self.atOccurrence = false;\n return false;\n }\n\n for (;;) {\n if (this.pos = this.matches(reverse, pos)) {\n this.atOccurrence = true;\n return this.pos.match || true;\n }\n if (reverse) {\n if (!pos.line) return savePosAndFail(0);\n pos = {line: pos.line-1, ch: lines[pos.line-1].text.length};\n }\n else {\n if (pos.line == lines.length - 1) return savePosAndFail(lines.length);\n pos = {line: pos.line+1, ch: 0};\n }\n }\n },\n\n from: function() {if (this.atOccurrence) return copyPos(this.pos.from);},\n to: function() {if (this.atOccurrence) return copyPos(this.pos.to);},\n\n replace: function(newText) {\n var self = this;\n if (this.atOccurrence)\n operation(function() {\n self.pos.to = replaceRange(newText, self.pos.from, self.pos.to);\n })();\n }\n };\n\n for (var ext in extensions)\n if (extensions.propertyIsEnumerable(ext) &&\n !instance.propertyIsEnumerable(ext))\n instance[ext] = extensions[ext];\n return instance;\n } // (end of function CodeMirror)", "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.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 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, 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\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 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 CodeMirror(place, givenOptions) {\n // Determine effective options based on given values and defaults.\n var options = {}, defaults = CodeMirror.defaults;\n for (var opt in defaults)\n if (defaults.hasOwnProperty(opt))\n options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];\n\n // The element in which the editor lives.\n var wrapper = document.createElement(\"div\");\n wrapper.className = \"CodeMirror\" + (options.lineWrapping ? \" CodeMirror-wrap\" : \"\");\n // This mess creates the base DOM structure for the editor.\n wrapper.innerHTML =\n '<div style=\"overflow: hidden; position: relative; width: 3px; height: 0px;\">' + // Wraps and hides input textarea\n '<textarea style=\"position: absolute; padding: 0; width: 1px; height: 1em\" wrap=\"off\" ' +\n 'autocorrect=\"off\" autocapitalize=\"off\"></textarea></div>' +\n '<div class=\"CodeMirror-scroll\" tabindex=\"-1\">' +\n '<div style=\"position: relative\">' + // Set to the height of the text, causes scrolling\n '<div style=\"position: relative\">' + // Moved around its parent to cover visible view\n '<div class=\"CodeMirror-gutter\"><div class=\"CodeMirror-gutter-text\"></div></div>' +\n // Provides positioning relative to (visible) text origin\n '<div class=\"CodeMirror-lines\"><div style=\"position: relative; z-index: 0\">' +\n '<div style=\"position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden;\"></div>' +\n '<pre class=\"CodeMirror-cursor\">&#160;</pre>' + // Absolutely positioned blinky cursor\n '<div style=\"position: relative; z-index: -1\"></div><div></div>' + // DIVs containing the selection and the actual code\n '</div></div></div></div></div>';\n if (place.appendChild) place.appendChild(wrapper); else place(wrapper);\n // I've never seen more elegant code in my life.\n var inputDiv = wrapper.firstChild, input = inputDiv.firstChild,\n scroller = wrapper.lastChild, code = scroller.firstChild,\n mover = code.firstChild, gutter = mover.firstChild, gutterText = gutter.firstChild,\n lineSpace = gutter.nextSibling.firstChild, measure = lineSpace.firstChild,\n cursor = measure.nextSibling, selectionDiv = cursor.nextSibling,\n lineDiv = selectionDiv.nextSibling;\n themeChanged(); keyMapChanged();\n // Needed to hide big blue blinking cursor on Mobile Safari\n if (ios) input.style.width = \"0px\";\n if (!webkit) lineSpace.draggable = true;\n lineSpace.style.outline = \"none\";\n if (options.tabindex != null) input.tabIndex = options.tabindex;\n if (options.autofocus) focusInput();\n if (!options.gutter && !options.lineNumbers) gutter.style.display = \"none\";\n // Needed to handle Tab key in KHTML\n if (khtml) inputDiv.style.height = \"1px\", inputDiv.style.position = \"absolute\";\n\n // Check for problem with IE innerHTML not working when we have a\n // P (or similar) parent node.\n try { stringWidth(\"x\"); }\n catch (e) {\n if (e.message.match(/runtime/i))\n e = new Error(\"A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)\");\n throw e;\n }\n\n // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.\n var poll = new Delayed(), highlight = new Delayed(), blinker;\n\n // mode holds a mode API object. doc is the tree of Line objects,\n // work an array of lines that should be parsed, and history the\n // undo history (instance of History constructor).\n var mode, doc = new BranchChunk([new LeafChunk([new Line(\"\")])]), work, focused;\n loadMode();\n // The selection. These are always maintained to point at valid\n // positions. Inverted is used to remember that the user is\n // selecting bottom-to-top.\n var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};\n // Selection-related flags. shiftSelecting obviously tracks\n // whether the user is holding shift.\n var shiftSelecting, lastClick, lastDoubleClick, lastScrollPos = 0, draggingText,\n overwrite = false, suppressEdits = false;\n // Variables used by startOperation/endOperation to track what\n // happened during the operation.\n var updateInput, userSelChange, changes, textChanged, selectionChanged, leaveInputAlone,\n gutterDirty, callbacks, maxLengthChanged;\n // Current visible range (may be bigger than the view window).\n var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0;\n // bracketHighlighted is used to remember that a bracket has been\n // marked.\n var bracketHighlighted;\n // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n var maxLine = \"\", maxWidth;\n var tabCache = {};\n\n // Initialize the content.\n operation(function(){setValue(options.value || \"\"); updateInput = false;})();\n var history = new History();\n\n // Register our event handlers.\n connect(scroller, \"mousedown\", operation(onMouseDown));\n connect(scroller, \"dblclick\", operation(onDoubleClick));\n connect(lineSpace, \"selectstart\", e_preventDefault);\n // Gecko browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for Gecko.\n if (!gecko) connect(scroller, \"contextmenu\", onContextMenu);\n connect(scroller, \"scroll\", function() {\n lastScrollPos = scroller.scrollTop;\n updateDisplay([]);\n if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + \"px\";\n if (options.onScroll) options.onScroll(instance);\n });\n connect(window, \"resize\", function() {updateDisplay(true);});\n connect(input, \"keyup\", operation(onKeyUp));\n connect(input, \"input\", fastPoll);\n connect(input, \"keydown\", operation(onKeyDown));\n connect(input, \"keypress\", operation(onKeyPress));\n connect(input, \"focus\", onFocus);\n connect(input, \"blur\", onBlur);\n\n if (options.dragDrop) {\n connect(lineSpace, \"dragstart\", onDragStart);\n function drag_(e) {\n if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;\n e_stop(e);\n }\n connect(scroller, \"dragenter\", drag_);\n connect(scroller, \"dragover\", drag_);\n connect(scroller, \"drop\", operation(onDrop));\n }\n connect(scroller, \"paste\", function(){focusInput(); fastPoll();});\n connect(input, \"paste\", fastPoll);\n connect(input, \"cut\", operation(function(){\n if (!options.readOnly) replaceSelection(\"\");\n }));\n\n // Needed to handle Tab key in KHTML\n if (khtml) connect(code, \"mouseup\", function() {\n if (document.activeElement == input) input.blur();\n focusInput();\n });\n\n // IE throws unspecified error in certain cases, when\n // trying to access activeElement before onload\n var hasFocus; try { hasFocus = (document.activeElement == input); } catch(e) { }\n if (hasFocus || options.autofocus) setTimeout(onFocus, 20);\n else onBlur();\n\n function isLine(l) {return l >= 0 && l < doc.size;}\n // The instance object that we'll return. Mostly calls out to\n // local functions in the CodeMirror function. Some do some extra\n // range checking and/or clipping. operation is used to wrap the\n // call so that changes it makes are tracked, and the display is\n // updated afterwards.\n var instance = wrapper.CodeMirror = {\n getValue: getValue,\n setValue: operation(setValue),\n getSelection: getSelection,\n replaceSelection: operation(replaceSelection),\n focus: function(){window.focus(); focusInput(); onFocus(); fastPoll();},\n setOption: function(option, value) {\n var oldVal = options[option];\n options[option] = value;\n if (option == \"mode\" || option == \"indentUnit\") loadMode();\n else if (option == \"readOnly\" && value == \"nocursor\") {onBlur(); input.blur();}\n else if (option == \"readOnly\" && !value) {resetInput(true);}\n else if (option == \"theme\") themeChanged();\n else if (option == \"lineWrapping\" && oldVal != value) operation(wrappingChanged)();\n else if (option == \"tabSize\") updateDisplay(true);\n else if (option == \"keyMap\") keyMapChanged();\n if (option == \"lineNumbers\" || option == \"gutter\" || option == \"firstLineNumber\" || option == \"theme\") {\n gutterChanged();\n updateDisplay(true);\n }\n },\n getOption: function(option) {return options[option];},\n undo: operation(undo),\n redo: operation(redo),\n indentLine: operation(function(n, dir) {\n if (typeof dir != \"string\") {\n if (dir == null) dir = options.smartIndent ? \"smart\" : \"prev\";\n else dir = dir ? \"add\" : \"subtract\";\n }\n if (isLine(n)) indentLine(n, dir);\n }),\n indentSelection: operation(indentSelected),\n historySize: function() {return {undo: history.done.length, redo: history.undone.length};},\n clearHistory: function() {history = new History();},\n matchBrackets: operation(function(){matchBrackets(true);}),\n getTokenAt: operation(function(pos) {\n pos = clipPos(pos);\n return getLine(pos.line).getTokenAt(mode, getStateBefore(pos.line), pos.ch);\n }),\n getStateAfter: function(line) {\n line = clipLine(line == null ? doc.size - 1: line);\n return getStateBefore(line + 1);\n },\n cursorCoords: function(start, mode) {\n if (start == null) start = sel.inverted;\n return this.charCoords(start ? sel.from : sel.to, mode);\n },\n charCoords: function(pos, mode) {\n pos = clipPos(pos);\n if (mode == \"local\") return localCoords(pos, false);\n if (mode == \"div\") return localCoords(pos, true);\n return pageCoords(pos);\n },\n coordsChar: function(coords) {\n var off = eltOffset(lineSpace);\n return coordsChar(coords.x - off.left, coords.y - off.top);\n },\n markText: operation(markText),\n setBookmark: setBookmark,\n findMarksAt: findMarksAt,\n setMarker: operation(addGutterMarker),\n clearMarker: operation(removeGutterMarker),\n setLineClass: operation(setLineClass),\n hideLine: operation(function(h) {return setLineHidden(h, true);}),\n showLine: operation(function(h) {return setLineHidden(h, false);}),\n onDeleteLine: function(line, f) {\n if (typeof line == \"number\") {\n if (!isLine(line)) return null;\n line = getLine(line);\n }\n (line.handlers || (line.handlers = [])).push(f);\n return line;\n },\n lineInfo: lineInfo,\n addWidget: function(pos, node, scroll, vert, horiz) {\n pos = localCoords(clipPos(pos));\n var top = pos.yBot, left = pos.x;\n node.style.position = \"absolute\";\n code.appendChild(node);\n if (vert == \"over\") top = pos.y;\n else if (vert == \"near\") {\n var vspace = Math.max(scroller.offsetHeight, doc.height * textHeight()),\n hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft();\n if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)\n top = pos.y - node.offsetHeight;\n if (left + node.offsetWidth > hspace)\n left = hspace - node.offsetWidth;\n }\n node.style.top = (top + paddingTop()) + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = code.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") left = 0;\n else if (horiz == \"middle\") left = (code.clientWidth - node.offsetWidth) / 2;\n node.style.left = (left + paddingLeft()) + \"px\";\n }\n if (scroll)\n scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);\n },\n\n lineCount: function() {return doc.size;},\n clipPos: clipPos,\n getCursor: function(start) {\n if (start == null) start = sel.inverted;\n return copyPos(start ? sel.from : sel.to);\n },\n somethingSelected: function() {return !posEq(sel.from, sel.to);},\n setCursor: operation(function(line, ch, user) {\n if (ch == null && typeof line.line == \"number\") setCursor(line.line, line.ch, user);\n else setCursor(line, ch, user);\n }),\n setSelection: operation(function(from, to, user) {\n (user ? setSelectionUser : setSelection)(clipPos(from), clipPos(to || from));\n }),\n getLine: function(line) {if (isLine(line)) return getLine(line).text;},\n getLineHandle: function(line) {if (isLine(line)) return getLine(line);},\n setLine: operation(function(line, text) {\n if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: getLine(line).text.length});\n }),\n removeLine: operation(function(line) {\n if (isLine(line)) replaceRange(\"\", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));\n }),\n replaceRange: operation(replaceRange),\n getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},\n\n triggerOnKeyDown: operation(onKeyDown),\n execCommand: function(cmd) {return commands[cmd](instance);},\n // Stuff used by commands, probably not much use to outside code.\n moveH: operation(moveH),\n deleteH: operation(deleteH),\n moveV: operation(moveV),\n toggleOverwrite: function() {\n if(overwrite){\n overwrite = false;\n cursor.className = cursor.className.replace(\" CodeMirror-overwrite\", \"\");\n } else {\n overwrite = true;\n cursor.className += \" CodeMirror-overwrite\";\n }\n },\n\n posFromIndex: function(off) {\n var lineNo = 0, ch;\n doc.iter(0, doc.size, function(line) {\n var sz = line.text.length + 1;\n if (sz > off) { ch = off; return true; }\n off -= sz;\n ++lineNo;\n });\n return clipPos({line: lineNo, ch: ch});\n },\n indexFromPos: function (coords) {\n if (coords.line < 0 || coords.ch < 0) return 0;\n var index = coords.ch;\n doc.iter(0, coords.line, function (line) {\n index += line.text.length + 1;\n });\n return index;\n },\n scrollTo: function(x, y) {\n if (x != null) scroller.scrollLeft = x;\n if (y != null) scroller.scrollTop = y;\n updateDisplay([]);\n },\n\n operation: function(f){return operation(f)();},\n compoundChange: function(f){return compoundChange(f);},\n refresh: function(){\n updateDisplay(true);\n if (scroller.scrollHeight > lastScrollPos)\n scroller.scrollTop = lastScrollPos;\n },\n getInputField: function(){return input;},\n getWrapperElement: function(){return wrapper;},\n getScrollerElement: function(){return scroller;},\n getGutterElement: function(){return gutter;}\n };\n\n function getLine(n) { return getLineAt(doc, n); }\n function updateLineHeight(line, height) {\n gutterDirty = true;\n var diff = height - line.height;\n for (var n = line; n; n = n.parent) n.height += diff;\n }\n\n function setValue(code) {\n var top = {line: 0, ch: 0};\n updateLines(top, {line: doc.size - 1, ch: getLine(doc.size-1).text.length},\n splitLines(code), top, top);\n updateInput = true;\n }\n function getValue() {\n var text = [];\n doc.iter(0, doc.size, function(line) { text.push(line.text); });\n return text.join(\"\\n\");\n }\n\n function onMouseDown(e) {\n setShift(e_prop(e, \"shiftKey\"));\n // Check whether this is a click in a widget\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == code && n != mover) return;\n\n // See if this is a click in the gutter\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == gutterText) {\n if (options.onGutterClick)\n options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e);\n return e_preventDefault(e);\n }\n\n var start = posFromMouse(e);\n\n switch (e_button(e)) {\n case 3:\n if (gecko && !mac) onContextMenu(e);\n return;\n case 2:\n if (start) setCursor(start.line, start.ch, true);\n setTimeout(focusInput, 20);\n return;\n }\n // For button 1, if it was clicked inside the editor\n // (posFromMouse returning non-null), we have to adjust the\n // selection.\n if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}\n\n if (!focused) onFocus();\n\n var now = +new Date;\n if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {\n e_preventDefault(e);\n setTimeout(focusInput, 20);\n return selectLine(start.line);\n } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) {\n lastDoubleClick = {time: now, pos: start};\n e_preventDefault(e);\n return selectWordAt(start);\n } else { lastClick = {time: now, pos: start}; }\n\n var last = start, going;\n if (options.dragDrop && dragAndDrop && !options.readOnly && !posEq(sel.from, sel.to) &&\n !posLess(start, sel.from) && !posLess(sel.to, start)) {\n // Let the drag handler handle this.\n if (webkit) lineSpace.draggable = true;\n function dragEnd(e2) {\n if (webkit) lineSpace.draggable = false;\n draggingText = false;\n up(); drop();\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2);\n setCursor(start.line, start.ch, true);\n focusInput();\n }\n }\n var up = connect(document, \"mouseup\", operation(dragEnd), true);\n var drop = connect(scroller, \"drop\", operation(dragEnd), true);\n draggingText = true;\n // IE's approach to draggable\n if (lineSpace.dragDrop) lineSpace.dragDrop();\n return;\n }\n e_preventDefault(e);\n setCursor(start.line, start.ch, true);\n\n function extend(e) {\n var cur = posFromMouse(e, true);\n if (cur && !posEq(cur, last)) {\n if (!focused) onFocus();\n last = cur;\n setSelectionUser(start, cur);\n updateInput = false;\n var visible = visibleLines();\n if (cur.line >= visible.to || cur.line < visible.from)\n going = setTimeout(operation(function(){extend(e);}), 150);\n }\n }\n\n function done(e) {\n clearTimeout(going);\n var cur = posFromMouse(e);\n if (cur) setSelectionUser(start, cur);\n e_preventDefault(e);\n focusInput();\n updateInput = true;\n move(); up();\n }\n var move = connect(document, \"mousemove\", operation(function(e) {\n clearTimeout(going);\n e_preventDefault(e);\n if (!ie && !e_button(e)) done(e);\n else extend(e);\n }), true);\n var up = connect(document, \"mouseup\", operation(done), true);\n }\n function onDoubleClick(e) {\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == gutterText) return e_preventDefault(e);\n var start = posFromMouse(e);\n if (!start) return;\n lastDoubleClick = {time: +new Date, pos: start};\n e_preventDefault(e);\n selectWordAt(start);\n }\n function onDrop(e) {\n if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;\n e.preventDefault();\n var pos = posFromMouse(e, true), files = e.dataTransfer.files;\n if (!pos || options.readOnly) return;\n if (files && files.length && window.FileReader && window.File) {\n function loadFile(file, i) {\n var reader = new FileReader;\n reader.onload = function() {\n text[i] = reader.result;\n if (++read == n) {\n pos = clipPos(pos);\n operation(function() {\n var end = replaceRange(text.join(\"\"), pos, pos);\n setSelectionUser(pos, end);\n })();\n }\n };\n reader.readAsText(file);\n }\n var n = files.length, text = Array(n), read = 0;\n for (var i = 0; i < n; ++i) loadFile(files[i], i);\n }\n else {\n try {\n var text = e.dataTransfer.getData(\"Text\");\n if (text) {\n compoundChange(function() {\n var curFrom = sel.from, curTo = sel.to;\n setSelectionUser(pos, pos);\n if (draggingText) replaceRange(\"\", curFrom, curTo);\n replaceSelection(text);\n focusInput();\n });\n }\n }\n catch(e){}\n }\n }\n function onDragStart(e) {\n var txt = getSelection();\n e.dataTransfer.setData(\"Text\", txt);\n \n // Use dummy image instead of default browsers image.\n if (gecko || chrome) {\n var img = document.createElement('img');\n img.scr = 'data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs='; //1x1 image\n e.dataTransfer.setDragImage(img, 0, 0);\n }\n }\n\n function doHandleBinding(bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) return false;\n }\n var prevShift = shiftSelecting;\n try {\n if (options.readOnly) suppressEdits = true;\n if (dropShift) shiftSelecting = null;\n bound(instance);\n } catch(e) {\n if (e != Pass) throw e;\n return false;\n } finally {\n shiftSelecting = prevShift;\n suppressEdits = false;\n }\n return true;\n }\n function handleKeyBinding(e) {\n // Handle auto keymap transitions\n var startMap = getKeyMap(options.keyMap), next = startMap.auto;\n clearTimeout(maybeTransition);\n if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() {\n if (getKeyMap(options.keyMap) == startMap) {\n options.keyMap = (next.call ? next.call(null, instance) : next);\n }\n }, 50);\n\n var name = keyNames[e_prop(e, \"keyCode\")], handled = false;\n if (name == null || e.altGraphKey) return false;\n if (e_prop(e, \"altKey\")) name = \"Alt-\" + name;\n if (e_prop(e, \"ctrlKey\")) name = \"Ctrl-\" + name;\n if (e_prop(e, \"metaKey\")) name = \"Cmd-\" + name;\n\n var stopped = false;\n function stop() { stopped = true; }\n\n if (e_prop(e, \"shiftKey\")) {\n handled = lookupKey(\"Shift-\" + name, options.extraKeys, options.keyMap,\n function(b) {return doHandleBinding(b, true);}, stop)\n || lookupKey(name, options.extraKeys, options.keyMap, function(b) {\n if (typeof b == \"string\" && /^go[A-Z]/.test(b)) return doHandleBinding(b);\n }, stop);\n } else {\n handled = lookupKey(name, options.extraKeys, options.keyMap, doHandleBinding, stop);\n }\n if (stopped) handled = false;\n if (handled) {\n e_preventDefault(e);\n restartBlink();\n if (ie) { e.oldKeyCode = e.keyCode; e.keyCode = 0; }\n }\n return handled;\n }\n function handleCharBinding(e, ch) {\n var handled = lookupKey(\"'\" + ch + \"'\", options.extraKeys,\n options.keyMap, function(b) { return doHandleBinding(b, true); });\n if (handled) {\n e_preventDefault(e);\n restartBlink();\n }\n return handled;\n }\n\n var lastStoppedKey = null, maybeTransition;\n function onKeyDown(e) {\n if (!focused) onFocus();\n if (ie && e.keyCode == 27) { e.returnValue = false; }\n if (pollingFast) { if (readInput()) pollingFast = false; }\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n var code = e_prop(e, \"keyCode\");\n // IE does strange things with escape.\n setShift(code == 16 || e_prop(e, \"shiftKey\"));\n // First give onKeyEvent option a chance to handle this.\n var handled = handleKeyBinding(e);\n if (window.opera) {\n lastStoppedKey = handled ? code : null;\n // Opera has no cut event... we try to at least catch the key combo\n if (!handled && code == 88 && e_prop(e, mac ? \"metaKey\" : \"ctrlKey\"))\n replaceSelection(\"\");\n }\n }\n function onKeyPress(e) {\n if (pollingFast) readInput();\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n var keyCode = e_prop(e, \"keyCode\"), charCode = e_prop(e, \"charCode\");\n if (window.opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}\n if (((window.opera && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(e)) return;\n var ch = String.fromCharCode(charCode == null ? keyCode : charCode);\n if (options.electricChars && mode.electricChars && options.smartIndent && !options.readOnly) {\n if (mode.electricChars.indexOf(ch) > -1)\n setTimeout(operation(function() {indentLine(sel.to.line, \"smart\");}), 75);\n }\n if (handleCharBinding(e, ch)) return;\n fastPoll();\n }\n function onKeyUp(e) {\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n if (e_prop(e, \"keyCode\") == 16) shiftSelecting = null;\n }\n\n function onFocus() {\n if (options.readOnly == \"nocursor\") return;\n if (!focused) {\n if (options.onFocus) options.onFocus(instance);\n focused = true;\n if (wrapper.className.search(/\\bCodeMirror-focused\\b/) == -1)\n wrapper.className += \" CodeMirror-focused\";\n if (!leaveInputAlone) resetInput(true);\n }\n slowPoll();\n restartBlink();\n }\n function onBlur() {\n if (focused) {\n if (options.onBlur) options.onBlur(instance);\n focused = false;\n if (bracketHighlighted)\n operation(function(){\n if (bracketHighlighted) { bracketHighlighted(); bracketHighlighted = null; }\n })();\n wrapper.className = wrapper.className.replace(\" CodeMirror-focused\", \"\");\n }\n clearInterval(blinker);\n setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);\n }\n\n // Replace the range from from to to by the strings in newText.\n // Afterwards, set the selection to selFrom, selTo.\n function updateLines(from, to, newText, selFrom, selTo) {\n if (suppressEdits) return;\n if (history) {\n var old = [];\n doc.iter(from.line, to.line + 1, function(line) { old.push(line.text); });\n history.addChange(from.line, newText.length, old);\n while (history.done.length > options.undoDepth) history.done.shift();\n }\n updateLinesNoUndo(from, to, newText, selFrom, selTo);\n }\n function unredoHelper(from, to) {\n if (!from.length) return;\n var set = from.pop(), out = [];\n for (var i = set.length - 1; i >= 0; i -= 1) {\n var change = set[i];\n var replaced = [], end = change.start + change.added;\n doc.iter(change.start, end, function(line) { replaced.push(line.text); });\n out.push({start: change.start, added: change.old.length, old: replaced});\n var pos = clipPos({line: change.start + change.old.length - 1,\n ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])});\n updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: getLine(end-1).text.length}, change.old, pos, pos);\n }\n updateInput = true;\n to.push(out);\n }\n function undo() {unredoHelper(history.done, history.undone);}\n function redo() {unredoHelper(history.undone, history.done);}\n\n function updateLinesNoUndo(from, to, newText, selFrom, selTo) {\n if (suppressEdits) return;\n var recomputeMaxLength = false, maxLineLength = maxLine.length;\n if (!options.lineWrapping)\n doc.iter(from.line, to.line + 1, function(line) {\n if (!line.hidden && line.text.length == maxLineLength) {recomputeMaxLength = true; return true;}\n });\n if (from.line != to.line || newText.length > 1) gutterDirty = true;\n\n var nlines = to.line - from.line, firstLine = getLine(from.line), lastLine = getLine(to.line);\n // First adjust the line structure, taking some care to leave highlighting intact.\n if (from.ch == 0 && to.ch == 0 && newText[newText.length - 1] == \"\") {\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 = [], prevLine = null;\n if (from.line) {\n prevLine = getLine(from.line - 1);\n prevLine.fixMarkEnds(lastLine);\n } else lastLine.fixMarkStarts();\n for (var i = 0, e = newText.length - 1; i < e; ++i)\n added.push(Line.inheritMarks(newText[i], prevLine));\n if (nlines) doc.remove(from.line, nlines, callbacks);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (newText.length == 1)\n firstLine.replace(from.ch, to.ch, newText[0]);\n else {\n lastLine = firstLine.split(to.ch, newText[newText.length-1]);\n firstLine.replace(from.ch, null, newText[0]);\n firstLine.fixMarkEnds(lastLine);\n var added = [];\n for (var i = 1, e = newText.length - 1; i < e; ++i)\n added.push(Line.inheritMarks(newText[i], firstLine));\n added.push(lastLine);\n doc.insert(from.line + 1, added);\n }\n } else if (newText.length == 1) {\n firstLine.replace(from.ch, null, newText[0]);\n lastLine.replace(null, to.ch, \"\");\n firstLine.append(lastLine);\n doc.remove(from.line + 1, nlines, callbacks);\n } else {\n var added = [];\n firstLine.replace(from.ch, null, newText[0]);\n lastLine.replace(null, to.ch, newText[newText.length-1]);\n firstLine.fixMarkEnds(lastLine);\n for (var i = 1, e = newText.length - 1; i < e; ++i)\n added.push(Line.inheritMarks(newText[i], firstLine));\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1, callbacks);\n doc.insert(from.line + 1, added);\n }\n if (options.lineWrapping) {\n var perLine = Math.max(5, scroller.clientWidth / charWidth() - 3);\n doc.iter(from.line, from.line + newText.length, function(line) {\n if (line.hidden) return;\n var guess = Math.ceil(line.text.length / perLine) || 1;\n if (guess != line.height) updateLineHeight(line, guess);\n });\n } else {\n doc.iter(from.line, from.line + newText.length, function(line) {\n var l = line.text;\n if (!line.hidden && l.length > maxLineLength) {\n maxLine = l; maxLineLength = l.length; maxWidth = null;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) maxLengthChanged = true;\n }\n\n // Add these lines to the work array, so that they will be\n // highlighted. Adjust work lines if lines were added/removed.\n var newWork = [], lendiff = newText.length - nlines - 1;\n for (var i = 0, l = work.length; i < l; ++i) {\n var task = work[i];\n if (task < from.line) newWork.push(task);\n else if (task > to.line) newWork.push(task + lendiff);\n }\n var hlEnd = from.line + Math.min(newText.length, 500);\n highlightLines(from.line, hlEnd);\n newWork.push(hlEnd);\n work = newWork;\n startWorker(100);\n // Remember that these lines changed, for updating the display\n changes.push({from: from.line, to: to.line + 1, diff: lendiff});\n var changeObj = {from: from, to: to, text: newText};\n if (textChanged) {\n for (var cur = textChanged; cur.next; cur = cur.next) {}\n cur.next = changeObj;\n } else textChanged = changeObj;\n\n // Update the selection\n function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}\n setSelection(selFrom, selTo, updateLine(sel.from.line), updateLine(sel.to.line));\n\n // Make sure the scroll-size div has the correct height.\n if (scroller.clientHeight)\n code.style.height = (doc.height * textHeight() + 2 * paddingTop()) + \"px\";\n }\n \n function computeMaxLength() {\n var maxLineLength = 0; \n maxLine = \"\"; maxWidth = null;\n doc.iter(0, doc.size, function(line) {\n var l = line.text;\n if (!line.hidden && l.length > maxLineLength) {\n maxLineLength = l.length; maxLine = l;\n }\n });\n maxLengthChanged = false;\n }\n\n function replaceRange(code, from, to) {\n from = clipPos(from);\n if (!to) to = from; else to = clipPos(to);\n code = splitLines(code);\n function adjustPos(pos) {\n if (posLess(pos, from)) return pos;\n if (!posLess(to, pos)) return end;\n var line = pos.line + code.length - (to.line - from.line) - 1;\n var ch = pos.ch;\n if (pos.line == to.line)\n ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));\n return {line: line, ch: ch};\n }\n var end;\n replaceRange1(code, from, to, function(end1) {\n end = end1;\n return {from: adjustPos(sel.from), to: adjustPos(sel.to)};\n });\n return end;\n }\n function replaceSelection(code, collapse) {\n replaceRange1(splitLines(code), sel.from, sel.to, function(end) {\n if (collapse == \"end\") return {from: end, to: end};\n else if (collapse == \"start\") return {from: sel.from, to: sel.from};\n else return {from: sel.from, to: end};\n });\n }\n function replaceRange1(code, from, to, computeSel) {\n var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;\n var newSel = computeSel({line: from.line + code.length - 1, ch: endch});\n updateLines(from, to, code, newSel.from, newSel.to);\n }\n\n function getRange(from, to) {\n var l1 = from.line, l2 = to.line;\n if (l1 == l2) return getLine(l1).text.slice(from.ch, to.ch);\n var code = [getLine(l1).text.slice(from.ch)];\n doc.iter(l1 + 1, l2, function(line) { code.push(line.text); });\n code.push(getLine(l2).text.slice(0, to.ch));\n return code.join(\"\\n\");\n }\n function getSelection() {\n return getRange(sel.from, sel.to);\n }\n\n var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll\n function slowPoll() {\n if (pollingFast) return;\n poll.set(options.pollInterval, function() {\n startOperation();\n readInput();\n if (focused) slowPoll();\n endOperation();\n });\n }\n function fastPoll() {\n var missed = false;\n pollingFast = true;\n function p() {\n startOperation();\n var changed = readInput();\n if (!changed && !missed) {missed = true; poll.set(60, p);}\n else {pollingFast = false; slowPoll();}\n endOperation();\n }\n poll.set(20, p);\n }\n\n // Previnput is a hack to work with IME. If we reset the textarea\n // on every change, that breaks IME. So we look for changes\n // compared to the previous content instead. (Modern browsers have\n // events that indicate IME taking place, but these are not widely\n // supported or compatible enough yet to rely on.)\n var prevInput = \"\";\n function readInput() {\n if (leaveInputAlone || !focused || hasSelection(input) || options.readOnly) return false;\n var text = input.value;\n if (text == prevInput) return false;\n shiftSelecting = null;\n var same = 0, l = Math.min(prevInput.length, text.length);\n while (same < l && prevInput[same] == text[same]) ++same;\n if (same < prevInput.length)\n sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)};\n else if (overwrite && posEq(sel.from, sel.to))\n sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))};\n replaceSelection(text.slice(same), \"end\");\n if (text.length > 1000) { input.value = prevInput = \"\"; }\n else prevInput = text;\n return true;\n }\n function resetInput(user) {\n if (!posEq(sel.from, sel.to)) {\n prevInput = \"\";\n input.value = getSelection();\n selectInput(input);\n } else if (user) prevInput = input.value = \"\";\n }\n\n function focusInput() {\n if (options.readOnly != \"nocursor\") input.focus();\n }\n\n function scrollEditorIntoView() {\n if (!cursor.getBoundingClientRect) return;\n var rect = cursor.getBoundingClientRect();\n // IE returns bogus coordinates when the instance sits inside of an iframe and the cursor is hidden\n if (ie && rect.top == rect.bottom) return;\n var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);\n if (rect.top < 0 || rect.bottom > winH) cursor.scrollIntoView();\n }\n function scrollCursorIntoView() {\n var cursor = localCoords(sel.inverted ? sel.from : sel.to);\n var x = options.lineWrapping ? Math.min(cursor.x, lineSpace.offsetWidth) : cursor.x;\n return scrollIntoView(x, cursor.y, x, cursor.yBot);\n }\n function scrollIntoView(x1, y1, x2, y2) {\n var pl = paddingLeft(), pt = paddingTop();\n y1 += pt; y2 += pt; x1 += pl; x2 += pl;\n var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true;\n if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1); scrolled = true;}\n else if (y2 > screentop + screen) {scroller.scrollTop = y2 - screen; scrolled = true;}\n\n var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;\n var gutterw = options.fixedGutter ? gutter.clientWidth : 0;\n var atLeft = x1 < gutterw + pl + 10;\n if (x1 < screenleft + gutterw || atLeft) {\n if (atLeft) x1 = 0;\n scroller.scrollLeft = Math.max(0, x1 - 10 - gutterw);\n scrolled = true;\n }\n else if (x2 > screenw + screenleft - 3) {\n scroller.scrollLeft = x2 + 10 - screenw;\n scrolled = true;\n if (x2 > code.clientWidth) result = false;\n }\n if (scrolled && options.onScroll) options.onScroll(instance);\n return result;\n }\n\n function visibleLines() {\n var lh = textHeight(), top = scroller.scrollTop - paddingTop();\n var fromHeight = Math.max(0, Math.floor(top / lh));\n var toHeight = Math.ceil((top + scroller.clientHeight) / lh);\n return {from: lineAtHeight(doc, fromHeight),\n to: lineAtHeight(doc, toHeight)};\n }\n // Uses a set of changes plus the current scroll position to\n // determine which DOM updates have to be made, and makes the\n // updates.\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 }\n\n function computeIntact(intact, changes) {\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 && change.diff)\n intact2.push({from: range.from + diff, to: range.to + diff,\n domStart: range.domStart});\n else if (change.to <= range.from || change.from >= range.to)\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 return intact;\n }\n\n function patchDisplay(from, to, intact) {\n // The first pass removes the DOM nodes that aren't intact.\n if (!intact.length) lineDiv.innerHTML = \"\";\n else {\n function killNode(node) {\n var tmp = node.nextSibling;\n node.parentNode.removeChild(node);\n return tmp;\n }\n var domPos = 0, curNode = lineDiv.firstChild, n;\n for (var i = 0; i < intact.length; ++i) {\n var cur = intact[i];\n while (cur.domStart > domPos) {curNode = killNode(curNode); domPos++;}\n for (var j = 0, e = cur.to - cur.from; j < e; ++j) {curNode = curNode.nextSibling; domPos++;}\n }\n while (curNode) curNode = killNode(curNode);\n }\n // This pass fills in the lines that actually changed.\n var nextIntact = intact.shift(), curNode = lineDiv.firstChild, j = from;\n var scratch = document.createElement(\"div\");\n doc.iter(from, to, function(line) {\n if (nextIntact && nextIntact.to == j) nextIntact = intact.shift();\n if (!nextIntact || nextIntact.from > j) {\n if (line.hidden) var html = scratch.innerHTML = \"<pre></pre>\";\n else {\n var html = '<pre' + (line.className ? ' class=\"' + line.className + '\"' : '') + '>'\n + line.getHTML(makeTab) + '</pre>';\n // Kludge to make sure the styled element lies behind the selection (by z-index)\n if (line.bgClassName)\n html = '<div style=\"position: relative\"><pre class=\"' + line.bgClassName +\n '\" style=\"position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2\">&#160;</pre>' + html + \"</div>\";\n }\n scratch.innerHTML = html;\n lineDiv.insertBefore(scratch.firstChild, curNode);\n } else {\n curNode = curNode.nextSibling;\n }\n ++j;\n });\n }\n\n function updateGutter() {\n if (!options.gutter && !options.lineNumbers) return;\n var hText = mover.offsetHeight, hEditor = scroller.clientHeight;\n gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + \"px\";\n var html = [], i = showingFrom, normalNode;\n doc.iter(showingFrom, Math.max(showingTo, showingFrom + 1), function(line) {\n if (line.hidden) {\n html.push(\"<pre></pre>\");\n } else {\n var marker = line.gutterMarker;\n var text = options.lineNumbers ? i + options.firstLineNumber : null;\n if (marker && marker.text)\n text = marker.text.replace(\"%N%\", text != null ? text : \"\");\n else if (text == null)\n text = \"\\u00a0\";\n html.push((marker && marker.style ? '<pre class=\"' + marker.style + '\">' : \"<pre>\"), text);\n for (var j = 1; j < line.height; ++j) html.push(\"<br/>&#160;\");\n html.push(\"</pre>\");\n if (!marker) normalNode = i;\n }\n ++i;\n });\n gutter.style.display = \"none\";\n gutterText.innerHTML = html.join(\"\");\n // Make sure scrolling doesn't cause number gutter size to pop\n if (normalNode != null) {\n var node = gutterText.childNodes[normalNode - showingFrom];\n var minwidth = String(doc.size).length, val = eltText(node), pad = \"\";\n while (val.length + pad.length < minwidth) pad += \"\\u00a0\";\n if (pad) node.insertBefore(document.createTextNode(pad), node.firstChild);\n }\n gutter.style.display = \"\";\n var resized = Math.abs((parseInt(lineSpace.style.marginLeft) || 0) - gutter.offsetWidth) > 2;\n lineSpace.style.marginLeft = gutter.offsetWidth + \"px\";\n gutterDirty = false;\n return resized;\n }\n function updateSelection() {\n var collapsed = posEq(sel.from, sel.to);\n var fromPos = localCoords(sel.from, true);\n var toPos = collapsed ? fromPos : localCoords(sel.to, true);\n var headPos = sel.inverted ? fromPos : toPos, th = textHeight();\n var wrapOff = eltOffset(wrapper), lineOff = eltOffset(lineDiv);\n inputDiv.style.top = Math.max(0, Math.min(scroller.offsetHeight, headPos.y + lineOff.top - wrapOff.top)) + \"px\";\n inputDiv.style.left = Math.max(0, Math.min(scroller.offsetWidth, headPos.x + lineOff.left - wrapOff.left)) + \"px\";\n if (collapsed) {\n cursor.style.top = headPos.y + \"px\";\n cursor.style.left = (options.lineWrapping ? Math.min(headPos.x, lineSpace.offsetWidth) : headPos.x) + \"px\";\n cursor.style.display = \"\";\n selectionDiv.style.display = \"none\";\n } else {\n var sameLine = fromPos.y == toPos.y, html = \"\";\n var clientWidth = lineSpace.clientWidth || lineSpace.offsetWidth;\n var clientHeight = lineSpace.clientHeight || lineSpace.offsetHeight;\n function add(left, top, right, height) {\n var rstyle = quirksMode ? \"width: \" + (!right ? clientWidth : clientWidth - right - left) + \"px\"\n : \"right: \" + right + \"px\";\n html += '<div class=\"CodeMirror-selected\" style=\"position: absolute; left: ' + left +\n 'px; top: ' + top + 'px; ' + rstyle + '; height: ' + height + 'px\"></div>';\n }\n if (sel.from.ch && fromPos.y >= 0) {\n var right = sameLine ? clientWidth - toPos.x : 0;\n add(fromPos.x, fromPos.y, right, th);\n }\n var middleStart = Math.max(0, fromPos.y + (sel.from.ch ? th : 0));\n var middleHeight = Math.min(toPos.y, clientHeight) - middleStart;\n if (middleHeight > 0.2 * th)\n add(0, middleStart, 0, middleHeight);\n if ((!sameLine || !sel.from.ch) && toPos.y < clientHeight - .5 * th)\n add(0, toPos.y, clientWidth - toPos.x, th);\n selectionDiv.innerHTML = html;\n cursor.style.display = \"none\";\n selectionDiv.style.display = \"\";\n }\n }\n\n function setShift(val) {\n if (val) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);\n else shiftSelecting = null;\n }\n function setSelectionUser(from, to) {\n var sh = shiftSelecting && clipPos(shiftSelecting);\n if (sh) {\n if (posLess(sh, from)) from = sh;\n else if (posLess(to, sh)) to = sh;\n }\n setSelection(from, to);\n userSelChange = true;\n }\n // Update the selection. Last two args are only used by\n // updateLines, since they have to be expressed in the line\n // numbers before the update.\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 }\n function skipHidden(pos, oldLine, oldCh) {\n function getNonHidden(dir) {\n var lNo = pos.line + dir, end = dir == 1 ? doc.size : -1;\n while (lNo != end) {\n var line = getLine(lNo);\n if (!line.hidden) {\n var ch = pos.ch;\n if (toEnd || ch > oldCh || ch > line.text.length) ch = line.text.length;\n return {line: lNo, ch: ch};\n }\n lNo += dir;\n }\n }\n var line = getLine(pos.line);\n var toEnd = pos.ch == line.text.length && pos.ch != oldCh;\n if (!line.hidden) return pos;\n if (pos.line >= oldLine) return getNonHidden(1) || getNonHidden(-1);\n else return getNonHidden(-1) || getNonHidden(1);\n }\n function setCursor(line, ch, user) {\n var pos = clipPos({line: line, ch: ch || 0});\n (user ? setSelectionUser : setSelection)(pos, pos);\n }\n\n function clipLine(n) {return Math.max(0, Math.min(n, doc.size-1));}\n function clipPos(pos) {\n if (pos.line < 0) return {line: 0, ch: 0};\n if (pos.line >= doc.size) return {line: doc.size-1, ch: getLine(doc.size-1).text.length};\n var ch = pos.ch, linelen = getLine(pos.line).text.length;\n if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};\n else if (ch < 0) return {line: pos.line, ch: 0};\n else return pos;\n }\n\n function findPosH(dir, unit) {\n var end = sel.inverted ? sel.from : sel.to, line = end.line, ch = end.ch;\n var lineObj = getLine(line);\n function findNextLine() {\n for (var l = line + dir, e = dir < 0 ? -1 : doc.size; l != e; l += dir) {\n var lo = getLine(l);\n if (!lo.hidden) { line = l; lineObj = lo; return true; }\n }\n }\n function moveOnce(boundToLine) {\n if (ch == (dir < 0 ? 0 : lineObj.text.length)) {\n if (!boundToLine && findNextLine()) ch = dir < 0 ? lineObj.text.length : 0;\n else return false;\n } else ch += dir;\n return true;\n }\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\") {\n var sawWord = false;\n for (;;) {\n if (dir < 0) if (!moveOnce()) break;\n if (isWordChar(lineObj.text.charAt(ch))) sawWord = true;\n else if (sawWord) {if (dir < 0) {dir = 1; moveOnce();} break;}\n if (dir > 0) if (!moveOnce()) break;\n }\n }\n return {line: line, ch: ch};\n }\n function moveH(dir, unit) {\n var pos = dir < 0 ? sel.from : sel.to;\n if (shiftSelecting || posEq(sel.from, sel.to)) pos = findPosH(dir, unit);\n setCursor(pos.line, pos.ch, true);\n }\n function deleteH(dir, unit) {\n if (!posEq(sel.from, sel.to)) replaceRange(\"\", sel.from, sel.to);\n else if (dir < 0) replaceRange(\"\", findPosH(dir, unit), sel.to);\n else replaceRange(\"\", sel.from, findPosH(dir, unit));\n userSelChange = true;\n }\n var goalColumn = null;\n function moveV(dir, unit) {\n var dist = 0, pos = localCoords(sel.inverted ? sel.from : sel.to, true);\n if (goalColumn != null) pos.x = goalColumn;\n if (unit == \"page\") dist = Math.min(scroller.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n else if (unit == \"line\") dist = textHeight();\n var target = coordsChar(pos.x, pos.y + dist * dir + 2);\n if (unit == \"page\") scroller.scrollTop += localCoords(target, true).y - pos.y;\n setCursor(target.line, target.ch, true);\n goalColumn = pos.x;\n }\n\n function selectWordAt(pos) {\n var line = getLine(pos.line).text;\n var start = pos.ch, end = pos.ch;\n while (start > 0 && isWordChar(line.charAt(start - 1))) --start;\n while (end < line.length && isWordChar(line.charAt(end))) ++end;\n setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end});\n }\n function selectLine(line) {\n setSelectionUser({line: line, ch: 0}, clipPos({line: line + 1, ch: 0}));\n }\n function indentSelected(mode) {\n if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);\n var e = sel.to.line - (sel.to.ch ? 0 : 1);\n for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);\n }\n\n function indentLine(n, how) {\n if (!how) how = \"add\";\n if (how == \"smart\") {\n if (!mode.indent) how = \"prev\";\n else var state = getStateBefore(n);\n }\n\n var line = getLine(n), curSpace = line.indentation(options.tabSize),\n curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (how == \"prev\") {\n if (n) indentation = getLine(n-1).indentation(options.tabSize);\n else indentation = 0;\n }\n else if (how == \"smart\") indentation = mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n else if (how == \"add\") indentation = curSpace + options.indentUnit;\n else if (how == \"subtract\") indentation = curSpace - options.indentUnit;\n indentation = Math.max(0, indentation);\n var diff = indentation - curSpace;\n\n if (!diff) {\n if (sel.from.line != n && sel.to.line != n) return;\n var indentString = curSpaceString;\n }\n else {\n var indentString = \"\", pos = 0;\n if (options.indentWithTabs)\n for (var i = Math.floor(indentation / options.tabSize); i; --i) {pos += options.tabSize; indentString += \"\\t\";}\n while (pos < indentation) {++pos; indentString += \" \";}\n }\n\n replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});\n }\n\n function loadMode() {\n mode = CodeMirror.getMode(options, options.mode);\n doc.iter(0, doc.size, function(line) { line.stateAfter = null; });\n work = [0];\n startWorker();\n }\n function gutterChanged() {\n var visible = options.gutter || options.lineNumbers;\n gutter.style.display = visible ? \"\" : \"none\";\n if (visible) gutterDirty = true;\n else lineDiv.parentNode.style.marginLeft = 0;\n }\n function wrappingChanged(from, to) {\n if (options.lineWrapping) {\n wrapper.className += \" CodeMirror-wrap\";\n var perLine = scroller.clientWidth / charWidth() - 3;\n doc.iter(0, doc.size, function(line) {\n if (line.hidden) return;\n var guess = Math.ceil(line.text.length / perLine) || 1;\n if (guess != 1) updateLineHeight(line, guess);\n });\n lineSpace.style.width = code.style.width = \"\";\n } else {\n wrapper.className = wrapper.className.replace(\" CodeMirror-wrap\", \"\");\n maxWidth = null; maxLine = \"\";\n doc.iter(0, doc.size, function(line) {\n if (line.height != 1 && !line.hidden) updateLineHeight(line, 1);\n if (line.text.length > maxLine.length) maxLine = line.text;\n });\n }\n changes.push({from: 0, to: doc.size});\n }\n function makeTab(col) {\n var w = options.tabSize - col % options.tabSize, cached = tabCache[w];\n if (cached) return cached;\n for (var str = '<span class=\"cm-tab\">', i = 0; i < w; ++i) str += \" \";\n return (tabCache[w] = {html: str + \"</span>\", width: w});\n }\n function themeChanged() {\n scroller.className = scroller.className.replace(/\\s*cm-s-\\S+/g, \"\") +\n options.theme.replace(/(^|\\s)\\s*/g, \" cm-s-\");\n }\n function keyMapChanged() {\n var style = keyMap[options.keyMap].style;\n wrapper.className = wrapper.className.replace(/\\s*cm-keymap-\\S+/g, \"\") +\n (style ? \" cm-keymap-\" + style : \"\");\n }\n\n function TextMarker() { this.set = []; }\n TextMarker.prototype.clear = operation(function() {\n var min = Infinity, max = -Infinity;\n for (var i = 0, e = this.set.length; i < e; ++i) {\n var line = this.set[i], mk = line.marked;\n if (!mk || !line.parent) continue;\n var lineN = lineNo(line);\n min = Math.min(min, lineN); max = Math.max(max, lineN);\n for (var j = 0; j < mk.length; ++j)\n if (mk[j].marker == this) mk.splice(j--, 1);\n }\n if (min != Infinity)\n changes.push({from: min, to: max + 1});\n });\n TextMarker.prototype.find = function() {\n var from, to;\n for (var i = 0, e = this.set.length; i < e; ++i) {\n var line = this.set[i], mk = line.marked;\n for (var j = 0; j < mk.length; ++j) {\n var mark = mk[j];\n if (mark.marker == this) {\n if (mark.from != null || mark.to != null) {\n var found = lineNo(line);\n if (found != null) {\n if (mark.from != null) from = {line: found, ch: mark.from};\n if (mark.to != null) to = {line: found, ch: mark.to};\n }\n }\n }\n }\n }\n return {from: from, to: to};\n };\n\n function markText(from, to, className) {\n from = clipPos(from); to = clipPos(to);\n var tm = new TextMarker();\n if (!posLess(from, to)) return tm;\n function add(line, from, to, className) {\n getLine(line).addMark(new MarkedText(from, to, className, tm));\n }\n if (from.line == to.line) add(from.line, from.ch, to.ch, className);\n else {\n add(from.line, from.ch, null, className);\n for (var i = from.line + 1, e = to.line; i < e; ++i)\n add(i, null, null, className);\n add(to.line, null, to.ch, className);\n }\n changes.push({from: from.line, to: to.line + 1});\n return tm;\n }\n\n function setBookmark(pos) {\n pos = clipPos(pos);\n var bm = new Bookmark(pos.ch);\n getLine(pos.line).addMark(bm);\n return bm;\n }\n\n function findMarksAt(pos) {\n pos = clipPos(pos);\n var markers = [], marked = getLine(pos.line).marked;\n if (!marked) return markers;\n for (var i = 0, e = marked.length; i < e; ++i) {\n var m = marked[i];\n if ((m.from == null || m.from <= pos.ch) &&\n (m.to == null || m.to >= pos.ch))\n markers.push(m.marker || m);\n }\n return markers;\n }\n\n function addGutterMarker(line, text, className) {\n if (typeof line == \"number\") line = getLine(clipLine(line));\n line.gutterMarker = {text: text, style: className};\n gutterDirty = true;\n return line;\n }\n function removeGutterMarker(line) {\n if (typeof line == \"number\") line = getLine(clipLine(line));\n line.gutterMarker = null;\n gutterDirty = true;\n }\n\n function changeLine(handle, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") line = getLine(clipLine(handle));\n else no = lineNo(handle);\n if (no == null) return null;\n if (op(line, no)) changes.push({from: no, to: no + 1});\n else return null;\n return line;\n }\n function setLineClass(handle, className, bgClassName) {\n return changeLine(handle, function(line) {\n if (line.className != className || line.bgClassName != bgClassName) {\n line.className = className;\n line.bgClassName = bgClassName;\n return true;\n }\n });\n }\n function setLineHidden(handle, hidden) {\n return changeLine(handle, function(line, no) {\n if (line.hidden != hidden) {\n line.hidden = hidden;\n if (!options.lineWrapping) {\n var l = line.text;\n if (hidden && l.length == maxLine.length) {\n maxLengthChanged = true;\n }\n else if (!hidden && l.length > maxLine.length) {\n maxLine = l; maxWidth = null;\n maxLengthChanged = false;\n }\n }\n updateLineHeight(line, hidden ? 0 : 1);\n var fline = sel.from.line, tline = sel.to.line;\n if (hidden && (fline == no || tline == no)) {\n var from = fline == no ? skipHidden({line: fline, ch: 0}, fline, 0) : sel.from;\n var to = tline == no ? skipHidden({line: tline, ch: 0}, tline, 0) : sel.to;\n // Can't hide the last visible line, we'd have no place to put the cursor\n if (!to) return;\n setSelection(from, to);\n }\n return (gutterDirty = true);\n }\n });\n }\n\n function lineInfo(line) {\n if (typeof line == \"number\") {\n if (!isLine(line)) return null;\n var n = line;\n line = getLine(line);\n if (!line) return null;\n }\n else {\n var n = lineNo(line);\n if (n == null) return null;\n }\n var marker = line.gutterMarker;\n return {line: n, handle: line, text: line.text, markerText: marker && marker.text,\n markerClass: marker && marker.style, lineClass: line.className, bgClass: line.bgClassName};\n }\n\n function stringWidth(str) {\n measure.innerHTML = \"<pre><span>x</span></pre>\";\n measure.firstChild.firstChild.firstChild.nodeValue = str;\n return measure.firstChild.firstChild.offsetWidth || 10;\n }\n // These are used to go from pixel positions to character\n // positions, taking varying character widths into account.\n function charFromX(line, x) {\n if (x <= 0) return 0;\n var lineObj = getLine(line), text = lineObj.text;\n function getX(len) {\n return measureLine(lineObj, len).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 / charWidth()));\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 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 (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 }\n\n var tempId = \"CodeMirror-temp-\" + Math.floor(Math.random() * 0xffffff).toString(16);\n function measureLine(line, ch) {\n if (ch == 0) return {top: 0, left: 0};\n var wbr = options.lineWrapping && ch < line.text.length &&\n spanAffectsWrapping.test(line.text.slice(ch - 1, ch + 1));\n measure.innerHTML = \"<pre>\" + line.getHTML(makeTab, ch, tempId, wbr) + \"</pre>\";\n var elt = document.getElementById(tempId);\n var top = elt.offsetTop, left = elt.offsetLeft;\n // Older IEs report zero offsets for spans directly after a wrap\n if (ie && top == 0 && left == 0) {\n var backup = document.createElement(\"span\");\n backup.innerHTML = \"x\";\n elt.parentNode.insertBefore(backup, elt.nextSibling);\n top = backup.offsetTop;\n }\n return {top: top, left: left};\n }\n function localCoords(pos, inLineWrap) {\n var x, lh = textHeight(), y = lh * (heightAtLine(doc, pos.line) - (inLineWrap ? displayOffset : 0));\n if (pos.ch == 0) x = 0;\n else {\n var sp = measureLine(getLine(pos.line), pos.ch);\n x = sp.left;\n if (options.lineWrapping) y += Math.max(0, sp.top);\n }\n return {x: x, y: y, yBot: y + lh};\n }\n // Coords must be lineSpace-local\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 }\n function pageCoords(pos) {\n var local = localCoords(pos, true), off = eltOffset(lineSpace);\n return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};\n }\n\n var cachedHeight, cachedHeightFor, measureText;\n function textHeight() {\n if (measureText == null) {\n measureText = \"<pre>\";\n for (var i = 0; i < 49; ++i) measureText += \"x<br/>\";\n measureText += \"x</pre>\";\n }\n var offsetHeight = lineDiv.clientHeight;\n if (offsetHeight == cachedHeightFor) return cachedHeight;\n cachedHeightFor = offsetHeight;\n measure.innerHTML = measureText;\n cachedHeight = measure.firstChild.offsetHeight / 50 || 1;\n measure.innerHTML = \"\";\n return cachedHeight;\n }\n var cachedWidth, cachedWidthFor = 0;\n function charWidth() {\n if (scroller.clientWidth == cachedWidthFor) return cachedWidth;\n cachedWidthFor = scroller.clientWidth;\n return (cachedWidth = stringWidth(\"x\"));\n }\n function paddingTop() {return lineSpace.offsetTop;}\n function paddingLeft() {return lineSpace.offsetLeft;}\n\n function posFromMouse(e, liberal) {\n var offW = eltOffset(scroller, true), x, y;\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX; y = e.clientY; } catch (e) { return null; }\n // This is a mess of a heuristic to try and determine whether a\n // scroll-bar was clicked or not, and to return null if one was\n // (and !liberal).\n if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))\n return null;\n var offL = eltOffset(lineSpace, true);\n return coordsChar(x - offL.left, y - offL.top);\n }\n function onContextMenu(e) {\n var pos = posFromMouse(e), scrollPos = scroller.scrollTop;\n if (!pos || window.opera) return; // Opera is difficult.\n if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))\n operation(setCursor)(pos.line, pos.ch);\n\n var oldCSS = input.style.cssText;\n inputDiv.style.position = \"absolute\";\n input.style.cssText = \"position: fixed; width: 30px; height: 30px; top: \" + (e.clientY - 5) +\n \"px; left: \" + (e.clientX - 5) + \"px; z-index: 1000; background: white; \" +\n \"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n leaveInputAlone = true;\n var val = input.value = getSelection();\n focusInput();\n selectInput(input);\n function rehide() {\n var newVal = splitLines(input.value).join(\"\\n\");\n if (newVal != val) operation(replaceSelection)(newVal, \"end\");\n inputDiv.style.position = \"relative\";\n input.style.cssText = oldCSS;\n if (ie_lt9) scroller.scrollTop = scrollPos;\n leaveInputAlone = false;\n resetInput(true);\n slowPoll();\n }\n\n if (gecko) {\n e_stop(e);\n var mouseup = connect(window, \"mouseup\", function() {\n mouseup();\n setTimeout(rehide, 20);\n }, true);\n } else {\n setTimeout(rehide, 50);\n }\n }\n\n // Cursor-blinking\n function restartBlink() {\n clearInterval(blinker);\n var on = true;\n cursor.style.visibility = \"\";\n blinker = setInterval(function() {\n cursor.style.visibility = (on = !on) ? \"\" : \"hidden\";\n }, 650);\n }\n\n var matching = {\"(\": \")>\", \")\": \"(<\", \"[\": \"]>\", \"]\": \"[<\", \"{\": \"}>\", \"}\": \"{<\"};\n function matchBrackets(autoclear) {\n var head = sel.inverted ? sel.from : sel.to, line = getLine(head.line), pos = head.ch - 1;\n var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];\n if (!match) return;\n var ch = match.charAt(0), forward = match.charAt(1) == \">\", d = forward ? 1 : -1, st = line.styles;\n for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)\n if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}\n\n var stack = [line.text.charAt(pos)], re = /[(){}[\\]]/;\n function scan(line, from, to) {\n if (!line.text) return;\n var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;\n for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {\n var text = st[i];\n if (st[i+1] != null && st[i+1] != style) {pos += d * text.length; continue;}\n for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {\n if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {\n var match = matching[cur];\n if (match.charAt(1) == \">\" == forward) stack.push(cur);\n else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};\n else if (!stack.length) return {pos: pos, match: true};\n }\n }\n }\n }\n for (var i = head.line, e = forward ? Math.min(i + 100, doc.size) : Math.max(-1, i - 100); i != e; i+=d) {\n var line = getLine(i), first = i == head.line;\n var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);\n if (found) break;\n }\n if (!found) found = {pos: null, match: false};\n var style = found.match ? \"CodeMirror-matchingbracket\" : \"CodeMirror-nonmatchingbracket\";\n var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),\n two = found.pos != null && markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style);\n var clear = operation(function(){one.clear(); two && two.clear();});\n if (autoclear) setTimeout(clear, 800);\n else bracketHighlighted = clear;\n }\n\n // Finds the line to start with when starting a parse. Tries to\n // find a line with a stateAfter, so that it can start with a\n // valid state. If that fails, it returns the line with the\n // smallest indentation, which tends to need the least context to\n // parse correctly.\n function findStartLine(n) {\n var minindent, minline;\n for (var search = n, lim = n - 40; search > lim; --search) {\n if (search == 0) return 0;\n var line = getLine(search-1);\n if (line.stateAfter) return search;\n var indented = line.indentation(options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline;\n }\n function getStateBefore(n) {\n var start = findStartLine(n), state = start && getLine(start-1).stateAfter;\n if (!state) state = startState(mode);\n else state = copyState(mode, state);\n doc.iter(start, n, function(line) {\n line.highlight(mode, state, options.tabSize);\n line.stateAfter = copyState(mode, state);\n });\n if (start < n) changes.push({from: start, to: n});\n if (n < doc.size && !getLine(n).stateAfter) work.push(n);\n return state;\n }\n function highlightLines(start, end) {\n var state = getStateBefore(start);\n doc.iter(start, end, function(line) {\n line.highlight(mode, state, options.tabSize);\n line.stateAfter = copyState(mode, state);\n });\n }\n function highlightWorker() {\n var end = +new Date + options.workTime;\n var foundWork = work.length;\n while (work.length) {\n if (!getLine(showingFrom).stateAfter) var task = showingFrom;\n else var task = work.pop();\n if (task >= doc.size) continue;\n var start = findStartLine(task), state = start && getLine(start-1).stateAfter;\n if (state) state = copyState(mode, state);\n else state = startState(mode);\n\n var unchanged = 0, compare = mode.compareStates, realChange = false,\n i = start, bail = false;\n doc.iter(i, doc.size, function(line) {\n var hadState = line.stateAfter;\n if (+new Date > end) {\n work.push(i);\n startWorker(options.workDelay);\n if (realChange) changes.push({from: task, to: i + 1});\n return (bail = true);\n }\n var changed = line.highlight(mode, state, options.tabSize);\n if (changed) realChange = true;\n line.stateAfter = copyState(mode, state);\n var done = null;\n if (compare) {\n var same = hadState && compare(hadState, state);\n if (same != Pass) done = !!same;\n }\n if (done == null) {\n if (changed !== false || !hadState) unchanged = 0;\n else if (++unchanged > 3 && (!mode.indent || mode.indent(hadState, \"\") == mode.indent(state, \"\")))\n done = true;\n }\n if (done) return true;\n ++i;\n });\n if (bail) return;\n if (realChange) changes.push({from: task, to: i + 1});\n }\n if (foundWork && options.onHighlightComplete)\n options.onHighlightComplete(instance);\n }\n function startWorker(time) {\n if (!work.length) return;\n highlight.set(time, operation(highlightWorker));\n }\n\n // Operations are used to wrap changes in such a way that each\n // change won't have to update the cursor and display (which would\n // be awkward, slow, and error-prone), but instead updates are\n // batched and then all combined and executed at once.\n function startOperation() {\n updateInput = userSelChange = textChanged = null;\n changes = []; selectionChanged = false; callbacks = [];\n }\n function endOperation() {\n var reScroll = false, updated;\n if (maxLengthChanged) computeMaxLength();\n if (selectionChanged) reScroll = !scrollCursorIntoView();\n if (changes.length) updated = updateDisplay(changes, true);\n else {\n if (selectionChanged) updateSelection();\n if (gutterDirty) updateGutter();\n }\n if (reScroll) scrollCursorIntoView();\n if (selectionChanged) {scrollEditorIntoView(); restartBlink();}\n\n if (focused && !leaveInputAlone &&\n (updateInput === true || (updateInput !== false && selectionChanged)))\n resetInput(userSelChange);\n\n if (selectionChanged && options.matchBrackets)\n setTimeout(operation(function() {\n if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}\n if (posEq(sel.from, sel.to)) matchBrackets(false);\n }), 20);\n var tc = textChanged, cbs = callbacks; // these can be reset by callbacks\n if (selectionChanged && options.onCursorActivity)\n options.onCursorActivity(instance);\n if (tc && options.onChange && instance)\n options.onChange(instance, tc);\n for (var i = 0; i < cbs.length; ++i) cbs[i](instance);\n if (updated && options.onUpdate) options.onUpdate(instance);\n }\n var nestedOperation = 0;\n function operation(f) {\n return function() {\n if (!nestedOperation++) startOperation();\n try {var result = f.apply(this, arguments);}\n finally {if (!--nestedOperation) endOperation();}\n return result;\n };\n }\n\n function compoundChange(f) {\n history.startCompound();\n try { return f(); } finally { history.endCompound(); }\n }\n\n for (var ext in extensions)\n if (extensions.propertyIsEnumerable(ext) &&\n !instance.propertyIsEnumerable(ext))\n instance[ext] = extensions[ext];\n return instance;\n } // (end of function CodeMirror)", "function CodeMirror(place, givenOptions) {\n // Determine effective options based on given values and defaults.\n var options = {}, defaults = CodeMirror.defaults;\n for (var opt in defaults)\n if (defaults.hasOwnProperty(opt))\n options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];\n\n // The element in which the editor lives.\n var wrapper = document.createElement(\"div\");\n wrapper.className = \"CodeMirror\" + (options.lineWrapping ? \" CodeMirror-wrap\" : \"\");\n // This mess creates the base DOM structure for the editor.\n wrapper.innerHTML =\n '<div style=\"overflow: hidden; position: relative; width: 3px; height: 0px;\">' + // Wraps and hides input textarea\n '<textarea style=\"position: absolute; padding: 0; width: 1px; height: 1em\" wrap=\"off\" ' +\n 'autocorrect=\"off\" autocapitalize=\"off\"></textarea></div>' +\n '<div class=\"CodeMirror-scroll\" tabindex=\"-1\">' +\n '<div style=\"position: relative\">' + // Set to the height of the text, causes scrolling\n '<div style=\"position: relative\">' + // Moved around its parent to cover visible view\n '<div class=\"CodeMirror-gutter\"><div class=\"CodeMirror-gutter-text\"></div></div>' +\n // Provides positioning relative to (visible) text origin\n '<div class=\"CodeMirror-lines\"><div style=\"position: relative; z-index: 0\">' +\n '<div style=\"position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden;\"></div>' +\n '<pre class=\"CodeMirror-cursor\">&#160;</pre>' + // Absolutely positioned blinky cursor\n '<div style=\"position: relative; z-index: -1\"></div><div></div>' + // DIVs containing the selection and the actual code\n '</div></div></div></div></div>';\n if (place.appendChild) place.appendChild(wrapper); else place(wrapper);\n // I've never seen more elegant code in my life.\n var inputDiv = wrapper.firstChild, input = inputDiv.firstChild,\n scroller = wrapper.lastChild, code = scroller.firstChild,\n mover = code.firstChild, gutter = mover.firstChild, gutterText = gutter.firstChild,\n lineSpace = gutter.nextSibling.firstChild, measure = lineSpace.firstChild,\n cursor = measure.nextSibling, selectionDiv = cursor.nextSibling,\n lineDiv = selectionDiv.nextSibling;\n themeChanged();\n // Needed to hide big blue blinking cursor on Mobile Safari\n if (ios) input.style.width = \"0px\";\n if (!webkit) lineSpace.draggable = true;\n lineSpace.style.outline = \"none\";\n if (options.tabindex != null) input.tabIndex = options.tabindex;\n if (options.autofocus) focusInput();\n if (!options.gutter && !options.lineNumbers) gutter.style.display = \"none\";\n // Needed to handle Tab key in KHTML\n if (khtml) inputDiv.style.height = \"1px\", inputDiv.style.position = \"absolute\";\n\n // Check for problem with IE innerHTML not working when we have a\n // P (or similar) parent node.\n try { stringWidth(\"x\"); }\n catch (e) {\n if (e.message.match(/runtime/i))\n e = new Error(\"A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)\");\n throw e;\n }\n\n // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.\n var poll = new Delayed(), highlight = new Delayed(), blinker;\n\n // mode holds a mode API object. doc is the tree of Line objects,\n // work an array of lines that should be parsed, and history the\n // undo history (instance of History constructor).\n var mode, doc = new BranchChunk([new LeafChunk([new Line(\"\")])]), work, focused;\n loadMode();\n // The selection. These are always maintained to point at valid\n // positions. Inverted is used to remember that the user is\n // selecting bottom-to-top.\n var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};\n // Selection-related flags. shiftSelecting obviously tracks\n // whether the user is holding shift.\n var shiftSelecting, lastClick, lastDoubleClick, lastScrollPos = 0, draggingText,\n overwrite = false, suppressEdits = false;\n // Variables used by startOperation/endOperation to track what\n // happened during the operation.\n var updateInput, userSelChange, changes, textChanged, selectionChanged, leaveInputAlone,\n gutterDirty, callbacks;\n // Current visible range (may be bigger than the view window).\n var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0;\n // bracketHighlighted is used to remember that a bracket has been\n // marked.\n var bracketHighlighted;\n // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n var maxLine = \"\", maxWidth;\n var tabCache = {};\n\n // Initialize the content.\n operation(function(){setValue(options.value || \"\"); updateInput = false;})();\n var history = new History();\n\n // Register our event handlers.\n connect(scroller, \"mousedown\", operation(onMouseDown));\n connect(scroller, \"dblclick\", operation(onDoubleClick));\n connect(lineSpace, \"selectstart\", e_preventDefault);\n // Gecko browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for Gecko.\n if (!gecko) connect(scroller, \"contextmenu\", onContextMenu);\n connect(scroller, \"scroll\", function() {\n lastScrollPos = scroller.scrollTop;\n updateDisplay([]);\n if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + \"px\";\n if (options.onScroll) options.onScroll(instance);\n });\n connect(window, \"resize\", function() {updateDisplay(true);});\n connect(input, \"keyup\", operation(onKeyUp));\n connect(input, \"input\", fastPoll);\n connect(input, \"keydown\", operation(onKeyDown));\n connect(input, \"keypress\", operation(onKeyPress));\n connect(input, \"focus\", onFocus);\n connect(input, \"blur\", onBlur);\n\n if (options.dragDrop) {\n connect(lineSpace, \"dragstart\", onDragStart);\n function drag_(e) {\n if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;\n e_stop(e);\n }\n connect(scroller, \"dragenter\", drag_);\n connect(scroller, \"dragover\", drag_);\n connect(scroller, \"drop\", operation(onDrop));\n }\n connect(scroller, \"paste\", function(){focusInput(); fastPoll();});\n connect(input, \"paste\", fastPoll);\n connect(input, \"cut\", operation(function(){\n if (!options.readOnly) replaceSelection(\"\");\n }));\n\n // Needed to handle Tab key in KHTML\n if (khtml) connect(code, \"mouseup\", function() {\n if (document.activeElement == input) input.blur();\n focusInput();\n });\n\n // IE throws unspecified error in certain cases, when\n // trying to access activeElement before onload\n var hasFocus; try { hasFocus = (document.activeElement == input); } catch(e) { }\n if (hasFocus || options.autofocus) setTimeout(onFocus, 20);\n else onBlur();\n\n function isLine(l) {return l >= 0 && l < doc.size;}\n // The instance object that we'll return. Mostly calls out to\n // local functions in the CodeMirror function. Some do some extra\n // range checking and/or clipping. operation is used to wrap the\n // call so that changes it makes are tracked, and the display is\n // updated afterwards.\n var instance = wrapper.CodeMirror = {\n getValue: getValue,\n setValue: operation(setValue),\n getSelection: getSelection,\n replaceSelection: operation(replaceSelection),\n focus: function(){window.focus(); focusInput(); onFocus(); fastPoll();},\n setOption: function(option, value) {\n var oldVal = options[option];\n options[option] = value;\n if (option == \"mode\" || option == \"indentUnit\") loadMode();\n else if (option == \"readOnly\" && value == \"nocursor\") {onBlur(); input.blur();}\n else if (option == \"readOnly\" && !value) {resetInput(true);}\n else if (option == \"theme\") themeChanged();\n else if (option == \"lineWrapping\" && oldVal != value) operation(wrappingChanged)();\n else if (option == \"tabSize\") updateDisplay(true);\n if (option == \"lineNumbers\" || option == \"gutter\" || option == \"firstLineNumber\" || option == \"theme\") {\n gutterChanged();\n updateDisplay(true);\n }\n },\n getOption: function(option) {return options[option];},\n undo: operation(undo),\n redo: operation(redo),\n indentLine: operation(function(n, dir) {\n if (typeof dir != \"string\") {\n if (dir == null) dir = options.smartIndent ? \"smart\" : \"prev\";\n else dir = dir ? \"add\" : \"subtract\";\n }\n if (isLine(n)) indentLine(n, dir);\n }),\n indentSelection: operation(indentSelected),\n historySize: function() {return {undo: history.done.length, redo: history.undone.length};},\n clearHistory: function() {history = new History();},\n matchBrackets: operation(function(){matchBrackets(true);}),\n getTokenAt: operation(function(pos) {\n pos = clipPos(pos);\n return getLine(pos.line).getTokenAt(mode, getStateBefore(pos.line), pos.ch);\n }),\n getStateAfter: function(line) {\n line = clipLine(line == null ? doc.size - 1: line);\n return getStateBefore(line + 1);\n },\n cursorCoords: function(start, mode) {\n if (start == null) start = sel.inverted;\n return this.charCoords(start ? sel.from : sel.to, mode);\n },\n charCoords: function(pos, mode) {\n pos = clipPos(pos);\n if (mode == \"local\") return localCoords(pos, false);\n if (mode == \"div\") return localCoords(pos, true);\n return pageCoords(pos);\n },\n coordsChar: function(coords) {\n var off = eltOffset(lineSpace);\n return coordsChar(coords.x - off.left, coords.y - off.top);\n },\n markText: operation(markText),\n setBookmark: setBookmark,\n findMarksAt: findMarksAt,\n setMarker: operation(addGutterMarker),\n clearMarker: operation(removeGutterMarker),\n setLineClass: operation(setLineClass),\n hideLine: operation(function(h) {return setLineHidden(h, true);}),\n showLine: operation(function(h) {return setLineHidden(h, false);}),\n onDeleteLine: function(line, f) {\n if (typeof line == \"number\") {\n if (!isLine(line)) return null;\n line = getLine(line);\n }\n (line.handlers || (line.handlers = [])).push(f);\n return line;\n },\n lineInfo: lineInfo,\n addWidget: function(pos, node, scroll, vert, horiz) {\n pos = localCoords(clipPos(pos));\n var top = pos.yBot, left = pos.x;\n node.style.position = \"absolute\";\n code.appendChild(node);\n if (vert == \"over\") top = pos.y;\n else if (vert == \"near\") {\n var vspace = Math.max(scroller.offsetHeight, doc.height * textHeight()),\n hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft();\n if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)\n top = pos.y - node.offsetHeight;\n if (left + node.offsetWidth > hspace)\n left = hspace - node.offsetWidth;\n }\n node.style.top = (top + paddingTop()) + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = code.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") left = 0;\n else if (horiz == \"middle\") left = (code.clientWidth - node.offsetWidth) / 2;\n node.style.left = (left + paddingLeft()) + \"px\";\n }\n if (scroll)\n scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);\n },\n\n lineCount: function() {return doc.size;},\n clipPos: clipPos,\n getCursor: function(start) {\n if (start == null) start = sel.inverted;\n return copyPos(start ? sel.from : sel.to);\n },\n somethingSelected: function() {return !posEq(sel.from, sel.to);},\n setCursor: operation(function(line, ch, user) {\n if (ch == null && typeof line.line == \"number\") setCursor(line.line, line.ch, user);\n else setCursor(line, ch, user);\n }),\n setSelection: operation(function(from, to, user) {\n (user ? setSelectionUser : setSelection)(clipPos(from), clipPos(to || from));\n }),\n getLine: function(line) {if (isLine(line)) return getLine(line).text;},\n getLineHandle: function(line) {if (isLine(line)) return getLine(line);},\n setLine: operation(function(line, text) {\n if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: getLine(line).text.length});\n }),\n removeLine: operation(function(line) {\n if (isLine(line)) replaceRange(\"\", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));\n }),\n replaceRange: operation(replaceRange),\n getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},\n\n triggerOnKeyDown: operation(onKeyDown),\n execCommand: function(cmd) {return commands[cmd](instance);},\n // Stuff used by commands, probably not much use to outside code.\n moveH: operation(moveH),\n deleteH: operation(deleteH),\n moveV: operation(moveV),\n toggleOverwrite: function() {\n if(overwrite){\n overwrite = false;\n cursor.className = cursor.className.replace(\" CodeMirror-overwrite\", \"\");\n } else {\n overwrite = true;\n cursor.className += \" CodeMirror-overwrite\";\n }\n },\n\n posFromIndex: function(off) {\n var lineNo = 0, ch;\n doc.iter(0, doc.size, function(line) {\n var sz = line.text.length + 1;\n if (sz > off) { ch = off; return true; }\n off -= sz;\n ++lineNo;\n });\n return clipPos({line: lineNo, ch: ch});\n },\n indexFromPos: function (coords) {\n if (coords.line < 0 || coords.ch < 0) return 0;\n var index = coords.ch;\n doc.iter(0, coords.line, function (line) {\n index += line.text.length + 1;\n });\n return index;\n },\n scrollTo: function(x, y) {\n if (x != null) scroller.scrollLeft = x;\n if (y != null) scroller.scrollTop = y;\n updateDisplay([]);\n },\n\n operation: function(f){return operation(f)();},\n compoundChange: function(f){return compoundChange(f);},\n refresh: function(){\n updateDisplay(true);\n if (scroller.scrollHeight > lastScrollPos)\n scroller.scrollTop = lastScrollPos;\n },\n getInputField: function(){return input;},\n getWrapperElement: function(){return wrapper;},\n getScrollerElement: function(){return scroller;},\n getGutterElement: function(){return gutter;}\n };\n\n function getLine(n) { return getLineAt(doc, n); }\n function updateLineHeight(line, height) {\n gutterDirty = true;\n var diff = height - line.height;\n for (var n = line; n; n = n.parent) n.height += diff;\n }\n\n function setValue(code) {\n var top = {line: 0, ch: 0};\n updateLines(top, {line: doc.size - 1, ch: getLine(doc.size-1).text.length},\n splitLines(code), top, top);\n updateInput = true;\n }\n function getValue() {\n var text = [];\n doc.iter(0, doc.size, function(line) { text.push(line.text); });\n return text.join(\"\\n\");\n }\n\n function onMouseDown(e) {\n setShift(e_prop(e, \"shiftKey\"));\n // Check whether this is a click in a widget\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == code && n != mover) return;\n\n // See if this is a click in the gutter\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == gutterText) {\n if (options.onGutterClick)\n options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e);\n return e_preventDefault(e);\n }\n\n var start = posFromMouse(e);\n\n switch (e_button(e)) {\n case 3:\n if (gecko && !mac) onContextMenu(e);\n return;\n case 2:\n if (start) setCursor(start.line, start.ch, true);\n return;\n }\n // For button 1, if it was clicked inside the editor\n // (posFromMouse returning non-null), we have to adjust the\n // selection.\n if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}\n\n if (!focused) onFocus();\n\n var now = +new Date;\n if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {\n e_preventDefault(e);\n setTimeout(focusInput, 20);\n return selectLine(start.line);\n } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) {\n lastDoubleClick = {time: now, pos: start};\n e_preventDefault(e);\n return selectWordAt(start);\n } else { lastClick = {time: now, pos: start}; }\n\n var last = start, going;\n if (options.dragDrop && dragAndDrop && !options.readOnly && !posEq(sel.from, sel.to) &&\n !posLess(start, sel.from) && !posLess(sel.to, start)) {\n // Let the drag handler handle this.\n if (webkit) lineSpace.draggable = true;\n function dragEnd(e2) {\n if (webkit) lineSpace.draggable = false;\n draggingText = false;\n up(); drop();\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2);\n setCursor(start.line, start.ch, true);\n focusInput();\n }\n }\n var up = connect(document, \"mouseup\", operation(dragEnd), true);\n var drop = connect(scroller, \"drop\", operation(dragEnd), true);\n draggingText = true;\n // IE's approach to draggable\n if (lineSpace.dragDrop) lineSpace.dragDrop();\n return;\n }\n e_preventDefault(e);\n setCursor(start.line, start.ch, true);\n\n function extend(e) {\n var cur = posFromMouse(e, true);\n if (cur && !posEq(cur, last)) {\n if (!focused) onFocus();\n last = cur;\n setSelectionUser(start, cur);\n updateInput = false;\n var visible = visibleLines();\n if (cur.line >= visible.to || cur.line < visible.from)\n going = setTimeout(operation(function(){extend(e);}), 150);\n }\n }\n\n function done(e) {\n clearTimeout(going);\n var cur = posFromMouse(e);\n if (cur) setSelectionUser(start, cur);\n e_preventDefault(e);\n focusInput();\n updateInput = true;\n move(); up();\n }\n var move = connect(document, \"mousemove\", operation(function(e) {\n clearTimeout(going);\n e_preventDefault(e);\n if (!ie && !e_button(e)) done(e);\n else extend(e);\n }), true);\n var up = connect(document, \"mouseup\", operation(done), true);\n }\n function onDoubleClick(e) {\n for (var n = e_target(e); n != wrapper; n = n.parentNode)\n if (n.parentNode == gutterText) return e_preventDefault(e);\n var start = posFromMouse(e);\n if (!start) return;\n lastDoubleClick = {time: +new Date, pos: start};\n e_preventDefault(e);\n selectWordAt(start);\n }\n function onDrop(e) {\n if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;\n e.preventDefault();\n var pos = posFromMouse(e, true), files = e.dataTransfer.files;\n if (!pos || options.readOnly) return;\n if (files && files.length && window.FileReader && window.File) {\n function loadFile(file, i) {\n var reader = new FileReader;\n reader.onload = function() {\n text[i] = reader.result;\n if (++read == n) {\n pos = clipPos(pos);\n operation(function() {\n var end = replaceRange(text.join(\"\"), pos, pos);\n setSelectionUser(pos, end);\n })();\n }\n };\n reader.readAsText(file);\n }\n var n = files.length, text = Array(n), read = 0;\n for (var i = 0; i < n; ++i) loadFile(files[i], i);\n }\n else {\n try {\n var text = e.dataTransfer.getData(\"Text\");\n if (text) {\n compoundChange(function() {\n var curFrom = sel.from, curTo = sel.to;\n setSelectionUser(pos, pos);\n if (draggingText) replaceRange(\"\", curFrom, curTo);\n replaceSelection(text);\n focusInput();\n });\n }\n }\n catch(e){}\n }\n }\n function onDragStart(e) {\n var txt = getSelection();\n e.dataTransfer.setData(\"Text\", txt);\n \n // Use dummy image instead of default browsers image.\n if (gecko || chrome) {\n var img = document.createElement('img');\n img.scr = 'data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs='; //1x1 image\n e.dataTransfer.setDragImage(img, 0, 0);\n }\n }\n\n function doHandleBinding(bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) return false;\n }\n var prevShift = shiftSelecting;\n try {\n if (options.readOnly) suppressEdits = true;\n if (dropShift) shiftSelecting = null;\n bound(instance);\n } catch(e) {\n if (e != Pass) throw e;\n return false;\n } finally {\n shiftSelecting = prevShift;\n suppressEdits = false;\n }\n return true;\n }\n function handleKeyBinding(e) {\n // Handle auto keymap transitions\n var startMap = getKeyMap(options.keyMap), next = startMap.auto;\n clearTimeout(maybeTransition);\n if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() {\n if (getKeyMap(options.keyMap) == startMap) {\n options.keyMap = (next.call ? next.call(null, instance) : next);\n }\n }, 50);\n\n var name = keyNames[e_prop(e, \"keyCode\")], handled = false;\n if (name == null || e.altGraphKey) return false;\n if (e_prop(e, \"altKey\")) name = \"Alt-\" + name;\n if (e_prop(e, \"ctrlKey\")) name = \"Ctrl-\" + name;\n if (e_prop(e, \"metaKey\")) name = \"Cmd-\" + name;\n\n var stopped = false;\n function stop() { stopped = true; }\n\n if (e_prop(e, \"shiftKey\")) {\n handled = lookupKey(\"Shift-\" + name, options.extraKeys, options.keyMap,\n function(b) {return doHandleBinding(b, true);}, stop)\n || lookupKey(name, options.extraKeys, options.keyMap, function(b) {\n if (typeof b == \"string\" && /^go[A-Z]/.test(b)) return doHandleBinding(b);\n }, stop);\n } else {\n handled = lookupKey(name, options.extraKeys, options.keyMap, doHandleBinding, stop);\n }\n if (stopped) handled = false;\n if (handled) {\n e_preventDefault(e);\n if (ie) { e.oldKeyCode = e.keyCode; e.keyCode = 0; }\n }\n return handled;\n }\n function handleCharBinding(e, ch) {\n var handled = lookupKey(\"'\" + ch + \"'\", options.extraKeys,\n options.keyMap, function(b) { return doHandleBinding(b, true); });\n if (handled) e_preventDefault(e);\n return handled;\n }\n\n var lastStoppedKey = null, maybeTransition;\n function onKeyDown(e) {\n if (!focused) onFocus();\n if (ie && e.keyCode == 27) { e.returnValue = false; }\n if (pollingFast) { if (readInput()) pollingFast = false; }\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n var code = e_prop(e, \"keyCode\");\n // IE does strange things with escape.\n setShift(code == 16 || e_prop(e, \"shiftKey\"));\n // First give onKeyEvent option a chance to handle this.\n var handled = handleKeyBinding(e);\n if (window.opera) {\n lastStoppedKey = handled ? code : null;\n // Opera has no cut event... we try to at least catch the key combo\n if (!handled && code == 88 && e_prop(e, mac ? \"metaKey\" : \"ctrlKey\"))\n replaceSelection(\"\");\n }\n }\n function onKeyPress(e) {\n if (pollingFast) readInput();\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n var keyCode = e_prop(e, \"keyCode\"), charCode = e_prop(e, \"charCode\");\n if (window.opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}\n if (((window.opera && !e.which) || khtml) && handleKeyBinding(e)) return;\n var ch = String.fromCharCode(charCode == null ? keyCode : charCode);\n if (options.electricChars && mode.electricChars && options.smartIndent && !options.readOnly) {\n if (mode.electricChars.indexOf(ch) > -1)\n setTimeout(operation(function() {indentLine(sel.to.line, \"smart\");}), 75);\n }\n if (handleCharBinding(e, ch)) return;\n fastPoll();\n }\n function onKeyUp(e) {\n if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;\n if (e_prop(e, \"keyCode\") == 16) shiftSelecting = null;\n }\n\n function onFocus() {\n if (options.readOnly == \"nocursor\") return;\n if (!focused) {\n if (options.onFocus) options.onFocus(instance);\n focused = true;\n if (wrapper.className.search(/\\bCodeMirror-focused\\b/) == -1)\n wrapper.className += \" CodeMirror-focused\";\n if (!leaveInputAlone) resetInput(true);\n }\n slowPoll();\n restartBlink();\n }\n function onBlur(e) {\n if (focused) {\n if (options.onBlur) options.onBlur(instance, e);\n focused = false;\n if (bracketHighlighted)\n operation(function(){\n if (bracketHighlighted) { bracketHighlighted(); bracketHighlighted = null; }\n })();\n wrapper.className = wrapper.className.replace(\" CodeMirror-focused\", \"\");\n }\n clearInterval(blinker);\n setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);\n }\n\n // Replace the range from from to to by the strings in newText.\n // Afterwards, set the selection to selFrom, selTo.\n function updateLines(from, to, newText, selFrom, selTo) {\n if (suppressEdits) return;\n if (history) {\n var old = [];\n doc.iter(from.line, to.line + 1, function(line) { old.push(line.text); });\n history.addChange(from.line, newText.length, old);\n while (history.done.length > options.undoDepth) history.done.shift();\n }\n updateLinesNoUndo(from, to, newText, selFrom, selTo);\n }\n function unredoHelper(from, to) {\n if (!from.length) return;\n var set = from.pop(), out = [];\n for (var i = set.length - 1; i >= 0; i -= 1) {\n var change = set[i];\n var replaced = [], end = change.start + change.added;\n doc.iter(change.start, end, function(line) { replaced.push(line.text); });\n out.push({start: change.start, added: change.old.length, old: replaced});\n var pos = clipPos({line: change.start + change.old.length - 1,\n ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])});\n updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: getLine(end-1).text.length}, change.old, pos, pos);\n }\n updateInput = true;\n to.push(out);\n }\n function undo() {unredoHelper(history.done, history.undone);}\n function redo() {unredoHelper(history.undone, history.done);}\n\n function updateLinesNoUndo(from, to, newText, selFrom, selTo) {\n if (suppressEdits) return;\n var recomputeMaxLength = false, maxLineLength = maxLine.length;\n if (!options.lineWrapping)\n doc.iter(from.line, to.line + 1, function(line) {\n if (line.text.length == maxLineLength) {recomputeMaxLength = true; return true;}\n });\n if (from.line != to.line || newText.length > 1) gutterDirty = true;\n\n var nlines = to.line - from.line, firstLine = getLine(from.line), lastLine = getLine(to.line);\n // First adjust the line structure, taking some care to leave highlighting intact.\n if (from.ch == 0 && to.ch == 0 && newText[newText.length - 1] == \"\") {\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 = [], prevLine = null;\n if (from.line) {\n prevLine = getLine(from.line - 1);\n prevLine.fixMarkEnds(lastLine);\n } else lastLine.fixMarkStarts();\n for (var i = 0, e = newText.length - 1; i < e; ++i)\n added.push(Line.inheritMarks(newText[i], prevLine));\n if (nlines) doc.remove(from.line, nlines, callbacks);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (newText.length == 1)\n firstLine.replace(from.ch, to.ch, newText[0]);\n else {\n lastLine = firstLine.split(to.ch, newText[newText.length-1]);\n firstLine.replace(from.ch, null, newText[0]);\n firstLine.fixMarkEnds(lastLine);\n var added = [];\n for (var i = 1, e = newText.length - 1; i < e; ++i)\n added.push(Line.inheritMarks(newText[i], firstLine));\n added.push(lastLine);\n doc.insert(from.line + 1, added);\n }\n } else if (newText.length == 1) {\n firstLine.replace(from.ch, null, newText[0]);\n lastLine.replace(null, to.ch, \"\");\n firstLine.append(lastLine);\n doc.remove(from.line + 1, nlines, callbacks);\n } else {\n var added = [];\n firstLine.replace(from.ch, null, newText[0]);\n lastLine.replace(null, to.ch, newText[newText.length-1]);\n firstLine.fixMarkEnds(lastLine);\n for (var i = 1, e = newText.length - 1; i < e; ++i)\n added.push(Line.inheritMarks(newText[i], firstLine));\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1, callbacks);\n doc.insert(from.line + 1, added);\n }\n if (options.lineWrapping) {\n var perLine = Math.max(5, scroller.clientWidth / charWidth() - 3);\n doc.iter(from.line, from.line + newText.length, function(line) {\n if (line.hidden) return;\n var guess = Math.ceil(line.text.length / perLine) || 1;\n if (guess != line.height) updateLineHeight(line, guess);\n });\n } else {\n doc.iter(from.line, from.line + newText.length, function(line) {\n var l = line.text;\n if (l.length > maxLineLength) {\n maxLine = l; maxLineLength = l.length; maxWidth = null;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) {\n maxLineLength = 0; maxLine = \"\"; maxWidth = null;\n doc.iter(0, doc.size, function(line) {\n var l = line.text;\n if (l.length > maxLineLength) {\n maxLineLength = l.length; maxLine = l;\n }\n });\n }\n }\n\n // Add these lines to the work array, so that they will be\n // highlighted. Adjust work lines if lines were added/removed.\n var newWork = [], lendiff = newText.length - nlines - 1;\n for (var i = 0, l = work.length; i < l; ++i) {\n var task = work[i];\n if (task < from.line) newWork.push(task);\n else if (task > to.line) newWork.push(task + lendiff);\n }\n var hlEnd = from.line + Math.min(newText.length, 500);\n highlightLines(from.line, hlEnd);\n newWork.push(hlEnd);\n work = newWork;\n startWorker(100);\n // Remember that these lines changed, for updating the display\n changes.push({from: from.line, to: to.line + 1, diff: lendiff});\n var changeObj = {from: from, to: to, text: newText};\n if (textChanged) {\n for (var cur = textChanged; cur.next; cur = cur.next) {}\n cur.next = changeObj;\n } else textChanged = changeObj;\n\n // Update the selection\n function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}\n setSelection(selFrom, selTo, updateLine(sel.from.line), updateLine(sel.to.line));\n\n // Make sure the scroll-size div has the correct height.\n if (scroller.clientHeight)\n code.style.height = (doc.height * textHeight() + 2 * paddingTop()) + \"px\";\n }\n\n function replaceRange(code, from, to) {\n from = clipPos(from);\n if (!to) to = from; else to = clipPos(to);\n code = splitLines(code);\n function adjustPos(pos) {\n if (posLess(pos, from)) return pos;\n if (!posLess(to, pos)) return end;\n var line = pos.line + code.length - (to.line - from.line) - 1;\n var ch = pos.ch;\n if (pos.line == to.line)\n ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));\n return {line: line, ch: ch};\n }\n var end;\n replaceRange1(code, from, to, function(end1) {\n end = end1;\n return {from: adjustPos(sel.from), to: adjustPos(sel.to)};\n });\n return end;\n }\n function replaceSelection(code, collapse) {\n replaceRange1(splitLines(code), sel.from, sel.to, function(end) {\n if (collapse == \"end\") return {from: end, to: end};\n else if (collapse == \"start\") return {from: sel.from, to: sel.from};\n else return {from: sel.from, to: end};\n });\n }\n function replaceRange1(code, from, to, computeSel) {\n var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;\n var newSel = computeSel({line: from.line + code.length - 1, ch: endch});\n updateLines(from, to, code, newSel.from, newSel.to);\n }\n\n function getRange(from, to) {\n var l1 = from.line, l2 = to.line;\n if (l1 == l2) return getLine(l1).text.slice(from.ch, to.ch);\n var code = [getLine(l1).text.slice(from.ch)];\n doc.iter(l1 + 1, l2, function(line) { code.push(line.text); });\n code.push(getLine(l2).text.slice(0, to.ch));\n return code.join(\"\\n\");\n }\n function getSelection() {\n return getRange(sel.from, sel.to);\n }\n\n var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll\n function slowPoll() {\n if (pollingFast) return;\n poll.set(options.pollInterval, function() {\n startOperation();\n readInput();\n if (focused) slowPoll();\n endOperation();\n });\n }\n function fastPoll() {\n var missed = false;\n pollingFast = true;\n function p() {\n startOperation();\n var changed = readInput();\n if (!changed && !missed) {missed = true; poll.set(60, p);}\n else {pollingFast = false; slowPoll();}\n endOperation();\n }\n poll.set(20, p);\n }\n\n // Previnput is a hack to work with IME. If we reset the textarea\n // on every change, that breaks IME. So we look for changes\n // compared to the previous content instead. (Modern browsers have\n // events that indicate IME taking place, but these are not widely\n // supported or compatible enough yet to rely on.)\n var prevInput = \"\";\n function readInput() {\n if (leaveInputAlone || !focused || hasSelection(input) || options.readOnly) return false;\n var text = input.value;\n if (text == prevInput) return false;\n shiftSelecting = null;\n var same = 0, l = Math.min(prevInput.length, text.length);\n while (same < l && prevInput[same] == text[same]) ++same;\n if (same < prevInput.length)\n sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)};\n else if (overwrite && posEq(sel.from, sel.to))\n sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))};\n replaceSelection(text.slice(same), \"end\");\n prevInput = text;\n return true;\n }\n function resetInput(user) {\n if (!posEq(sel.from, sel.to)) {\n prevInput = \"\";\n input.value = getSelection();\n selectInput(input);\n } else if (user) prevInput = input.value = \"\";\n }\n\n function focusInput() {\n if (options.readOnly != \"nocursor\") input.focus();\n }\n\n function scrollEditorIntoView() {\n if (!cursor.getBoundingClientRect) return;\n var rect = cursor.getBoundingClientRect();\n // IE returns bogus coordinates when the instance sits inside of an iframe and the cursor is hidden\n if (ie && rect.top == rect.bottom) return;\n var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);\n if (rect.top < 0 || rect.bottom > winH) cursor.scrollIntoView();\n }\n function scrollCursorIntoView() {\n var cursor = localCoords(sel.inverted ? sel.from : sel.to);\n var x = options.lineWrapping ? Math.min(cursor.x, lineSpace.offsetWidth) : cursor.x;\n return scrollIntoView(x, cursor.y, x, cursor.yBot);\n }\n function scrollIntoView(x1, y1, x2, y2) {\n var pl = paddingLeft(), pt = paddingTop();\n y1 += pt; y2 += pt; x1 += pl; x2 += pl;\n var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true;\n if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1); scrolled = true;}\n else if (y2 > screentop + screen) {scroller.scrollTop = y2 - screen; scrolled = true;}\n\n var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;\n var gutterw = options.fixedGutter ? gutter.clientWidth : 0;\n var atLeft = x1 < gutterw + pl + 10;\n if (x1 < screenleft + gutterw || atLeft) {\n if (atLeft) x1 = 0;\n scroller.scrollLeft = Math.max(0, x1 - 10 - gutterw);\n scrolled = true;\n }\n else if (x2 > screenw + screenleft - 3) {\n scroller.scrollLeft = x2 + 10 - screenw;\n scrolled = true;\n if (x2 > code.clientWidth) result = false;\n }\n if (scrolled && options.onScroll) options.onScroll(instance);\n return result;\n }\n\n function visibleLines() {\n var lh = textHeight(), top = scroller.scrollTop - paddingTop();\n var fromHeight = Math.max(0, Math.floor(top / lh));\n var toHeight = Math.ceil((top + scroller.clientHeight) / lh);\n return {from: lineAtHeight(doc, fromHeight),\n to: lineAtHeight(doc, toHeight)};\n }\n // Uses a set of changes plus the current scroll position to\n // determine which DOM updates have to be made, and makes the\n // updates.\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 }\n\n function computeIntact(intact, changes) {\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 && change.diff)\n intact2.push({from: range.from + diff, to: range.to + diff,\n domStart: range.domStart});\n else if (change.to <= range.from || change.from >= range.to)\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 return intact;\n }\n\n function patchDisplay(from, to, intact) {\n // The first pass removes the DOM nodes that aren't intact.\n if (!intact.length) lineDiv.innerHTML = \"\";\n else {\n function killNode(node) {\n var tmp = node.nextSibling;\n node.parentNode.removeChild(node);\n return tmp;\n }\n var domPos = 0, curNode = lineDiv.firstChild, n;\n for (var i = 0; i < intact.length; ++i) {\n var cur = intact[i];\n while (cur.domStart > domPos) {curNode = killNode(curNode); domPos++;}\n for (var j = 0, e = cur.to - cur.from; j < e; ++j) {curNode = curNode.nextSibling; domPos++;}\n }\n while (curNode) curNode = killNode(curNode);\n }\n // This pass fills in the lines that actually changed.\n var nextIntact = intact.shift(), curNode = lineDiv.firstChild, j = from;\n var scratch = document.createElement(\"div\");\n doc.iter(from, to, function(line) {\n if (nextIntact && nextIntact.to == j) nextIntact = intact.shift();\n if (!nextIntact || nextIntact.from > j) {\n if (line.hidden) var html = scratch.innerHTML = \"<pre></pre>\";\n else {\n var html = '<pre' + (line.className ? ' class=\"' + line.className + '\"' : '') + '>'\n + line.getHTML(makeTab) + '</pre>';\n // Kludge to make sure the styled element lies behind the selection (by z-index)\n if (line.bgClassName)\n html = '<div style=\"position: relative\"><pre class=\"' + line.bgClassName +\n '\" style=\"position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2\">&#160;</pre>' + html + \"</div>\";\n }\n scratch.innerHTML = html;\n lineDiv.insertBefore(scratch.firstChild, curNode);\n } else {\n curNode = curNode.nextSibling;\n }\n ++j;\n });\n }\n\n function updateGutter() {\n if (!options.gutter && !options.lineNumbers) return;\n var hText = mover.offsetHeight, hEditor = scroller.clientHeight;\n gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + \"px\";\n var html = [], i = showingFrom, normalNode;\n doc.iter(showingFrom, Math.max(showingTo, showingFrom + 1), function(line) {\n if (line.hidden) {\n html.push(\"<pre></pre>\");\n } else {\n var marker = line.gutterMarker;\n var text = options.lineNumbers ? i + options.firstLineNumber : null;\n if (marker && marker.text)\n text = marker.text.replace(\"%N%\", text != null ? text : \"\");\n else if (text == null)\n text = \"\\u00a0\";\n html.push((marker && marker.style ? '<pre class=\"' + marker.style + '\">' : \"<pre>\"), text);\n for (var j = 1; j < line.height; ++j) html.push(\"<br/>&#160;\");\n html.push(\"</pre>\");\n if (!marker) normalNode = i;\n }\n ++i;\n });\n gutter.style.display = \"none\";\n gutterText.innerHTML = html.join(\"\");\n // Make sure scrolling doesn't cause number gutter size to pop\n if (normalNode != null) {\n var node = gutterText.childNodes[normalNode - showingFrom];\n var minwidth = String(doc.size).length, val = eltText(node), pad = \"\";\n while (val.length + pad.length < minwidth) pad += \"\\u00a0\";\n if (pad) node.insertBefore(document.createTextNode(pad), node.firstChild);\n }\n gutter.style.display = \"\";\n var resized = Math.abs((parseInt(lineSpace.style.marginLeft) || 0) - gutter.offsetWidth) > 2;\n lineSpace.style.marginLeft = gutter.offsetWidth + \"px\";\n gutterDirty = false;\n return resized;\n }\n function updateSelection() {\n var collapsed = posEq(sel.from, sel.to);\n var fromPos = localCoords(sel.from, true);\n var toPos = collapsed ? fromPos : localCoords(sel.to, true);\n var headPos = sel.inverted ? fromPos : toPos, th = textHeight();\n var wrapOff = eltOffset(wrapper), lineOff = eltOffset(lineDiv);\n inputDiv.style.top = Math.max(0, Math.min(scroller.offsetHeight, headPos.y + lineOff.top - wrapOff.top)) + \"px\";\n inputDiv.style.left = Math.max(0, Math.min(scroller.offsetWidth, headPos.x + lineOff.left - wrapOff.left)) + \"px\";\n if (collapsed) {\n cursor.style.top = headPos.y + \"px\";\n cursor.style.left = (options.lineWrapping ? Math.min(headPos.x, lineSpace.offsetWidth) : headPos.x) + \"px\";\n cursor.style.display = \"\";\n selectionDiv.style.display = \"none\";\n } else {\n var sameLine = fromPos.y == toPos.y, html = \"\";\n var clientWidth = lineSpace.clientWidth || lineSpace.offsetWidth;\n var clientHeight = lineSpace.clientHeight || lineSpace.offsetHeight;\n function add(left, top, right, height) {\n var rstyle = quirksMode ? \"width: \" + (!right ? clientWidth : clientWidth - right - left) + \"px\"\n : \"right: \" + right + \"px\";\n html += '<div class=\"CodeMirror-selected\" style=\"position: absolute; left: ' + left +\n 'px; top: ' + top + 'px; ' + rstyle + '; height: ' + height + 'px\"></div>';\n }\n if (sel.from.ch && fromPos.y >= 0) {\n var right = sameLine ? clientWidth - toPos.x : 0;\n add(fromPos.x, fromPos.y, right, th);\n }\n var middleStart = Math.max(0, fromPos.y + (sel.from.ch ? th : 0));\n var middleHeight = Math.min(toPos.y, clientHeight) - middleStart;\n if (middleHeight > 0.2 * th)\n add(0, middleStart, 0, middleHeight);\n if ((!sameLine || !sel.from.ch) && toPos.y < clientHeight - .5 * th)\n add(0, toPos.y, clientWidth - toPos.x, th);\n selectionDiv.innerHTML = html;\n cursor.style.display = \"none\";\n selectionDiv.style.display = \"\";\n }\n }\n\n function setShift(val) {\n if (val) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);\n else shiftSelecting = null;\n }\n function setSelectionUser(from, to) {\n var sh = shiftSelecting && clipPos(shiftSelecting);\n if (sh) {\n if (posLess(sh, from)) from = sh;\n else if (posLess(to, sh)) to = sh;\n }\n setSelection(from, to);\n userSelChange = true;\n }\n // Update the selection. Last two args are only used by\n // updateLines, since they have to be expressed in the line\n // numbers before the update.\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 }\n function skipHidden(pos, oldLine, oldCh) {\n function getNonHidden(dir) {\n var lNo = pos.line + dir, end = dir == 1 ? doc.size : -1;\n while (lNo != end) {\n var line = getLine(lNo);\n if (!line.hidden) {\n var ch = pos.ch;\n if (toEnd || ch > oldCh || ch > line.text.length) ch = line.text.length;\n return {line: lNo, ch: ch};\n }\n lNo += dir;\n }\n }\n var line = getLine(pos.line);\n var toEnd = pos.ch == line.text.length && pos.ch != oldCh;\n if (!line.hidden) return pos;\n if (pos.line >= oldLine) return getNonHidden(1) || getNonHidden(-1);\n else return getNonHidden(-1) || getNonHidden(1);\n }\n function setCursor(line, ch, user) {\n var pos = clipPos({line: line, ch: ch || 0});\n (user ? setSelectionUser : setSelection)(pos, pos);\n }\n\n function clipLine(n) {return Math.max(0, Math.min(n, doc.size-1));}\n function clipPos(pos) {\n if (pos.line < 0) return {line: 0, ch: 0};\n if (pos.line >= doc.size) return {line: doc.size-1, ch: getLine(doc.size-1).text.length};\n var ch = pos.ch, linelen = getLine(pos.line).text.length;\n if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};\n else if (ch < 0) return {line: pos.line, ch: 0};\n else return pos;\n }\n\n function findPosH(dir, unit) {\n var end = sel.inverted ? sel.from : sel.to, line = end.line, ch = end.ch;\n var lineObj = getLine(line);\n function findNextLine() {\n for (var l = line + dir, e = dir < 0 ? -1 : doc.size; l != e; l += dir) {\n var lo = getLine(l);\n if (!lo.hidden) { line = l; lineObj = lo; return true; }\n }\n }\n function moveOnce(boundToLine) {\n if (ch == (dir < 0 ? 0 : lineObj.text.length)) {\n if (!boundToLine && findNextLine()) ch = dir < 0 ? lineObj.text.length : 0;\n else return false;\n } else ch += dir;\n return true;\n }\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\") {\n var sawWord = false;\n for (;;) {\n if (dir < 0) if (!moveOnce()) break;\n if (isWordChar(lineObj.text.charAt(ch))) sawWord = true;\n else if (sawWord) {if (dir < 0) {dir = 1; moveOnce();} break;}\n if (dir > 0) if (!moveOnce()) break;\n }\n }\n return {line: line, ch: ch};\n }\n function moveH(dir, unit) {\n var pos = dir < 0 ? sel.from : sel.to;\n if (shiftSelecting || posEq(sel.from, sel.to)) pos = findPosH(dir, unit);\n setCursor(pos.line, pos.ch, true);\n }\n function deleteH(dir, unit) {\n if (!posEq(sel.from, sel.to)) replaceRange(\"\", sel.from, sel.to);\n else if (dir < 0) replaceRange(\"\", findPosH(dir, unit), sel.to);\n else replaceRange(\"\", sel.from, findPosH(dir, unit));\n userSelChange = true;\n }\n var goalColumn = null;\n function moveV(dir, unit) {\n var dist = 0, pos = localCoords(sel.inverted ? sel.from : sel.to, true);\n if (goalColumn != null) pos.x = goalColumn;\n if (unit == \"page\") dist = Math.min(scroller.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n else if (unit == \"line\") dist = textHeight();\n var target = coordsChar(pos.x, pos.y + dist * dir + 2);\n if (unit == \"page\") scroller.scrollTop += localCoords(target, true).y - pos.y;\n setCursor(target.line, target.ch, true);\n goalColumn = pos.x;\n }\n\n function selectWordAt(pos) {\n var line = getLine(pos.line).text;\n var start = pos.ch, end = pos.ch;\n while (start > 0 && isWordChar(line.charAt(start - 1))) --start;\n while (end < line.length && isWordChar(line.charAt(end))) ++end;\n setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end});\n }\n function selectLine(line) {\n setSelectionUser({line: line, ch: 0}, clipPos({line: line + 1, ch: 0}));\n }\n function indentSelected(mode) {\n if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);\n var e = sel.to.line - (sel.to.ch ? 0 : 1);\n for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);\n }\n\n function indentLine(n, how) {\n if (!how) how = \"add\";\n if (how == \"smart\") {\n if (!mode.indent) how = \"prev\";\n else var state = getStateBefore(n);\n }\n\n var line = getLine(n), curSpace = line.indentation(options.tabSize),\n curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (how == \"prev\") {\n if (n) indentation = getLine(n-1).indentation(options.tabSize);\n else indentation = 0;\n }\n else if (how == \"smart\") indentation = mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n else if (how == \"add\") indentation = curSpace + options.indentUnit;\n else if (how == \"subtract\") indentation = curSpace - options.indentUnit;\n indentation = Math.max(0, indentation);\n var diff = indentation - curSpace;\n\n if (!diff) {\n if (sel.from.line != n && sel.to.line != n) return;\n var indentString = curSpaceString;\n }\n else {\n var indentString = \"\", pos = 0;\n if (options.indentWithTabs)\n for (var i = Math.floor(indentation / options.tabSize); i; --i) {pos += options.tabSize; indentString += \"\\t\";}\n while (pos < indentation) {++pos; indentString += \" \";}\n }\n\n replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});\n }\n\n function loadMode() {\n mode = CodeMirror.getMode(options, options.mode);\n doc.iter(0, doc.size, function(line) { line.stateAfter = null; });\n work = [0];\n startWorker();\n }\n function gutterChanged() {\n var visible = options.gutter || options.lineNumbers;\n gutter.style.display = visible ? \"\" : \"none\";\n if (visible) gutterDirty = true;\n else lineDiv.parentNode.style.marginLeft = 0;\n }\n function wrappingChanged(from, to) {\n if (options.lineWrapping) {\n wrapper.className += \" CodeMirror-wrap\";\n var perLine = scroller.clientWidth / charWidth() - 3;\n doc.iter(0, doc.size, function(line) {\n if (line.hidden) return;\n var guess = Math.ceil(line.text.length / perLine) || 1;\n if (guess != 1) updateLineHeight(line, guess);\n });\n lineSpace.style.width = code.style.width = \"\";\n } else {\n wrapper.className = wrapper.className.replace(\" CodeMirror-wrap\", \"\");\n maxWidth = null; maxLine = \"\";\n doc.iter(0, doc.size, function(line) {\n if (line.height != 1 && !line.hidden) updateLineHeight(line, 1);\n if (line.text.length > maxLine.length) maxLine = line.text;\n });\n }\n changes.push({from: 0, to: doc.size});\n }\n function makeTab(col) {\n var w = options.tabSize - col % options.tabSize, cached = tabCache[w];\n if (cached) return cached;\n for (var str = '<span class=\"cm-tab\">', i = 0; i < w; ++i) str += \" \";\n return (tabCache[w] = {html: str + \"</span>\", width: w});\n }\n function themeChanged() {\n scroller.className = scroller.className.replace(/\\s*cm-s-\\S+/g, \"\") +\n options.theme.replace(/(^|\\s)\\s*/g, \" cm-s-\");\n }\n\n function TextMarker() { this.set = []; }\n TextMarker.prototype.clear = operation(function() {\n var min = Infinity, max = -Infinity;\n for (var i = 0, e = this.set.length; i < e; ++i) {\n var line = this.set[i], mk = line.marked;\n if (!mk || !line.parent) continue;\n var lineN = lineNo(line);\n min = Math.min(min, lineN); max = Math.max(max, lineN);\n for (var j = 0; j < mk.length; ++j)\n if (mk[j].marker == this) mk.splice(j--, 1);\n }\n if (min != Infinity)\n changes.push({from: min, to: max + 1});\n });\n TextMarker.prototype.find = function() {\n var from, to;\n for (var i = 0, e = this.set.length; i < e; ++i) {\n var line = this.set[i], mk = line.marked;\n for (var j = 0; j < mk.length; ++j) {\n var mark = mk[j];\n if (mark.marker == this) {\n if (mark.from != null || mark.to != null) {\n var found = lineNo(line);\n if (found != null) {\n if (mark.from != null) from = {line: found, ch: mark.from};\n if (mark.to != null) to = {line: found, ch: mark.to};\n }\n }\n }\n }\n }\n return {from: from, to: to};\n };\n\n function markText(from, to, className) {\n from = clipPos(from); to = clipPos(to);\n var tm = new TextMarker();\n if (!posLess(from, to)) return tm;\n function add(line, from, to, className) {\n getLine(line).addMark(new MarkedText(from, to, className, tm));\n }\n if (from.line == to.line) add(from.line, from.ch, to.ch, className);\n else {\n add(from.line, from.ch, null, className);\n for (var i = from.line + 1, e = to.line; i < e; ++i)\n add(i, null, null, className);\n add(to.line, null, to.ch, className);\n }\n changes.push({from: from.line, to: to.line + 1});\n return tm;\n }\n\n function setBookmark(pos) {\n pos = clipPos(pos);\n var bm = new Bookmark(pos.ch);\n getLine(pos.line).addMark(bm);\n return bm;\n }\n\n function findMarksAt(pos) {\n pos = clipPos(pos);\n var markers = [], marked = getLine(pos.line).marked;\n if (!marked) return markers;\n for (var i = 0, e = marked.length; i < e; ++i) {\n var m = marked[i];\n if ((m.from == null || m.from <= pos.ch) &&\n (m.to == null || m.to >= pos.ch))\n markers.push(m.marker || m);\n }\n return markers;\n }\n\n function addGutterMarker(line, text, className) {\n if (typeof line == \"number\") line = getLine(clipLine(line));\n line.gutterMarker = {text: text, style: className};\n gutterDirty = true;\n return line;\n }\n function removeGutterMarker(line) {\n if (typeof line == \"number\") line = getLine(clipLine(line));\n line.gutterMarker = null;\n gutterDirty = true;\n }\n\n function changeLine(handle, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") line = getLine(clipLine(handle));\n else no = lineNo(handle);\n if (no == null) return null;\n if (op(line, no)) changes.push({from: no, to: no + 1});\n else return null;\n return line;\n }\n function setLineClass(handle, className, bgClassName) {\n return changeLine(handle, function(line) {\n if (line.className != className || line.bgClassName != bgClassName) {\n line.className = className;\n line.bgClassName = bgClassName;\n return true;\n }\n });\n }\n function setLineHidden(handle, hidden) {\n return changeLine(handle, function(line, no) {\n if (line.hidden != hidden) {\n line.hidden = hidden;\n updateLineHeight(line, hidden ? 0 : 1);\n var fline = sel.from.line, tline = sel.to.line;\n if (hidden && (fline == no || tline == no)) {\n var from = fline == no ? skipHidden({line: fline, ch: 0}, fline, 0) : sel.from;\n var to = tline == no ? skipHidden({line: tline, ch: 0}, tline, 0) : sel.to;\n // Can't hide the last visible line, we'd have no place to put the cursor\n if (!to) return;\n setSelection(from, to);\n }\n return (gutterDirty = true);\n }\n });\n }\n\n function lineInfo(line) {\n if (typeof line == \"number\") {\n if (!isLine(line)) return null;\n var n = line;\n line = getLine(line);\n if (!line) return null;\n }\n else {\n var n = lineNo(line);\n if (n == null) return null;\n }\n var marker = line.gutterMarker;\n return {line: n, handle: line, text: line.text, markerText: marker && marker.text,\n markerClass: marker && marker.style, lineClass: line.className, bgClass: line.bgClassName};\n }\n\n function stringWidth(str) {\n measure.innerHTML = \"<pre><span>x</span></pre>\";\n measure.firstChild.firstChild.firstChild.nodeValue = str;\n return measure.firstChild.firstChild.offsetWidth || 10;\n }\n // These are used to go from pixel positions to character\n // positions, taking varying character widths into account.\n function charFromX(line, x) {\n if (x <= 0) return 0;\n var lineObj = getLine(line), text = lineObj.text;\n function getX(len) {\n return measureLine(lineObj, len).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 / charWidth()));\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 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 (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 }\n\n var tempId = \"CodeMirror-temp-\" + Math.floor(Math.random() * 0xffffff).toString(16);\n function measureLine(line, ch) {\n if (ch == 0) return {top: 0, left: 0};\n var wbr = options.lineWrapping && ch < line.text.length &&\n spanAffectsWrapping.test(line.text.slice(ch - 1, ch + 1));\n measure.innerHTML = \"<pre>\" + line.getHTML(makeTab, ch, tempId, wbr) + \"</pre>\";\n var elt = document.getElementById(tempId);\n var top = elt.offsetTop, left = elt.offsetLeft;\n // Older IEs report zero offsets for spans directly after a wrap\n if (ie && top == 0 && left == 0) {\n var backup = document.createElement(\"span\");\n backup.innerHTML = \"x\";\n elt.parentNode.insertBefore(backup, elt.nextSibling);\n top = backup.offsetTop;\n }\n return {top: top, left: left};\n }\n function localCoords(pos, inLineWrap) {\n var x, lh = textHeight(), y = lh * (heightAtLine(doc, pos.line) - (inLineWrap ? displayOffset : 0));\n if (pos.ch == 0) x = 0;\n else {\n var sp = measureLine(getLine(pos.line), pos.ch);\n x = sp.left;\n if (options.lineWrapping) y += Math.max(0, sp.top);\n }\n return {x: x, y: y, yBot: y + lh};\n }\n // Coords must be lineSpace-local\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 }\n function pageCoords(pos) {\n var local = localCoords(pos, true), off = eltOffset(lineSpace);\n return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};\n }\n\n var cachedHeight, cachedHeightFor, measureText;\n function textHeight() {\n if (measureText == null) {\n measureText = \"<pre>\";\n for (var i = 0; i < 49; ++i) measureText += \"x<br/>\";\n measureText += \"x</pre>\";\n }\n var offsetHeight = lineDiv.clientHeight;\n if (offsetHeight == cachedHeightFor) return cachedHeight;\n cachedHeightFor = offsetHeight;\n measure.innerHTML = measureText;\n cachedHeight = measure.firstChild.offsetHeight / 50 || 1;\n measure.innerHTML = \"\";\n return cachedHeight;\n }\n var cachedWidth, cachedWidthFor = 0;\n function charWidth() {\n if (scroller.clientWidth == cachedWidthFor) return cachedWidth;\n cachedWidthFor = scroller.clientWidth;\n return (cachedWidth = stringWidth(\"x\"));\n }\n function paddingTop() {return lineSpace.offsetTop;}\n function paddingLeft() {return lineSpace.offsetLeft;}\n\n function posFromMouse(e, liberal) {\n var offW = eltOffset(scroller, true), x, y;\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX; y = e.clientY; } catch (e) { return null; }\n // This is a mess of a heuristic to try and determine whether a\n // scroll-bar was clicked or not, and to return null if one was\n // (and !liberal).\n if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))\n return null;\n var offL = eltOffset(lineSpace, true);\n return coordsChar(x - offL.left, y - offL.top);\n }\n function onContextMenu(e) {\n var pos = posFromMouse(e), scrollPos = scroller.scrollTop;\n if (!pos || window.opera) return; // Opera is difficult.\n if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))\n operation(setCursor)(pos.line, pos.ch);\n\n var oldCSS = input.style.cssText;\n inputDiv.style.position = \"absolute\";\n input.style.cssText = \"position: fixed; width: 30px; height: 30px; top: \" + (e.clientY - 5) +\n \"px; left: \" + (e.clientX - 5) + \"px; z-index: 1000; background: white; \" +\n \"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n leaveInputAlone = true;\n var val = input.value = getSelection();\n focusInput();\n selectInput(input);\n function rehide() {\n var newVal = splitLines(input.value).join(\"\\n\");\n if (newVal != val) operation(replaceSelection)(newVal, \"end\");\n inputDiv.style.position = \"relative\";\n input.style.cssText = oldCSS;\n if (ie_lt9) scroller.scrollTop = scrollPos;\n leaveInputAlone = false;\n resetInput(true);\n slowPoll();\n }\n\n if (gecko) {\n e_stop(e);\n var mouseup = connect(window, \"mouseup\", function() {\n mouseup();\n setTimeout(rehide, 20);\n }, true);\n } else {\n setTimeout(rehide, 50);\n }\n }\n\n // Cursor-blinking\n function restartBlink() {\n clearInterval(blinker);\n var on = true;\n cursor.style.visibility = \"\";\n blinker = setInterval(function() {\n cursor.style.visibility = (on = !on) ? \"\" : \"hidden\";\n }, 650);\n }\n\n var matching = {\"(\": \")>\", \")\": \"(<\", \"[\": \"]>\", \"]\": \"[<\", \"{\": \"}>\", \"}\": \"{<\"};\n function matchBrackets(autoclear) {\n var head = sel.inverted ? sel.from : sel.to, line = getLine(head.line), pos = head.ch - 1;\n var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];\n if (!match) return;\n var ch = match.charAt(0), forward = match.charAt(1) == \">\", d = forward ? 1 : -1, st = line.styles;\n for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)\n if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}\n\n var stack = [line.text.charAt(pos)], re = /[(){}[\\]]/;\n function scan(line, from, to) {\n if (!line.text) return;\n var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;\n for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {\n var text = st[i];\n if (st[i+1] != null && st[i+1] != style) {pos += d * text.length; continue;}\n for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {\n if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {\n var match = matching[cur];\n if (match.charAt(1) == \">\" == forward) stack.push(cur);\n else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};\n else if (!stack.length) return {pos: pos, match: true};\n }\n }\n }\n }\n for (var i = head.line, e = forward ? Math.min(i + 100, doc.size) : Math.max(-1, i - 100); i != e; i+=d) {\n var line = getLine(i), first = i == head.line;\n var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);\n if (found) break;\n }\n if (!found) found = {pos: null, match: false};\n var style = found.match ? \"CodeMirror-matchingbracket\" : \"CodeMirror-nonmatchingbracket\";\n var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),\n two = found.pos != null && markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style);\n var clear = operation(function(){one.clear(); two && two.clear();});\n if (autoclear) setTimeout(clear, 800);\n else bracketHighlighted = clear;\n }\n\n // Finds the line to start with when starting a parse. Tries to\n // find a line with a stateAfter, so that it can start with a\n // valid state. If that fails, it returns the line with the\n // smallest indentation, which tends to need the least context to\n // parse correctly.\n function findStartLine(n) {\n var minindent, minline;\n for (var search = n, lim = n - 40; search > lim; --search) {\n if (search == 0) return 0;\n var line = getLine(search-1);\n if (line.stateAfter) return search;\n var indented = line.indentation(options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline;\n }\n function getStateBefore(n) {\n var start = findStartLine(n), state = start && getLine(start-1).stateAfter;\n if (!state) state = startState(mode);\n else state = copyState(mode, state);\n doc.iter(start, n, function(line) {\n line.highlight(mode, state, options.tabSize);\n line.stateAfter = copyState(mode, state);\n });\n if (start < n) changes.push({from: start, to: n});\n if (n < doc.size && !getLine(n).stateAfter) work.push(n);\n return state;\n }\n function highlightLines(start, end) {\n var state = getStateBefore(start);\n doc.iter(start, end, function(line) {\n line.highlight(mode, state, options.tabSize);\n line.stateAfter = copyState(mode, state);\n });\n }\n function highlightWorker() {\n var end = +new Date + options.workTime;\n var foundWork = work.length;\n while (work.length) {\n if (!getLine(showingFrom).stateAfter) var task = showingFrom;\n else var task = work.pop();\n if (task >= doc.size) continue;\n var start = findStartLine(task), state = start && getLine(start-1).stateAfter;\n if (state) state = copyState(mode, state);\n else state = startState(mode);\n\n var unchanged = 0, compare = mode.compareStates, realChange = false,\n i = start, bail = false;\n doc.iter(i, doc.size, function(line) {\n var hadState = line.stateAfter;\n if (+new Date > end) {\n work.push(i);\n startWorker(options.workDelay);\n if (realChange) changes.push({from: task, to: i + 1});\n return (bail = true);\n }\n var changed = line.highlight(mode, state, options.tabSize);\n if (changed) realChange = true;\n line.stateAfter = copyState(mode, state);\n var done = null;\n if (compare) {\n var same = hadState && compare(hadState, state);\n if (same != Pass) done = !!same;\n }\n if (done == null) {\n if (changed !== false || !hadState) unchanged = 0;\n else if (++unchanged > 3 && (!mode.indent || mode.indent(hadState, \"\") == mode.indent(state, \"\")))\n done = true;\n }\n if (done) return true;\n ++i;\n });\n if (bail) return;\n if (realChange) changes.push({from: task, to: i + 1});\n }\n if (foundWork && options.onHighlightComplete)\n options.onHighlightComplete(instance);\n }\n function startWorker(time) {\n if (!work.length) return;\n highlight.set(time, operation(highlightWorker));\n }\n\n // Operations are used to wrap changes in such a way that each\n // change won't have to update the cursor and display (which would\n // be awkward, slow, and error-prone), but instead updates are\n // batched and then all combined and executed at once.\n function startOperation() {\n updateInput = userSelChange = textChanged = null;\n changes = []; selectionChanged = false; callbacks = [];\n }\n function endOperation() {\n var reScroll = false, updated;\n if (selectionChanged) reScroll = !scrollCursorIntoView();\n if (changes.length) updated = updateDisplay(changes, true);\n else {\n if (selectionChanged) updateSelection();\n if (gutterDirty) updateGutter();\n }\n if (reScroll) scrollCursorIntoView();\n if (selectionChanged) {scrollEditorIntoView(); restartBlink();}\n\n if (focused && !leaveInputAlone &&\n (updateInput === true || (updateInput !== false && selectionChanged)))\n resetInput(userSelChange);\n\n if (selectionChanged && options.matchBrackets)\n setTimeout(operation(function() {\n if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}\n if (posEq(sel.from, sel.to)) matchBrackets(false);\n }), 20);\n var tc = textChanged, cbs = callbacks; // these can be reset by callbacks\n if (selectionChanged && options.onCursorActivity)\n options.onCursorActivity(instance);\n if (tc && options.onChange && instance)\n options.onChange(instance, tc);\n for (var i = 0; i < cbs.length; ++i) cbs[i](instance);\n if (updated && options.onUpdate) options.onUpdate(instance);\n }\n var nestedOperation = 0;\n function operation(f) {\n return function() {\n if (!nestedOperation++) startOperation();\n try {var result = f.apply(this, arguments);}\n finally {if (!--nestedOperation) endOperation();}\n return result;\n };\n }\n\n function compoundChange(f) {\n history.startCompound();\n try { return f(); } finally { history.endCompound(); }\n }\n\n for (var ext in extensions)\n if (extensions.propertyIsEnumerable(ext) &&\n !instance.propertyIsEnumerable(ext))\n instance[ext] = extensions[ext];\n return instance;\n } // (end of function CodeMirror)", "getCodeMirror() {\n return this.editor\n }", "function EditorConstructor() { }", "function EditorConstructor() { }", "get editor() {\n return this._editor;\n }", "get editor() {\n return this._editor;\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 Editor(contentDiv, options) {\n var _this = this;\n if (options === void 0) { options = {}; }\n // 1. Make sure all parameters are valid\n if (roosterjs_editor_dom_1.getTagOfNode(contentDiv) != 'DIV') {\n throw new Error('contentDiv must be an HTML DIV element');\n }\n // 2. Store options values to local variables\n this.core = createEditorCore_1.default(contentDiv, options);\n // 3. Initialize plugins\n this.core.plugins.forEach(function (plugin) { return plugin.initialize(_this); });\n // 4. Ensure initial content and its format\n this.setContent(options.initialContent || contentDiv.innerHTML || '', false /*triggerContentChangedEvent*/);\n // 5. Create event handler to bind DOM events\n this.eventDisposers = mapPluginEvents_1.default(this.core);\n // 6. Add additional content edit features to the editor if specified\n if (options.additionalEditFeatures) {\n options.additionalEditFeatures.forEach(function (feature) { return _this.addContentEditFeature(feature); });\n }\n // 7. Make the container editable and set its selection styles\n if (!options.omitContentEditableAttributeChanges && !contentDiv.isContentEditable) {\n contentDiv.setAttribute('contenteditable', 'true');\n var styles = contentDiv.style;\n styles.userSelect = styles.msUserSelect = styles.webkitUserSelect = 'text';\n this.contenteditableChanged = true;\n }\n // 8. Do proper change for browsers to disable some browser-specified behaviors.\n adjustBrowserBehavior_1.default();\n // 9. Let plugins know that we are ready\n this.triggerPluginEvent(9 /* EditorReady */, {}, true /*broadcast*/);\n // 10. Before give editor to user, make sure there is at least one DIV element to accept typing\n this.core.corePlugins.typeInContainer.ensureTypeInElement(this.getFocusedPosition() || new roosterjs_editor_dom_1.Position(contentDiv, 0 /* Begin */));\n }", "function init() {\n var cm = new CodeMirror(document.getElementById('editor-container'), {\n mode: 'erv',\n tabSize: 4,\n indentWithTabs: false,\n indentUnit: 4,\n lineNumbers: true,\n gutters: ['error-markers'],\n hintOptions: {\n hint: getAutoCompletionHints\n }\n });\n cm.on('change', onEditorContentChange);\n return cm;\n}", "constructor(editor) {\n _defineProperty(this, \"editor\", void 0);\n\n _defineProperty(this, \"command\", void 0);\n\n if (!editor) {\n throw new Error('no editor');\n }\n\n this.editor = editor;\n this.command = this.getCommand();\n }", "function ParsingCodeMirror(place, givenOptions) {\n // Called whenever content of the editor area changes.\n function reparse() {\n var sourceCode = codeMirror.getValue();\n var result = givenOptions.parse(sourceCode);\n codeMirror.trigger(\"reparse\", {\n error: result.error,\n sourceCode: sourceCode,\n document: result.document\n });\n // Cursor activity would've been fired before us, so call it again\n // to make sure it displays the right context-sensitive help based\n // on the new state of the document.\n onCursorActivity();\n }\n\n // Called whenever the user moves their cursor in the editor area.\n function onCursorActivity() {\n codeMirror.trigger(\"cursor-activity\");\n }\n\n // The number of milliseconds to wait before re-parsing the editor\n // content.\n var parseDelay = givenOptions.parseDelay || 300;\n var time = givenOptions.time || window;\n var reparseTimeout;\n\n givenOptions.onChange = function() {\n codeMirror.trigger(\"change\");\n if (reparseTimeout !== undefined)\n time.clearTimeout(reparseTimeout);\n reparseTimeout = time.setTimeout(reparse, parseDelay);\n };\n givenOptions.onCursorActivity = onCursorActivity;\n\n var codeMirror = IndexableCodeMirror(place, givenOptions);\n _.extend(codeMirror, Backbone.Events);\n codeMirror.reparse = reparse;\n return codeMirror;\n}", "function Editor() { }", "function Editor() { }", "function CodeMirrorEditorFactory(defaults) {\n if (defaults === void 0) { defaults = {}; }\n var _this = this;\n /**\n * Create a new editor for inline code.\n */\n this.newInlineEditor = function (options) {\n options.host.dataset.type = 'inline';\n return new editor_1.CodeMirrorEditor(__assign({}, options, { config: __assign({}, _this.inlineCodeMirrorConfig, options.config || {}) }));\n };\n /**\n * Create a new editor for a full document.\n */\n this.newDocumentEditor = function (options) {\n options.host.dataset.type = 'document';\n return new editor_1.CodeMirrorEditor(__assign({}, options, { config: __assign({}, _this.documentCodeMirrorConfig, options.config || {}) }));\n };\n this.inlineCodeMirrorConfig = __assign({}, editor_1.CodeMirrorEditor.defaultConfig, { extraKeys: {\n 'Cmd-Right': 'goLineRight',\n 'End': 'goLineRight',\n 'Cmd-Left': 'goLineLeft',\n 'Tab': 'indentMoreOrinsertTab',\n 'Shift-Tab': 'indentLess',\n 'Cmd-/': 'toggleComment',\n 'Ctrl-/': 'toggleComment',\n } }, defaults);\n this.documentCodeMirrorConfig = __assign({}, editor_1.CodeMirrorEditor.defaultConfig, { extraKeys: {\n 'Tab': 'indentMoreOrinsertTab',\n 'Shift-Tab': 'indentLess',\n 'Shift-Enter': function () { }\n }, lineNumbers: true, scrollPastEnd: true }, defaults);\n }", "get editor() {\n let editor = this.data.editor;\n\n if (editor && !(editor instanceof Widget)) {\n if (typeof editor === 'string') {\n editor = {\n type: editor\n };\n }\n editor = this.data.editor = WidgetHelper.createWidget(Object.assign(this.defaultEditor, editor));\n }\n return editor;\n }", "function createEditor() {\n const gutters = [\"breakpoints\", \"hit-markers\", \"CodeMirror-linenumbers\"];\n\n if (_prefs.features.codeFolding) {\n gutters.push(\"CodeMirror-foldgutter\");\n }\n\n return new _sourceEditor.default({\n mode: \"javascript\",\n foldGutter: _prefs.features.codeFolding,\n enableCodeFolding: _prefs.features.codeFolding,\n readOnly: true,\n lineNumbers: true,\n theme: \"mozilla\",\n styleActiveLine: false,\n lineWrapping: _prefs.prefs.editorWrapping,\n matchBrackets: true,\n showAnnotationRuler: true,\n gutters,\n value: \" \",\n extraKeys: {\n // Override code mirror keymap to avoid conflicts with split console.\n Esc: false,\n \"Cmd-F\": false,\n \"Ctrl-F\": false,\n \"Cmd-G\": false,\n \"Ctrl-G\": false\n }\n });\n}", "constructor(config, editor)\n {\n this.editor = editor;\n this.config = config;\n this.oEditor = null;\n }", "function Editor(props) {\n //props destructure we need to send to codemirror\n const { language, displayName, value, onChange } = props;\n\n //Options for the ControlledEditor\n const options = {\n lineWrapping: true,\n lint: true,\n mode: language,\n theme: \"material\",\n lineNumbers: true,\n };\n\n //Check if the column is or not collapsed\n const [open, setOpen] = useState(true);\n\n //Get the editor changes\n function handleChange(editor, data, value) {\n onChange(value);\n }\n\n return (\n <div className={`editor__container ${open ? \"\" : \"collapsed\"} `}>\n <div className=\"editor__title\">\n {displayName}\n <IconButton onClick={() => setOpen((prevOpen) => !prevOpen)}>\n <ZoomOutMapOutlinedIcon />\n </IconButton>\n </div>\n <ControlledEditor\n onBeforeChange={handleChange}\n value={value}\n className=\"code-mirror-wrapper\"\n options={options}\n ></ControlledEditor>\n </div>\n );\n}", "function Editor(selector) {\n this.$el = $(selector);\n this.editor = ace.edit(this.$el[0]);\n this.session = this.editor.getSession();\n this.document = this.session.getDocument();\n\n this.editor.setTheme('ace/theme/tomorrow');\n this.editor.setShowPrintMargin(false);\n this.$el.css({\n fontFamily: 'Menlo, Monaco, Consolas, \"Courier New\", monospace',\n lineHeight: 'inherit'\n });\n\n this.session.setMode('ace/mode/javascript');\n this.session.setUseSoftTabs(true);\n this.session.setTabSize(2);\n this.session.setUseWorker(false);\n\n this.editor.setOption('scrollPastEnd', 0.33);\n }", "setupCodemirror() {\n this.destroyCodemirror();\n const themes = this.props.theme.split(',').map(s => s.trim());\n let theme = 'default';\n for (let i = 0; i < themes.length; i++) {\n if (THEMES.indexOf(themes[i]) === -1) {\n theme = themes[i];\n break;\n }\n }\n\n const options = objectAssign(\n {\n theme,\n mode: 'markdown',\n readOnly: this.props.readOnly,\n tabSize: this.props.tabSize,\n lineNumbers: this.props.lineNumbers,\n lineWrapping: this.props.lineWrapping,\n indentWithTabs: this.props.indentWithTabs,\n styleActiveLine: this.props.styleActiveLine,\n },\n this.props.codemirrorOptions,\n );\n\n this.codemirror = CodeMirror.fromTextArea(this.codemirrorRef, options);\n this.codemirror.setValue(this.props.value);\n this.codemirror.on('change', this.handleCodemirrorChange);\n this.codemirror.on('focus', this.handleCodemirrorFocus);\n this.codemirror.on('blur', this.handleCodemirrorBlur);\n this.codemirror.on('drop', this.handleCodemirrorDrop);\n this.codemirror.on('cursorActivity', this.handleCodemirrorCursorActivity);\n objectForEach(this.props.codemirrorEvents, (handler, event) => {\n this.codemirror.on(event, handler);\n });\n }", "function makeEditor(_ref) {var editorPluginsToRun = _ref.editorPluginsToRun;var\n\t Editor = function (_React$Component) {_inherits(Editor, _React$Component);\n\n\t function Editor(props, context) {_classCallCheck(this, Editor);var _this = _possibleConstructorReturn(this, (Editor.__proto__ || Object.getPrototypeOf(Editor)).call(this,\n\t props, context));_initialiseProps.call(_this);\n\t if (props.value) {\n\t _this.yaml = props.value;\n\t }\n\t _this.state = {\n\t editor: null,\n\t value: props.value || \"\" };\n\n\n\t // see https://gist.github.com/Restuta/e400a555ba24daa396cc\n\t _this.onClick = _this.onClick.bind(_this);return _this;\n\t }_createClass(Editor, [{ key: \"componentWillMount\", value: function componentWillMount()\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t {\n\t // add user agent info to document\n\t // allows our custom Editor styling for IE10 to take effect\n\t var doc = document.documentElement;\n\t doc.setAttribute(\"data-useragent\", navigator.userAgent);\n\t } }, { key: \"componentDidMount\", value: function componentDidMount()\n\n\t {\n\t // eslint-disable-next-line react/no-did-mount-set-state\n\t this.setState({ width: this.getWidth() });\n\t document.addEventListener(\"click\", this.onClick);\n\n\t if (this.props.markers) {\n\t this.updateMarkerAnnotations({ markers: this.props.markers }, { force: true });\n\t }\n\t } }, { key: \"componentWillReceiveProps\", value: function componentWillReceiveProps(\n\n\t nextProps) {var _this2 = this;var\n\t state = this.state;\n\t var hasChanged = function hasChanged(k) {return !(0, _eq2.default)(nextProps[k], _this2.props[k]);};\n\t var wasEmptyBefore = function wasEmptyBefore(k) {return nextProps[k] && (!_this2.props[k] || (0, _isEmpty2.default)(_this2.props[k]));};\n\n\t this.updateErrorAnnotations(nextProps);\n\t this.setReadOnlyOptions(nextProps);\n\t this.updateMarkerAnnotations(nextProps);\n\n\t if (state.editor && nextProps.goToLine && hasChanged(\"goToLine\")) {\n\t state.editor.gotoLine(nextProps.goToLine.line);\n\t }\n\n\t this.setState({\n\t shouldClearUndoStack: hasChanged(\"specId\") || wasEmptyBefore(\"value\") });\n\n\n\t } }, { key: \"shouldComponentUpdate\", value: function shouldComponentUpdate(\n\n\n\n\t nextProps) {\n\t var oriYaml = this.yaml;\n\t this.yaml = nextProps.value;\n\n\t return oriYaml !== nextProps.value;\n\t } }, { key: \"render\", value: function render()\n\n\t {var\n\t readOnly = this.props.readOnly;\n\t var value = this.yaml;\n\n\t return (\n\t _react2.default.createElement(_reactAce2.default, {\n\t value: value,\n\t mode: \"yaml\",\n\t theme: \"tomorrow_night_eighties\",\n\t onLoad: this.onLoad,\n\t onChange: this.onChange,\n\t name: \"ace-editor\",\n\t width: \"100%\",\n\t height: \"100%\",\n\t tabSize: 2,\n\t fontSize: 14,\n\t readOnly: readOnly,\n\t useSoftTabs: \"true\",\n\t wrapEnabled: true,\n\t editorProps: {\n\t \"display_indent_guides\": true,\n\t folding: \"markbeginandend\" },\n\n\t setOptions: {\n\t cursorStyle: \"smooth\",\n\t wrapBehavioursEnabled: true } }));\n\n\n\n\t } }, { key: \"componentDidUpdate\", value: function componentDidUpdate()\n\n\t {var _state =\n\t this.state,shouldClearUndoStack = _state.shouldClearUndoStack,editor = _state.editor;\n\n\t if (shouldClearUndoStack) {\n\t setTimeout(function () {\n\t editor.getSession().getUndoManager().reset();\n\t }, 100);\n\t }\n\n\t } }, { key: \"componentWillUnmount\", value: function componentWillUnmount()\n\n\t {\n\t document.removeEventListener(\"click\", this.onClick);\n\t } }]);return Editor;}(_react2.default.Component);var _initialiseProps = function _initialiseProps() {var _this3 = this;this.onChange = function (value) {// Set the value in state, now - so that we don't have lag\n\t _this3.setState({ value: value }); // Send it upstream\n\t _this3.props.onChange(value);};this.onLoad = function (editor) {var props = _this3.props,state = _this3.state;var AST = props.AST,specObject = props.specObject;var langTools = _brace2.default.acequire(\"ace/ext/language_tools\");state.editor = editor; // TODO: get editor out of state\n\t editor.getSession().setUseWrapMode(true);var session = editor.getSession();session.on(\"changeScrollLeft\", function (xPos) {// eslint-disable-line no-unused-vars\n\t session.setScrollLeft(0);});(0, _hook2.default)(editor, props, editorPluginsToRun || [], { langTools: langTools, AST: AST, specObject: specObject });editor.setHighlightActiveLine(false);editor.setHighlightActiveLine(true);};this.onResize = function () {var editor = _this3.state.editor;if (editor) {var session = editor.getSession();editor.resize();var wrapLimit = session.getWrapLimit();editor.setPrintMarginColumn(wrapLimit);}};this.onClick = function () {// onClick is deferred by 40ms, to give element resizes time to settle.\n\t setTimeout(function () {if (_this3.getWidth() !== _this3.state.width) {_this3.onResize();_this3.setState({ width: _this3.getWidth() });}}, 40);};this.getWidth = function () {var el = document.getElementById(\"editor-wrapper\");return el ? el.getBoundingClientRect().width : null;};this.updateErrorAnnotations = function (nextProps) {if (_this3.state.editor && nextProps.errors) {var editorAnnotations = nextProps.errors.toJS().map(function (err) {// Create annotation objects that ACE can use\n\t return { row: err.line - 1, column: 0, type: err.level, text: err.message };});_this3.state.editor.getSession().setAnnotations(editorAnnotations);}};this.setReadOnlyOptions = function (nextProps) {var state = _this3.state;if (nextProps.readOnly === true && state.editor) {state.editor.setOptions({ readOnly: true, highlightActiveLine: false, highlightGutterLine: false });} else if (state.editor) {state.editor.setOptions({ readOnly: false, highlightActiveLine: true, highlightGutterLine: true });}};this.updateMarkerAnnotations = function (nextProps) {var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},force = _ref2.force;var state = _this3.state;var onMarkerLineUpdate = nextProps.onMarkerLineUpdate;var size = function size(obj) {return Object.keys(obj).length;}; // FIXME: this is a hacky solution.\n\t // we should find a way to wait until the spec has been loaded into ACE.\n\t if (force === true || _this3.props.specId !== nextProps.specId || size(_this3.props.markers) !== size(nextProps.markers)) {setTimeout(_markerPlacer.placeMarkerDecorations.bind(null, { editor: state.editor, markers: nextProps.markers, onMarkerLineUpdate: onMarkerLineUpdate }), 300);}};this.yaml = this.yaml || \"\";};Editor.propTypes = { specId: _react.PropTypes.string, value: _react.PropTypes.string, onChange: _react.PropTypes.func,\n\t onMarkerLineUpdate: _react.PropTypes.func,\n\n\t readOnly: _react.PropTypes.bool,\n\n\t markers: _react.PropTypes.object,\n\t goToLine: _react.PropTypes.object,\n\t specObject: _react.PropTypes.object.isRequired,\n\n\t AST: _react.PropTypes.object.isRequired,\n\n\t errors: _reactImmutableProptypes2.default.list };\n\n\n\t Editor.defaultProps = {\n\t value: \"\",\n\t specId: \"--unknown--\",\n\t onChange: NOOP,\n\t onMarkerLineUpdate: NOOP,\n\t markers: {},\n\t readOnly: false,\n\t goToLine: {},\n\t errors: (0, _immutable.fromJS)([]) };\n\n\n\t return Editor;\n\t}", "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 addCodeMirror(id) {\n\treturn CodeMirror.fromTextArea(document.getElementById(id), {\n\t\tmode: \"application/xml\",\n\t\ttabMode: \"indent\",\n\t\tstyleActiveLine: true,\n\t\tlineNumbers: true,\n\t\tlineWrapping: true,\n\t\tlineNumbers: true,\n\t});\n}", "function createEditorCore(contentDiv, options) {\n var corePlugins = {\n undo: options.undo || new Undo_1.default(),\n edit: new EditPlugin_1.default(),\n typeInContainer: new TypeInContainerPlugin_1.default(),\n mouseUp: new MouseUpPlugin_1.default(),\n domEvent: new DOMEventPlugin_1.default(options.disableRestoreSelectionOnFocus),\n firefoxTypeAfterLink: roosterjs_editor_dom_1.Browser.isFirefox && new FirefoxTypeAfterLink_1.default(),\n copyPlugin: !roosterjs_editor_dom_1.Browser.isIE && new CopyPlugin_1.default(),\n };\n var allPlugins = buildPluginList(corePlugins, options.plugins);\n var eventHandlerPlugins = allPlugins.filter(function (plugin) { return plugin.onPluginEvent || plugin.willHandleEventExclusively; });\n return {\n contentDiv: contentDiv,\n scrollContainer: options.scrollContainer || contentDiv,\n document: contentDiv.ownerDocument,\n defaultFormat: calculateDefaultFormat_1.calculateDefaultFormat(contentDiv, options.defaultFormat, options.inDarkMode),\n corePlugins: corePlugins,\n currentUndoSnapshot: null,\n customData: createCustomData(options.customData || {}),\n cachedSelectionRange: null,\n plugins: allPlugins,\n eventHandlerPlugins: eventHandlerPlugins,\n api: createCoreApiMap(options.coreApiOverride),\n defaultApi: createCoreApiMap(),\n inDarkMode: options.inDarkMode,\n darkModeOptions: options.darkModeOptions,\n };\n}", "initialize(options) {\n this.options = options;\n\n const codeMirrorOptions = {\n mode: {\n highlightFormatting: true,\n name: 'gfm',\n\n /*\n * The following token type overrides will be prefixed with\n * ``cm-`` when used as classes.\n */\n tokenTypeOverrides: {\n code: 'rb-markdown-code',\n list1: 'rb-markdown-list1',\n list2: 'rb-markdown-list2',\n list3: 'rb-markdown-list3'\n }\n },\n theme: 'rb default',\n lineWrapping: true,\n electricChars: false,\n styleSelectedText: true,\n extraKeys: {\n 'Home': 'goLineLeft',\n 'End': 'goLineRight',\n 'Enter': 'newlineAndIndentContinueMarkdownList',\n 'Shift-Tab': false,\n 'Tab': false\n }\n };\n\n if (options.autoSize) {\n codeMirrorOptions.viewportMargin = Infinity;\n }\n\n this._codeMirror = new CodeMirror(options.parentEl,\n codeMirrorOptions);\n\n this.setElement(this._codeMirror.getWrapperElement());\n\n if (this.options.minHeight !== undefined) {\n this.$el.css('min-height', this.options.minHeight);\n }\n\n this._codeMirror.on('viewportChange',\n () => this.$el.triggerHandler('resize'));\n this._codeMirror.on('change', () => this.trigger('change'));\n }", "isEditor(value) {\n if (!isPlainObject(value)) return false;\n var cachedIsEditor = IS_EDITOR_CACHE.get(value);\n\n if (cachedIsEditor !== undefined) {\n return cachedIsEditor;\n }\n\n var isEditor = typeof value.addMark === 'function' && typeof value.apply === 'function' && typeof value.deleteBackward === 'function' && typeof value.deleteForward === 'function' && typeof value.deleteFragment === 'function' && typeof value.insertBreak === 'function' && typeof value.insertFragment === 'function' && typeof value.insertNode === 'function' && typeof value.insertText === 'function' && typeof value.isInline === 'function' && typeof value.isVoid === 'function' && typeof value.normalizeNode === 'function' && typeof value.onChange === 'function' && typeof value.removeMark === 'function' && (value.marks === null || isPlainObject(value.marks)) && (value.selection === null || Range.isRange(value.selection)) && Node.isNodeList(value.children) && Operation.isOperationList(value.operations);\n IS_EDITOR_CACHE.set(value, isEditor);\n return isEditor;\n }", "function load_code_editor(){\n var e_d_count = 0;\n $(\".code_text\").each(function() {\n var lang = $(this).attr(\"data-lang\");\n //php application/x-httpd-php\n //css text/css\n //html text/html\n //javascript text/javascript\n switch(lang){\n case 'php':\n lang = 'application/x-httpd-php';\n break;\n case 'less':\n case 'css':\n lang = 'text/css';\n break;\n case 'html':\n lang = 'text/html';\n break;\n case 'javascript':\n lang = 'text/javascript';\n break;\n default:\n lang = 'application/x-httpd-php';\n }\n var theme = $(this).attr(\"data-theme\");\n switch(theme){\n case 'default':\n theme = 'default';\n break;\n case 'light':\n theme = 'solarizedLight';\n break;\n case 'dark':\n theme = 'solarizedDark';;\n break;\n default:\n theme = 'default';\n }\n \n var editor = CodeMirror.fromTextArea(document.getElementById($(this).attr('id')), {\n lineNumbers: true,\n matchBrackets: true,\n mode: lang,\n indentUnit: 4,\n indentWithTabs: true,\n enterMode: \"keep\",\n tabMode: \"shift\"\n });\n editor.setOption(\"theme\", theme);\n $(editor.getScrollerElement()).width(100); // set this low enough\n width = $(editor.getScrollerElement()).parent().width();\n $(editor.getScrollerElement()).width(width); // set it to\n editor.refresh();\n Ed_array[e_d_count] = editor;\n e_d_count++;\n });\n}", "function uiCodemirrorDirective(e,t){function n(e,n,s,l){var c=angular.extend({value:n.text()},t.codemirror||{},e.$eval(s.uiCodemirror),e.$eval(s.uiCodemirrorOpts)),u=r(n,c);i(u,s.uiCodemirror||s.uiCodemirrorOpts,e),o(u,l,e),a(u,s.uiRefresh,e),e.$on(\"CodeMirror\",function(e,t){if(!angular.isFunction(t))throw new Error(\"the CodeMirror event requires a callback function\");t(u)}),angular.isFunction(c.onLoad)&&c.onLoad(u)}function r(e,t){var n;return\"TEXTAREA\"===e[0].tagName?n=window.CodeMirror.fromTextArea(e[0],t):(e.html(\"\"),n=new window.CodeMirror(function(t){e.append(t)},t)),n}function i(e,t,n){function r(t,n){angular.isObject(t)&&i.forEach(function(r){if(t.hasOwnProperty(r)){if(n&&t[r]===n[r])return;e.setOption(r,t[r])}})}if(t){var i=Object.keys(window.CodeMirror.defaults);n.$watch(t,r,!0)}}function o(e,t,n){t&&(t.$formatters.push(function(e){if(angular.isUndefined(e)||null===e)return\"\";if(angular.isObject(e)||angular.isArray(e))throw new Error(\"ui-codemirror cannot use an object or an array as a model\");return e}),t.$render=function(){var n=t.$viewValue||\"\";e.setValue(n)},e.on(\"change\",function(e){var r=e.getValue();r!==t.$viewValue&&n.$evalAsync(function(){t.$setViewValue(r)})}))}function a(t,n,r){n&&r.$watch(n,function(n,r){n!==r&&e(function(){t.refresh()})})}return{restrict:\"EA\",require:\"?ngModel\",compile:function(){if(angular.isUndefined(window.CodeMirror))throw new Error(\"ui-codemirror needs CodeMirror to work... (o rly?)\");return n}}}" ]
[ "0.7637769", "0.7595455", "0.7582652", "0.7582652", "0.75507426", "0.75500923", "0.75465775", "0.7529049", "0.7527881", "0.7526824", "0.7526294", "0.7526294", "0.74995637", "0.74958473", "0.74776506", "0.74776506", "0.74776506", "0.74776506", "0.74776506", "0.74776506", "0.74768054", "0.74768054", "0.74768054", "0.74768054", "0.74768054", "0.74768054", "0.74768054", "0.7455725", "0.7434982", "0.73928934", "0.73894453", "0.7209269", "0.7209269", "0.7209269", "0.7189447", "0.7189447", "0.7189447", "0.7189447", "0.7189447", "0.7189447", "0.7189447", "0.7189447", "0.7147261", "0.69886786", "0.6944449", "0.6926119", "0.69065535", "0.6884486", "0.68756604", "0.68756604", "0.68400514", "0.68400514", "0.68400514", "0.68400514", "0.68400514", "0.68400514", "0.68400514", "0.68400514", "0.68400514", "0.6783499", "0.6783499", "0.6782566", "0.6782566", "0.6782566", "0.6782566", "0.6782566", "0.6782566", "0.67684126", "0.67684126", "0.67515063", "0.67515063", "0.6676595", "0.66086924", "0.66086924", "0.6548421", "0.6548421", "0.64866304", "0.64566684", "0.6391335", "0.6318962", "0.62644976", "0.62580717", "0.62580717", "0.6250712", "0.62015957", "0.6151123", "0.6106813", "0.6100348", "0.61001104", "0.6052939", "0.6007048", "0.5991463", "0.5972986", "0.5968451", "0.5949896", "0.5929337", "0.59198207", "0.5914603" ]
0.7432956
31
Attach the necessary event handlers when initializing the editor
function registerEventHandlers(cm) { var d = cm.display; on(d.scroller, "mousedown", operation(cm, onMouseDown)); // Older IE's will not fire a second mousedown for a double click if (ie && ie_version < 11) { on(d.scroller, "dblclick", operation(cm, function (e) { if (signalDOMEvent(cm, e)) { return } var pos = posFromMouse(cm, e); if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return } e_preventDefault(e); var word = cm.findWordAt(pos); extendSelection(cm.doc, word.anchor, word.head); })); } else { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); } // Some browsers fire contextmenu *after* opening the menu, at // which point we can't mess with it anymore. Context menu is // handled in onMouseDown for these browsers. on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); }); // Used to suppress mouse event handling when a touch happens var touchFinished, prevTouch = {end: 0}; function finishTouch() { if (d.activeTouch) { touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000); prevTouch = d.activeTouch; prevTouch.end = +new Date; } } function isMouseLikeTouchEvent(e) { if (e.touches.length != 1) { return false } var touch = e.touches[0]; return touch.radiusX <= 1 && touch.radiusY <= 1 } function farAway(touch, other) { if (other.left == null) { return true } var dx = other.left - touch.left, dy = other.top - touch.top; return dx * dx + dy * dy > 20 * 20 } on(d.scroller, "touchstart", function (e) { if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) { d.input.ensurePolled(); clearTimeout(touchFinished); var now = +new Date; d.activeTouch = {start: now, moved: false, prev: now - prevTouch.end <= 300 ? prevTouch : null}; if (e.touches.length == 1) { d.activeTouch.left = e.touches[0].pageX; d.activeTouch.top = e.touches[0].pageY; } } }); on(d.scroller, "touchmove", function () { if (d.activeTouch) { d.activeTouch.moved = true; } }); on(d.scroller, "touchend", function (e) { var touch = d.activeTouch; if (touch && !eventInWidget(d, e) && touch.left != null && !touch.moved && new Date - touch.start < 300) { var pos = cm.coordsChar(d.activeTouch, "page"), range; if (!touch.prev || farAway(touch, touch.prev)) // Single tap { range = new Range(pos, pos); } else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap { range = cm.findWordAt(pos); } else // Triple tap { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); } cm.setSelection(range.anchor, range.head); cm.focus(); e_preventDefault(e); } finishTouch(); }); on(d.scroller, "touchcancel", finishTouch); // Sync scrolling between fake scrollbars and real scrollable // area, ensure viewport is updated when scrolling. on(d.scroller, "scroll", function () { if (d.scroller.clientHeight) { updateScrollTop(cm, d.scroller.scrollTop); setScrollLeft(cm, d.scroller.scrollLeft, true); signal(cm, "scroll", cm); } }); // Listen to wheel events in order to try and update the viewport on time. on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); }); on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); }); // Prevent wrapper from ever scrolling on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; }); d.dragFunctions = { enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }}, over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }}, start: function (e) { return onDragStart(cm, e); }, drop: operation(cm, onDrop), leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }} }; var inp = d.input.getField(); on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); }); on(inp, "keydown", operation(cm, onKeyDown)); on(inp, "keypress", operation(cm, onKeyPress)); on(inp, "focus", function (e) { return onFocus(cm, e); }); on(inp, "blur", function (e) { return onBlur(cm, e); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n\n\t\t// Bind the editor elements to variables\n\t\tbindElements();\n\n\t\t// Create event listeners for keyup, mouseup, etc.\n\t\tcreateEventBindings();\n\t}", "initEventListners() {\n this.engine.getSession().selection.on('changeCursor', () => this.updateCursorLabels());\n\n this.engine.getSession().on('change', (e) => {\n // console.log(e);\n\n // Make sure the editor has content before allowing submissions\n this.allowCodeSubmission = this.engine.getValue() !== '';\n this.enableRunButton(this.allowCodeSubmission);\n });\n }", "function initEditor() {\n checkSetup();\n initFirebase();\n initConstants();\n initCanvas();\n initButton();\n initEditorData();\n initEventHandlers();\n resetEditor();\n initGrid();\n initSelectorContent();\n}", "async _onReady() {\n // Make the editor \"complex.\" This \"fluffs\" out the DOM and makes the\n // salient controller objects.\n this._editorComplex =\n new EditorComplex(this._sessionInfo, this._window, this._editorNode);\n\n await this._editorComplex.whenReady();\n this._recoverySetup();\n }", "async _onReady() {\n // Make the editor \"complex.\" This \"fluffs\" out the DOM and makes the\n // salient controller objects.\n this._editorComplex =\n new EditorComplex(this._sessionKey, this._window, this._editorNode);\n\n await this._editorComplex.whenReady();\n this._recoverySetup();\n }", "function ckeInitEvents(editor) {\n\t\n\teditor.on('blur', ckeBlurEvent);\n\teditor.on('focus', ckeFocusEvent);\n\teditor.on('change', ckeBlurEvent);\n\teditor.on('resize', ckeResizeEvent);\n\teditor.on('fileUploadRequest', ckeUploadEvent, null, null, 4); \n\n\tvar $textarea = $(editor.element.$);\n\tvar $inputfield = $textarea.closest('.Inputfield.InputfieldColumnWidth');\n\t\n\tif($inputfield.length) setTimeout(function() {\n\t\t$inputfield.trigger('heightChanged');\n\t}, 1000);\n}", "function initStepToolbarEventHandler() {\n initAddFieldSetEventHandler();\n initPreviewToggle();\n }", "init() {\n // Get saved editor settings if any or default values from SettingsHandler\n const initialLanguage = settingsHandler.getEditorLanguageMode();\n const initialContent = settingsHandler.getEditorContent();\n\n this.engine.setTheme('ace/theme/monokai');\n this.engine.$blockScrolling = Infinity;\n this.engine.setShowPrintMargin(false);\n // Define the language mode for syntax highlighting and editor content\n this.engine.getSession().setMode({path:'ace/mode/' + initialLanguage, inline:true});\n this.engine.setValue(initialContent);\n\n this.initEventListners();\n }", "function addEditorListener() {\n\t\t$('.editing .edit').on('keyup', function(e) {\n\t\t\tcheckEditPress(e);\n\t\t})\n\n\t}", "_initEvent() {\n this.eventManager.listen('wysiwygSetValueAfter', () => {\n this._unwrapDivOnHr();\n });\n }", "init() {\n this.editor.style.width = this.width;\n this.editor.style.height = this.height;\n this.bar.setupToolbar();\n\n this.createTag(\"\", this.getActiveTags(), this.getActiveStyle());\n\n let tools = document.querySelectorAll(\".editor-button\");\n tools.forEach(t => {\n t.addEventListener('click', (e) => {\n this.updateStyle(e);\n });\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 }", "function _registerHandlers(editor) {\n $(editor).on(\"keyEvent\", _cursorHandler);\n $(editor.document).one(\"change\", _handler);\n editor.document.addRef();\n }", "function initEditor() {\n renderWorkingLine();\n renderTextInput();\n renderFontColorPicker();\n renderFontSize();\n toggleStrokeBtn();\n renderStrokeColorPicker();\n renderStrokeSize();\n renderStickers();\n}", "load()\n {\n this.replaceTextArea();\n this.createCustomButtons();\n if (this.config.CKEditor.editorData !== undefined) {\n this.oEditor.setData(this.config.CKEditor.editorData);\n }\n if (this.config.RichFilemanager !== undefined) {\n this.editor.on('dialogDefinition', (event) => {this.connectRichFilemanager(event);});\n }\n }", "function vB_AJAX_QuickEditor_Events()\n{\n}", "initEditor() {\n\t\tlet navigationCallback = e => {\n\t\t\tlet target = this.props.data.nodes.filter(node => {\n\t\t\t\treturn node.instanceId === e.instanceId;\n\t\t\t});\n\n\t\t\t//\n\t\t\tlet nodeIndex = this.props.data.nodes.indexOf(target[0]);\n\t\t\t//\n\n\t\t\tdocument.querySelector(`#page${this.props.index}node${nodeIndex}`).click();\n\t\t};\n\n\t\tthis.editor = new buildfire.components.pluginInstance.sortableList(`#nodelist${this.props.index}`, [], { confirmDeleteItem: true }, false, false, { itemEditable: true, navigationCallback });\n\n\t\tthis.editor.onOrderChange = () => {\n\t\t\tthis.reorderNodes(this.props.index, this.editor.items);\n\t\t};\n\n\t\tthis.editor.onDeleteItem = () => {\n\t\t\tthis.reorderNodes(this.props.index, this.editor.items);\n\t\t};\n\t}", "_initEvents() {\n window.addEventListener(\"submitCommand\", event => this._processInput(event.detail));\n this.input.editableNode.onkeypress = () => {\n if (this.mode == Editor.MODE_INSERT)\n this.modificationSaved = false;\n };\n this.input.editableNode.onkeydown = event => {\n let keycode = event.keyCode;\n if (this.mode != Editor.MODE_INSERT && keycode !== 37 && keycode !== 38 && keycode !== 39 && keycode !== 40) {\n if (keycode !== Editor.KEY_TOGGLE_MODE_COMMAND)\n event.preventDefault();\n }\n }\n }", "function init() {\n\t\t\t\n\t\t\t// Is there any point in continuing?\n\t\t\tif (allElments.length == 0) {\n\t\t\t\tdebug('page contains no elements');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// Replace images\n\t\t\treplaceImgboxes();\n\t\t\t\n\t\t\t// Listen for window resize events\n\t\t\t$(window).on('resize', windowResizeImgbox);\n\n\t\t\t// Add mouse listeners if we are in edit mode\n\t\t\tif (settings.command == 'edit') {\n\t\t\t\tdebug('settings.command:edit');\n\t\t\t\t$(allElments).on('click', editClick);\n\t\t\t\t$(allElments).on('mousemove', editMousemove);\n\t\t\t}\n\t\t}", "@autobind\n initEvents() {\n $(document).on('intro', this.triggerIntro);\n $(document).on('instructions', this.triggerInstructions);\n $(document).on('question', this.triggerQuestion);\n $(document).on('submit_query', this.triggerSubmitQuery);\n $(document).on('query_complete', this.triggerQueryComplete);\n $(document).on('bummer', this.triggerBummer);\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 }", "function initEventHandler() {\n // initSortable();\n initFormEvents(fb);\n initListEvents(fb);\n}", "connectedCallback(){super.connectedCallback();let root=this;document.addEventListener(\"selectionchange\",e=>{root.range=root.getRange()});document.addEventListener(\"select-rich-text-editor-editor\",e=>{root._editorChange(e)});document.addEventListener(\"deselect-rich-text-editor-editor\",e=>{root._editorChange(e)})}", "function initEditor() {\n\t\t//first thing to do is set up loading page until we can establish a connection\n\t\tdrawLoadScreen();\n\t\tgetToken();\n\t}", "function attachWorkflowEditorEvents()\n {\n //Bind Save event\n $(\"#perc-wf-save\").off(\"click\").on(\"click\", function(evt)\n {\n saveNewWorkflow();\n });\n\n //Bind Cancel event\n $(\"#perc-wf-cancel, #perc-wf-update-cancel\").off(\"click\").on(\"click\", function(evt)\n {\n cancel();\n });\n\n //Bind Edit event\n\t\t\t$(\"#perc-wf-edit\").off(\"keydown\").on(\"keydown\", function(eventHandler)\n {\n if(eventHandler.code == \"Enter\" || eventHandler.code == \"Space\"){\n\t\t\t\tdocument.activeElement.click();\n\t\t\t}\n });\n $(\"#perc-wf-edit\").off(\"click\").on(\"click\", function(evt)\n {\n editWorkflow(evt);\n });\n\n //Bind Update event\n $(\"#perc-wf-update-save\").off(\"click\").on(\"click\", function(evt)\n {\n updateWorkflow();\n });\n }", "onInit() {\n this.__initEvents();\n }", "function attachEventHandlers() {\n // TODO arrow: attach events for functionality like in assignment-document described\n var clicked;\n $(\"#\"+_this.id).click(function(event){\n clicked = true;\n diagram.selectArrow(_this);\n });\n $(\"#\"+_this.id).contents().on(\"dblclick contextmenu\", function(event){\n clicked = true;\n event.preventDefault();\n });\n\n // TODO arrow optional: attach events for bonus points for 'TAB' to switch between arrows and to select arrow\n $(\"#\"+_this.id).contents().attr(\"tabindex\",\"0\");\n\n $(\"#\"+_this.id).keydown(function(event){\n if(event.which == \"13\"){\n diagram.selectArrow(_this);\n }\n if(event.which == \"9\"){\n clicked = false;\n }\n })\n $(\"#\"+_this.id).contents().focusin(function(event){\n if(!clicked){\n setActive(true);\n }\n });\n $(\"#\"+_this.id).contents().focusout(function(event){\n setActive(false);\n });\n }", "function fnInitialiseEditor()\n {\n elRoot.parentNode.classList.add('-active');\n\n // if it’s already there…\n if (oEditor !== null)\n {\n oEditor.setup();\n return;\n }\n\n // load raw markup from the server, then use it to init the editor\n ajaxRequest( `${options.uri}.json?field=${options.property}` ).then( oJson =>\n {\n // a. swap things out\n sOldMarkup = elRoot.innerHTML;\n elRoot.innerHTML = oJson.content;\n\n // b initiate the editor\n oEditor = new Editor( elRoot, { toolbar: { buttons: EDITOR_BUTTONS }});\n });\n }", "function init() {\n setDomEvents();\n }", "function init () {\n bindEventHandlers();\n}", "_initEvent() {\n this.cm.getWrapperElement().addEventListener('click', () => {\n this.eventManager.emit('click', {\n source: 'markdown'\n });\n });\n\n this.cm.on('beforeChange', (cm, ev) => {\n if (ev.origin === 'paste') {\n this.eventManager.emit('pasteBefore', {\n source: 'markdown',\n data: ev\n });\n }\n });\n\n this.cm.on('change', (cm, cmEvent) => {\n this._refreshCodeMirrorMarks(cmEvent);\n this._emitMarkdownEditorChangeEvent(cmEvent);\n });\n\n this.cm.on('focus', () => {\n this.eventManager.emit('focus', {\n source: 'markdown'\n });\n });\n\n this.cm.on('blur', () => {\n this.eventManager.emit('blur', {\n source: 'markdown'\n });\n });\n\n this.cm.on('scroll', (cm, eventData) => {\n this.eventManager.emit('scroll', {\n source: 'markdown',\n data: eventData\n });\n });\n\n this.cm.on('keydown', (cm, keyboardEvent) => {\n this.eventManager.emit('keydown', {\n source: 'markdown',\n data: keyboardEvent\n });\n\n this.eventManager.emit('keyMap', {\n source: 'markdown',\n keyMap: keyMapper.convert(keyboardEvent),\n data: keyboardEvent\n });\n });\n\n this.cm.on('keyup', (cm, keyboardEvent) => {\n this.eventManager.emit('keyup', {\n source: 'markdown',\n data: keyboardEvent\n });\n });\n\n this.cm.on('copy', (cm, ev) => {\n this.eventManager.emit('copy', {\n source: 'markdown',\n data: ev\n });\n });\n\n this.cm.on('cut', (cm, ev) => {\n this.eventManager.emit('cut', {\n source: 'markdown',\n data: ev\n });\n });\n\n this.cm.on('paste', (cm, clipboardEvent) => {\n this.eventManager.emit('paste', {\n source: 'markdown',\n data: clipboardEvent\n });\n });\n\n this.cm.on('drop', (cm, eventData) => {\n eventData.preventDefault();\n\n this.eventManager.emit('drop', {\n source: 'markdown',\n data: eventData\n });\n });\n\n this.cm.on('cursorActivity', () => this._onChangeCursorActivity());\n }", "function initCanvasAndEditor() {\n // Editor\n initEditor();\n\n // Canvas\n canvasResizer();\n renderCanvas();\n\n // Listeners\n addListeners();\n}", "init(ids) {\n initEditors(ids)\n }", "installed() {\n this._initializeEditor()\n }", "_initializeEditor(editor) {\n const that = this,\n editorTagName = 'jqx-' + JQX.Utilities.Core.toDash(editor),\n editorElement = document.createElement(editorTagName);\n\n if (editor === 'numericTextBox') {\n editorElement.spinButtons = true;\n editorElement.inputFormat = 'floatingPoint';\n }\n else if (editor === 'dateTimePicker') {\n editorElement.calendarButton = true;\n editorElement.dropDownDisplayMode = 'auto';\n editorElement.enableMouseWheelAction = true;\n editorElement.locale = that.locale;\n\n if (!editorElement.messages[that.locale]) {\n editorElement.messages[that.locale] = {};\n }\n\n editorElement.messages[that.locale].dateTabLabel = that.localize('dateTabLabel');\n editorElement.messages[that.locale].timeTabLabel = that.localize('timeTabLabel');\n }\n\n editorElement.tabIndex = '1';\n editorElement.theme = that.theme;\n editorElement.animation = that.animation;\n that.$[editor + 'Editor'] = editorElement;\n editorElement.$ = JQX.Utilities.Extend(editorElement);\n editorElement.className = editorTagName + '-editor jqx-hidden';\n that.$.editorsContainer.appendChild(editorElement);\n that['_' + editor + 'Initialized'] = true;\n }", "_init() {\n this.$inputs = this.$element.find('input, textarea, select');\n\n this._events();\n }", "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}", "constructChangeListeners() {\n // TODO it would be best to remove the event listeners after they are fired\n // and then re-instantiate them after a new recipe loads\n\n // Listener for the editor itself\n this.qEditor.on('text-change', () => {\n this.edited = true\n })\n\n // Listener for the tagInput add and remove events\n // FIXME it does not appear that the .offs are working for these\n this.tagInput.on('add', () => {\n this.edited = true\n })\n\n this.tagInput.on('remove', () => {\n this.edited = true\n })\n\n // Listener for title change\n const titleDOM = document.getElementById('title')\n titleDOM.addEventListener('input', () => {this.edited=true})\n\n // Listener for make-soon button\n const makeSoon = document.getElementById('make-soon-box')\n makeSoon.addEventListener('change', (evt) => {\n const checked = evt.srcElement.checked\n this.edited = true\n if(checked) {\n this.makeSoon = true\n } else {\n this.makeSoon = false\n }\n })\n\n // Listener for Tried 'n' True button\n const tried = document.getElementById('tried-box')\n tried.addEventListener('change', (evt) => {\n const checked = evt.srcElement.checked\n this.edited = true\n if(checked) {\n this.triedNTrue = true\n } else {\n this.triedNTrue = false\n }\n })\n }", "function slideEditorInit() {\n\t\t// Unbind anything that was previously bound\n\t\t$('body').off('click', '#fq_kiosk_gallery_add_slide, #fq_gallery_kiosk_save_new_slide, #fq_gallery_kiosk_cancel_slide', function() {\n\t\t\t\n\t\t});\n\t\t\n\t\t// Adding a new slide\n\t\t$('body').on('click', '#fq_kiosk_gallery_add_slide', function(e) {\n\t\t\te.preventDefault();\n\t\t\t\n\t\t\t// Does the editor area already exist? If it does, don't add another\n\t\t\tif ($('.slide-editor').length == 0) {\n\t\t\t\taddSlideEditor();\n\t\t\t}\n\t\t});\n\t\t\n\t\t// Cancelling the slide editor\n\t\t$('body').on('click', '#fq_gallery_kiosk_cancel_slide', function(e) {\n\t\t\tremoveSlideEditor();\n\t\t});\n\t\t\n\t\t// Add new slide\n\t\t$('body').on('click', '#fq_gallery_kiosk_save_new_slide', function(e) {\n\t\t\t// Save the tinymce content\n\t\t\ttinyMCE.get(\"slide_content\").save();\n\t\t\t\n\t\t\t// Stop the form submission\n\t\t\te.preventDefault();\n\t\t\t\n\t\t\t// Submit via an ajax promise\n\t\t\tvar promise = $.ajax({\n\t\t\t\turl: mobile_kiosk.template_url + '/fq/admin/mobile-kiosk/slide-create',\n\t\t\t\tmethod: 'POST',\n\t\t\t\tdata:{\n\t\t\t\t\tslide_title: $('[name=\"slide_title\"]').val(),\n\t\t\t\t\tslide_content: $('[name=\"slide_content\"]').val(),\n\t\t\t\t\tfeatured_image_id: $('[name=\"featured_image_id\"]').val()\n\t\t\t\t}\n\t\t\t});\t\t\n\t\t\t\n\t\t\tpromise.done(function(data) {\n\t\t\t\tdata = $.parseJSON(data);\n\t\t\t\t\n\t\t\t\t// Was this successful?\n\t\t\t\tif (!data.success) {\n\t\t\t\t\t// Add an alert with the error\n\t\t\t\t\t$('#slides_messages').html('<p class=\"alert alert-danger\">' + data.message + '</p>');\n\t\t\t\t} else {\n\t\t\t\t\t// Add an alert that this was successful\n\t\t\t\t\t$('#slides_messages').html('<p class=\"alert alert-success\">' + data.message + '</p>');\n\t\t\t\t\t\n\t\t\t\t\t// Add this to our list of slides\n\t\t\t\t\t$('.slides .no-slides').hide();\n\t\t\t\t\t$('.slides').append(data.template);\n\t\t\t\t\t\n\t\t\t\t\t// Remove the slide editor\n\t\t\t\t\tremoveSlideEditor();\n\t\t\t\t\tfadeOutMessages();\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t});\n\t\t\n\t\t\n\t\t// Enable adding existing slide\n\t\t$('body').on('click', '#fq_kiosk_gallery_add_existin_slide_trigger', function(e) {\n\t\t\t// Make sure the add slide functinoality isn't already visible\n\t\t\tif ($('#add_slide_wrapper .available-slides').length == 0) {\n\t\t\t\tremoveSlideEditor();\n\t\t\t\tshowAddSlide();\n\t\t\t}\n\t\t});\n\t\t\n\t\t// Allow removing of slides\n\t\t$('body').on('click', '.slides li .remove-slide', function(e) {\n\t\t\tvar slide = $(this);\n\t\t\t\n\t\t\t// Fade it out and then remove it\n\t\t\t$(slide).closest('li').fadeOut('250');\n\t\t\tsetTimeout(function() {\n\t\t\t\t$(slide).closest('li').remove();\n\t\t\t}, 500);\n\t\t});\n\t\t\n\t\t\n\t\t// Bind link for editing slide\n\t\t$('body').on('click', '.slide-preview .edit', function(e) {\n\t\t\te.preventDefault();\n\t\t\t\n\t\t\t// Color the row\n\t\t\t$('li.editing').removeClass('editing');\n\t\t\t$(this).closest('li').addClass('editing');\n\t\t\t\n\t\t\tshowSlideEdit($(this).closest('li').data('id'));\n\t\t});\n\t\t\n\t\t\n\t\tif ($('#sortable').length > 0) {\n\t\t\t$(\"#sortable\").sortable({ \n\t\t\t cursor: \"move\", \n\t\t\t containment: \"#gallery-slides\",\n\t\t\t});\n\t\t}\n\t\t\n\t\tif ($('.primary-color').length > 0) {\n\t\t\t$('.primary-color').wpColorPicker();\n\t\t}\n\t\t\n\t\t\n\t\tgalleryLogo();\n\t\t\n\t}", "_initializeEditor(editor) {\n const that = this;\n\n if (that.$[editor + 'Editor']) {\n that._editor = that.$[editor + 'Editor'];\n return;\n }\n\n const editorElement = document.createElement('jqx-' + JQX.Utilities.Core.toDash(editor));\n\n if (editor === 'numericTextBox') {\n editorElement.spinButtons = true;\n editorElement.inputFormat = 'floatingPoint';\n }\n else if (editor === 'dateTimePicker') {\n editorElement.dropDownAppendTo = that.$.container;\n editorElement.calendarButton = true;\n editorElement.dropDownDisplayMode = 'auto';\n editorElement.enableMouseWheelAction = true;\n editorElement.locale = that.locale;\n\n if (!editorElement.messages[that.locale]) {\n editorElement.messages[that.locale] = {};\n }\n\n editorElement.messages[that.locale].dateTabLabel = that.localize('dateTabLabel');\n editorElement.messages[that.locale].timeTabLabel = that.localize('timeTabLabel');\n }\n\n editorElement.theme = that.theme;\n editorElement.animation = that.animation;\n editorElement.$.addClass('jqx-hidden underlined');\n that.$.editorsContainer.appendChild(editorElement);\n that._editor = that.$[editor + 'Editor'] = editorElement;\n }", "function attached() {\n\t/* jslint validthis:true */\n\tthis._editor = create( this, this.$.editor );\n} // end FUNCTION attached()", "getEditorListeners() {\n return {\n focusout: 'onEditorFocusOut',\n focusin: 'onEditorFocusIn',\n start: 'onEditorStart',\n beforecomplete: 'onEditorBeforeComplete',\n complete: 'onEditorComplete',\n cancel: 'onEditorCancel',\n thisObj: this\n };\n }", "getEditorListeners() {\n return {\n focusout: 'onEditorFocusOut',\n focusin: 'onEditorFocusIn',\n start: 'onEditorStart',\n beforecomplete: 'onEditorBeforeComplete',\n complete: 'onEditorComplete',\n cancel: 'onEditorCancel',\n thisObj: this\n };\n }", "function initInstanceCallback(editor) {\n const element = document.getElementById(editor.id).closest(\".element-editor\")\n element.getElementsByClassName(\"spinner\").item(0).remove()\n editor.on(\"dirty\", function () {\n Alchemy.setElementDirty(element)\n })\n editor.on(\"click\", function (event) {\n event.target = element\n Alchemy.ElementEditors.onClickElement(event)\n })\n}", "function MMMediaBundleFileDropzoneInitiateEvents() {\n\n // mandarinmedien/mmcmfadminbundle\n $(document).on('mmcmfadmin:tabs:add:first', MMMediaBundleInit);\n\n // mandarinmedien/mmcmfcontentbundle\n $(document).on('modalOpen.settingsForm.MMCmfContentFieldEditor', MMMediaBundleInit);\n}", "function init(){\n buildComponent();\n attachHandlers();\n addComponents();\n }", "function initEditor()\r\n{\r\n\t// Insert tab in the code box\r\n\t$('[name=\"data\"]').off('keydown').on('keydown', function (e)\r\n\t{\r\n\t\tif (e.keyCode == 9)\r\n\t\t{\r\n\t\t\tvar myValue = \"\\t\";\r\n\t\t\tvar startPos = this.selectionStart;\r\n\t\t\tvar endPos = this.selectionEnd;\r\n\t\t\tvar scrollTop = this.scrollTop;\r\n\r\n\t\t\tthis.value = this.value.substring(0, startPos) + myValue + this.value.substring(endPos,this.value.length);\r\n\t\t\tthis.focus();\r\n\t\t\tthis.selectionStart = startPos + myValue.length;\r\n\t\t\tthis.selectionEnd = startPos + myValue.length;\r\n\t\t\tthis.scrollTop = scrollTop;\r\n\r\n\t\t\te.preventDefault();\r\n\t\t}\r\n\t});\r\n\r\n\t// Tick the private checkbox if password is entered\r\n\t$('[name=\"password\"]').off('keyup').on('keyup', function()\r\n\t{\r\n\t\t$('[name=\"private\"]').attr('checked', $(this).val().length > 0);\r\n\t});\r\n}", "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}", "_editorChanged() {\n this.dispatchEvent(\n new CustomEvent(\"editor-change\", {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: this,\n })\n );\n }", "initEvents() {\n var self = this;\n\n $('#import-nodes-lists').on('click', 'li.import-node', self.nodeClicked.bind(self));\n $('#import-nodes-lists').on('click', '.import-node-remove', self.nodeRemoved.bind(self));\n $('#import-nodes-lists').on('click', '.import-node-edit', self.nodeEdit.bind(self));\n $('#import-nodes-lists').on('submit', '.import-node-form', self.nodeEdited.bind(self));\n $('#import-nodes-lists').on('focusout', '.import-node-form input', self.nodeEdited.bind(self));\n $('#import_send').click(self.submitNodes.bind(self));\n }", "function initListeners() {\n $('#key').on('click', '.key-show-control', function(ev) {\n dispatch.keyShowLine($(this).data('line-id'));\n });\n\n $('#key').on('click', 'a.key-duplicate-control', function(ev) {\n ev.preventDefault();\n dispatch.keyDuplicateLine($(this).data('line-id'));\n });\n\n $('#key').on('click', 'a.key-delete-control', function(ev) {\n ev.preventDefault();\n dispatch.keyDeleteLine($(this).data('line-id'));\n });\n\n $('#key').on('click', 'a.key-edit-control', function(ev) {\n ev.preventDefault();\n dispatch.keyEditLine($(this).data('line-id'));\n });\n }", "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 init() {\n loadDependencies();\n attachEventHandlers();\n}", "function init(e)\n {\n component = $(e);\n component.addClass('mt-container');\n addTextarea();\n addInput();\n addList();\n component.append('<div style=\"clear:both;\"></div>');\n }", "function initModalListeners() {\n // Inits click for the drop message modal.\n $('#drop').click(messageDropListener);\n // Inits click for the view comments modal.\n $('#add').click(addComment);\n}", "_addEventsListeners ()\n {\n this._onChange();\n }", "function setupViewEventHandlers(self) {\n _view.resetButtonEventBus.onEvent(newWordLogic.bind(self));\n _view.alphabetButtonEventBus.onEvent(letterPressedLogic.bind(self));\n }", "_events() {\n \tthis._addKeyHandler();\n \tthis._addClickHandler();\n }", "function init() {\n\t\tinitEvents();\n\t}", "function attachHandlers () {\n // Custom color input field handler\n $('.custom-color').on('keyup change', function(e) {\n var colorHex = e.target.value,\n colorGex = /^([A-Fa-f0-9]{6})$/;\n\n if (colorGex.test(colorHex)) {\n $(this).siblings('.color-preview').css('background-color', ('#' + colorHex));\n clonedColors[$(this).data('target')] = '#' + colorHex;\n reRenderPreview(clonedColors);\n }\n });\n\n // Toggle link to show or hide customization options\n $('#customization-toggle').on('click', function() {\n $('.customization').toggle();\n $(previewContainer).toggle();\n\n var $this = $(this),\n isVisible = $('.customization').is(':visible'),\n statusTextNode = $this.children('.customization-status'),\n customColorField = $('.custom-color'),\n colorPreview = $('.color-preview');\n\n statusTextNode.text(isVisible ? 'Hide' : 'Show');\n\n initialize();\n reRenderPreview(colors);\n });\n\n // Handler on preset color theme click\n $('.theme').on('mousedown', function(e) {\n $('.custom-color').val(e.target.dataset.color.substr(1));\n $('.custom-color').trigger('change');\n });\n }", "function bindEvents() {\n\t\t\teManager.on('showForm', function() {\n\t\t\t\tshowForm();\n\t\t\t});\n\t\t\teManager.on('csvParseError', function() {\n\t\t\t\tshowError();\n\t\t\t});\n\t\t}", "init(){\n this.addEvents(this.keys);\n }", "_listenSpecsEditorEvents() {\n // listen for save\n this.addEventListener('s-specs-editor.ready', (e) => __awaiter(this, void 0, void 0, function* () {\n // store the specs editor reference\n this._$specsEditor = e.target;\n }));\n // listen for save\n this.addEventListener('s-specs-editor.save', (e) => __awaiter(this, void 0, void 0, function* () {\n this._currentNode.save();\n }));\n // listen for actual updated\n this.addEventListener('s-specs-editor.change', (e) => __awaiter(this, void 0, void 0, function* () {\n // apply the component\n this.applyComponent(e.detail.values);\n }));\n // listen for media change in the specs editor\n this.addEventListener('s-specs-editor.changeMedia', (e) => {\n // change the media internaly\n this._activateMedia(e.detail);\n });\n }", "initializeEvents () {\n }", "function init() {\r\n bindEventListeners();\r\n }", "function eventHandlersInit(){\r\n $.logEvent('[dataVisualization.core.eventHandlersInit]');\r\n \r\n var activeModuleObj;\r\n var interactivePluginId;\r\n var inputObj;\r\n \r\n $('#' + dataVisualization.configuration.visualizationWrapperId).on('click', '.module A.reload',function(e){\r\n e.preventDefault();\r\n \r\n activeModuleObj = $(this).parents('.module');\r\n interactivePluginObj = activeModuleObj.find('[data-initialized=\"true\"]');\r\n \r\n // Show the overlay\r\n activeModuleObj\r\n .find('.overlay')\r\n .show();\r\n \r\n // Unload the active component\r\n interactivePluginObj\r\n .removeAttr('style')\r\n .empty();\r\n \r\n // Remove any '.centre-value' DOM elements\r\n $('.centre-value',activeModuleObj).remove();\r\n \r\n // Remove any standalone keys\r\n $('.key',activeModuleObj).remove();\r\n \r\n // Initialize the required functionality for the desired module\r\n dataVisualization.dispatcher.moduleInitialize({\r\n id: interactivePluginObj.attr('id')\r\n })\r\n });\r\n }", "function init() {\r\n contextListener();\r\n clickListener();\r\n keyupListener();\r\n resizeListener();\r\n }", "initNodeEditor() {\n this.container = document.getElementById('d3-node-editor');\n\n this.editor = new D3NE.NodeEditor(\n `${this.name}NodeEditor${this._version}`,\n this.container,\n this.components,\n this.menu,\n );\n\n this.engine = new D3NE.Engine(`${this.name}NodeEditor${this._version}`,\n this.components);\n\n this.engine.onError =\n (msg, obj) => { console.error(`Node Editor Error: ${msg}`, obj); };\n\n this._addEventListener();\n\n this.editor.view.zoomAt(this.editor.nodes);\n this.engine.process(this.editor.toJSON());\n this.editor.view.resize();\n }", "function init() {\n // contextListener();\n clickListener();\n // keyupListener();\n // resizeListener();\n}", "function initInlineEditor() {\n // Make the rendered font style match the field in the page\n // $('#input-editor input').matchTextStyleTo($el); // Removed by Franco on 16-03-2015\n\n // Prevent the enter key from submitting the form...\n $('#input-editor input').handleEnterKey();\n }", "function _onEditorConnect(editor) {\n\t\tconsole.log(\"Editor connected\");\n\n\t\t// Called when a potential old editor was disconnected (i.e. multiple instances of Brackets are not supported)\n\t\tvar next = function () {\n\t\t\t_setupEditor(editor);\n\t\t\t_connectDebugger();\n\t\t};\n\n\t\tif (_editor) {\n\t\t\t// Cleanup\n\t\t\tconsole.log(\"Disconnecting previous editor\");\n\t\t\t_editor.on(\"disconnect\", next);\n\t\t\t_editor.disconnect();\n\t\t} else {\n\t\t\tnext();\n\t\t}\n\t}", "init() {\n this.fieldEvents()\n this.submitButton.addEventListener( 'mouseover', this.getStyles.bind( this ) );\n this.target.addEventListener( 'submit', this.submit.bind( this ) )\n }", "initEvents() {\n this.root.querySelectorAll(this.options.buttonsSelector).forEach(\n button => {\n button.addEventListener(\n 'focus',\n event => this.focusButtonEventHandler(event)\n )\n\n button.addEventListener(\n 'click',\n event => this.clickButtonEventHandler(event)\n )\n\n button.addEventListener(\n 'keydown',\n event => this.keydownButtonEventHandler(event)\n )\n }\n )\n }", "init() {\n this.initDOMListeners();\n }", "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 registerEventHandlers() {\n\n\t\tEventDispatcher.addEventListener( \"LOAD_BUTTON_CLICKED\" , function(){\n\n\t\t\t// Increment number of visible the Articles model unless all are visible\n\t\t\tif( ArticleStore.visibleArticles < ArticleStore.totalArticles ) {\n\n\t\t\t\tArticleStore.visibleArticles++;\n\t\t\t\t\n\t\t\t\trender();\n\n\t\t\t}\n\n\t\t});\n\t}", "function onModuleEditorLoad() {\n\tif (globals.editMode) {\n\t\tsetEditCode(globals.moduleCode);\n\t}\n}", "function updateQuillEditorListeners() {\n _.each(document.querySelectorAll('.slide-edit-lock'), function (el) {\n el.addEventListener('click', enableQuillEditor, false);\n });\n}", "init(){\n this.newsSourceControls.addEventListener('click', this.clickHandler);\n }", "function initListener()/*:void*/ {\n this.previewExists$67CD = true;\n this.setPreviewLoading$67CD();\n var tempResolver/*:HTMLElement*/ = Ext.dom.Helper.createDom({tag: \"a\", href: Ext.getResourcePath(\"previewProtocol.js\", null, \"com.coremedia.ui.sdk__editor-components\")});\n com.coremedia.cms.editor.sdk.messageService.registerMessageListener(this.previewIFrame$67CD.getEl().dom, com.coremedia.cms.editor.sdk.preview.PreviewMessageTypes.READY,AS3.bind( this,\"readyListener$67CD\"));\n this.sendMessage$67CD(com.coremedia.cms.editor.sdk.preview.PreviewMessageTypes.INIT_CONFIRM, {url: tempResolver.href});\n }", "function init() {\n _on(\"mouseenter\", _onMouseEnter);\n _on(\"focus\", _onMouseEnter);\n _on(\"mouseleave\", _onMouseLeave); \n _on(\"blur\", _onMouseLeave);\n }", "function initialize(editArea) {\r\n this.editArea = editArea;\r\n\r\n this.hasMouseDown = false;\r\n this.element = new Element('div', { 'class': 'editor_toolbar' });\r\n\r\n var toolbar = this;\r\n this.element.observe('mousedown', function(event) { toolbar.mouseDown(event); });\r\n this.element.observe('mouseup', function(event) { toolbar.mouseUp(event); });\r\n\r\n this.editArea.insert({before: this.element});\r\n }", "function attachChangeHandlers() {\n\t$('#template-container .parent_li > span').on('click', function(e) {\n\t\tif(templateEdited == false) {\n\t\t\ttemplateEdited = true;\n\t\t}\n\t});\n}", "function init() {\n contextListener();\n clickListener();\n keyupListener();\n resizeListener();\n }", "function initEventHandlers() {\n\t (0, _event.addEventListener)('annotation:add', function (documentId, pageNumber, annotation) {\n\t reorderAnnotationsByType(documentId, pageNumber, annotation.type);\n\t });\n\t (0, _event.addEventListener)('annotation:edit', function (documentId, annotationId, annotation) {\n\t reorderAnnotationsByType(documentId, annotation.page, annotation.type);\n\t });\n\t (0, _event.addEventListener)('annotation:delete', removeAnnotation);\n\t (0, _event.addEventListener)('comment:add', insertComment);\n\t (0, _event.addEventListener)('comment:delete', removeComment);\n\t}", "function initHandler(){\n switch( +($('.fileSourceMethod.active').attr('data-method')) ){\n case 0: initInteractions(); break; // custom gallery\n case 1: $('#fileSetPicker').chosen(); break; // sets\n }\n jscolor.bind();\n }", "initEventHandlers() {\r\n this.ToggleBtn.initHandler(this.Sidebar.changeSidebarView.bind(this.Sidebar));\r\n }", "_init() {\n this.$input = this.$element.find(':input');\n this.$preview = this.$element.find('[data-preview]');\n\n this._updatePreview();\n this._events();\n }", "_initListeners() {\n this._initResizeListener();\n this._initSwipe();\n }", "function init() {\n\t\tlet selector = $('#theme-selector');\n\t\tselector.on(\"change\", selectionChangeHandler);\n\t}", "function registerEventHandlers() {\n pausePlay = document.getElementById(\"pauseplay\")\n pausePlay\n .addEventListener(\"click\", togglePausePlay);\n\n document\n .getElementById(\"stepButton\")\n .addEventListener(\"click\", stepButtonClick);\n\n document\n .getElementById(\"restart\")\n .addEventListener(\"click\", restartSimulation);\n\n $('#hintModal').on('shown', hintClick)\n\n}", "function bindUIactions() {\n $('body').on('click', '.comment__settings-button', showSettings);\n $('body').on('click', '.comment__settings-close', hideSettings);\n $('body').on('click', '.comments__new-link', showCommentForm);\n }", "function assignEventListeners() {\n \tpageElements.output.addEventListener('click', editDelete, false);\n \t pageElements.authorSelect.addEventListener('change', dropDown, false);\n \t pageElements.tagSelect.addEventListener('change', dropDown, false);\n \t pageElements.saveBtn.addEventListener('click', saveAction ,false);\n \t pageElements.addBtn.addEventListener('click', addAction, false);\n \t pageElements.getAllBtn.addEventListener('click', getAll, false);\n \t pageElements.deleteBtn.addEventListener('click', deleteIt, false);\n }", "function initEditorAction($pre) {\r\n $pre.each(function () {\r\n var editorId = $(this).attr('id');\r\n var editor = init_editor(editorId);\r\n var $script_type = $(this).siblings().find(\"input[name='script_type']\");\r\n var $fullScreen = $(this).siblings(\"button[name='fullScreen']\");\r\n ModifyScriptType(editor, $script_type);\r\n fullScreen(editor, $fullScreen);\r\n exitFullscreen(editor);\r\n console.log($(this).attr('id'))\r\n })\r\n}", "function EditorConstructor() { }", "function EditorConstructor() { }", "init() {\n this.initDomListeners()\n }", "function init() {\n\t\t// look for either the Quick Reply text area or the full editor\n\t\tvar id = 'message';\n\t\tif (typeof clickableEditor != 'undefined') {\n\t\t\tid = clickableEditor.textarea;\n\t\t\tfullEditor = true;\n\t\t\ttextAreaPadding = 2;\n\t\t}\n\n\t\t // if neither are present, get out\n\t\tif (!$(id)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// gotta love ie\n\t\tif (MyBB.browser == 'ie') {\n\t\t\tcursorPointer = 'hand';\n\t\t}\n\n\t\t// store our elements\n\t\ttextarea = $(id);\n\t\tcontainer = textarea.up('div');\n\n\t\t// go ahead and build the popup\n\t\tpopup.init();\n\n\t\t// we'll use these closure-wide to deal with the caret and popup positioning\n\t\tpositioner = new maxkir.CursorPosition(textarea, textAreaPadding);\n\t\tselectionRange = new maxkir.SelectionRange(textarea);\n\n\t\t// poll for the @ char\n\t\tEvent.observe(textarea, 'keyup', onKeyUp);\n\n\t\tif (m.autoComplete.debug) {\n\t\t\tm.autoComplete.debug.init();\n\t\t}\n\t}", "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}", "_initEvents () {\n this.el.addEventListener('click', (e) => {\n if (e.target.dataset.action in this.actions) {\n this.actions[e.target.dataset.action](e.target);\n } else this._checkForLi(e.target);\n });\n }", "function ckeInitNormal(editorID) {\n\n\tvar $editor = $('#' + editorID);\n\tvar $parent = $editor.parent();\n\t\n\t\n\tif(typeof ProcessWire.config.InputfieldCKEditor.editors[editorID] != \"undefined\") {\n\t\tvar configName = ProcessWire.config.InputfieldCKEditor.editors[editorID];\n\t} else {\n\t\tvar configName = $editor.attr('data-configName');\n\t}\n\n\tif($parent.hasClass('ui-tabs-panel') && $parent.css('display') == 'none') {\n\t\t// CKEditor in a jQuery UI tab (like langTabs)\n\t\tvar parentID = $editor.parent().attr('id');\n\t\tvar $a = $parent.closest('.ui-tabs, .langTabs').find('a[href=#' + parentID + ']');\n\t\t$a.attr('data-editorID', editorID).attr('data-configName', configName);\n\t\t$parent.closest('.ui-tabs, .langTabs').on('tabsactivate', ckeInitTab);\n\t} else {\n\t\t// visible CKEditor\n\t\tvar editor;\n\t\tif(typeof ProcessWire.config[configName] != \"undefined\") {\n\t\t\tvar editor = CKEDITOR.replace(editorID, ProcessWire.config[configName]);\n\t\t} else if(typeof $editor.attr('data-configdata') != \"undefined\") {\n\t\t\t// allow for alternate option of config data being passed through a data attribute\n\t\t\t// useful for some dynamic/ajax situations\n\t\t\tvar configData = JSON.parse($editor.attr('data-configdata'));\n\t\t\tProcessWire.config[configName] = configData;\n\t\t\tvar editor = CKEDITOR.replace(editorID, configData);\n\t\t}\n\t\tif(editor) {\n\t\t\tckeInitEvents(editor);\n\t\t\t$editor.addClass('InputfieldCKEditorLoaded');\n\t\t}\n\t}\n}" ]
[ "0.80966556", "0.77389115", "0.75494534", "0.72982234", "0.7282955", "0.723292", "0.7122359", "0.71221983", "0.71001315", "0.7071713", "0.7025846", "0.6915193", "0.6894815", "0.68728834", "0.685716", "0.68458426", "0.68189013", "0.6798981", "0.6797055", "0.6743994", "0.6728568", "0.6699391", "0.6694577", "0.6679804", "0.66642517", "0.6642829", "0.6626555", "0.6620197", "0.6616476", "0.66094714", "0.66085047", "0.6585209", "0.6584975", "0.65563107", "0.6495067", "0.6490478", "0.6485302", "0.6461782", "0.6455735", "0.6449615", "0.6433038", "0.6425291", "0.6425291", "0.64210796", "0.6404628", "0.6402667", "0.6399429", "0.6397223", "0.63856715", "0.63856304", "0.6375041", "0.6374974", "0.6372485", "0.6365245", "0.6343047", "0.6332577", "0.6304239", "0.6303008", "0.630097", "0.62746054", "0.6264372", "0.6263904", "0.62622654", "0.62357104", "0.6223818", "0.6213533", "0.6200401", "0.6188187", "0.61755085", "0.6167977", "0.6157849", "0.6156412", "0.6151209", "0.61492896", "0.6134839", "0.61346185", "0.6132086", "0.6122023", "0.61201906", "0.6107147", "0.6093489", "0.6087646", "0.6083864", "0.60714", "0.6068875", "0.6061032", "0.6057608", "0.6050514", "0.6045199", "0.604458", "0.60405076", "0.6039878", "0.603947", "0.60339785", "0.6032332", "0.6032332", "0.6024242", "0.6020637", "0.60131913", "0.6008428", "0.6007962" ]
0.0
-1
Indent the given line. The how parameter can be "smart", "add"/null, "subtract", or "prev". When aggressive is false (typically set to true for forced singleline indents), empty lines are not indented, and places where the mode returns Pass are left alone.
function indentLine(cm, n, how, aggressive) { var doc = cm.doc, state; if (how == null) { how = "add"; } if (how == "smart") { // Fall back to "prev" when the mode doesn't have an indentation // method. if (!doc.mode.indent) { how = "prev"; } else { state = getContextBefore(cm, n).state; } } var tabSize = cm.options.tabSize; var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize); if (line.stateAfter) { line.stateAfter = null; } var curSpaceString = line.text.match(/^\s*/)[0], indentation; if (!aggressive && !/\S/.test(line.text)) { indentation = 0; how = "not"; } else if (how == "smart") { indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text); if (indentation == Pass || indentation > 150) { if (!aggressive) { return } how = "prev"; } } if (how == "prev") { if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); } else { indentation = 0; } } else if (how == "add") { indentation = curSpace + cm.options.indentUnit; } else if (how == "subtract") { indentation = curSpace - cm.options.indentUnit; } else if (typeof how == "number") { indentation = curSpace + how; } indentation = Math.max(0, indentation); var indentString = "", pos = 0; if (cm.options.indentWithTabs) { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} } if (pos < indentation) { indentString += spaceStr(indentation - pos); } if (indentString != curSpaceString) { replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input"); line.stateAfter = null; return true } else { // Ensure that, if the cursor was in the whitespace at the start // of the line, it is moved to the end of that space. for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) { var range = doc.sel.ranges[i$1]; if (range.head.line == n && range.head.ch < curSpaceString.length) { var pos$1 = Pos(n, curSpaceString.length); replaceOneSelection(doc, i$1, new Range(pos$1, pos$1)); break } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function indentLine(cm, n, how, aggressive) {\n\t var doc = cm.doc, state;\n\t if (how == null) how = \"add\";\n\t if (how == \"smart\") {\n\t // Fall back to \"prev\" when the mode doesn't have an indentation\n\t // method.\n\t if (!doc.mode.indent) how = \"prev\";\n\t else state = getStateBefore(cm, n);\n\t }\n\n\t var tabSize = cm.options.tabSize;\n\t var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n\t if (line.stateAfter) line.stateAfter = null;\n\t var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n\t if (!aggressive && !/\\S/.test(line.text)) {\n\t indentation = 0;\n\t how = \"not\";\n\t } else if (how == \"smart\") {\n\t indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n\t if (indentation == Pass || indentation > 150) {\n\t if (!aggressive) return;\n\t how = \"prev\";\n\t }\n\t }\n\t if (how == \"prev\") {\n\t if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);\n\t else indentation = 0;\n\t } else if (how == \"add\") {\n\t indentation = curSpace + cm.options.indentUnit;\n\t } else if (how == \"subtract\") {\n\t indentation = curSpace - cm.options.indentUnit;\n\t } else if (typeof how == \"number\") {\n\t indentation = curSpace + how;\n\t }\n\t indentation = Math.max(0, indentation);\n\n\t var indentString = \"\", pos = 0;\n\t if (cm.options.indentWithTabs)\n\t for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n\t if (pos < indentation) indentString += spaceStr(indentation - pos);\n\n\t if (indentString != curSpaceString) {\n\t replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n\t line.stateAfter = null;\n\t return true;\n\t } else {\n\t // Ensure that, if the cursor was in the whitespace at the start\n\t // of the line, it is moved to the end of that space.\n\t for (var i = 0; i < doc.sel.ranges.length; i++) {\n\t var range = doc.sel.ranges[i];\n\t if (range.head.line == n && range.head.ch < curSpaceString.length) {\n\t var pos = Pos(n, curSpaceString.length);\n\t replaceOneSelection(doc, i, new Range(pos, pos));\n\t break;\n\t }\n\t }\n\t }\n\t }", "function indentLine(cm, n, how, aggressive) {\n\t var doc = cm.doc, state;\n\t if (how == null) how = \"add\";\n\t if (how == \"smart\") {\n\t // Fall back to \"prev\" when the mode doesn't have an indentation\n\t // method.\n\t if (!doc.mode.indent) how = \"prev\";\n\t else state = getStateBefore(cm, n);\n\t }\n\n\t var tabSize = cm.options.tabSize;\n\t var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n\t if (line.stateAfter) line.stateAfter = null;\n\t var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n\t if (!aggressive && !/\\S/.test(line.text)) {\n\t indentation = 0;\n\t how = \"not\";\n\t } else if (how == \"smart\") {\n\t indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n\t if (indentation == Pass || indentation > 150) {\n\t if (!aggressive) return;\n\t how = \"prev\";\n\t }\n\t }\n\t if (how == \"prev\") {\n\t if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);\n\t else indentation = 0;\n\t } else if (how == \"add\") {\n\t indentation = curSpace + cm.options.indentUnit;\n\t } else if (how == \"subtract\") {\n\t indentation = curSpace - cm.options.indentUnit;\n\t } else if (typeof how == \"number\") {\n\t indentation = curSpace + how;\n\t }\n\t indentation = Math.max(0, indentation);\n\n\t var indentString = \"\", pos = 0;\n\t if (cm.options.indentWithTabs)\n\t for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n\t if (pos < indentation) indentString += spaceStr(indentation - pos);\n\n\t if (indentString != curSpaceString) {\n\t replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n\t line.stateAfter = null;\n\t return true;\n\t } else {\n\t // Ensure that, if the cursor was in the whitespace at the start\n\t // of the line, it is moved to the end of that space.\n\t for (var i = 0; i < doc.sel.ranges.length; i++) {\n\t var range = doc.sel.ranges[i];\n\t if (range.head.line == n && range.head.ch < curSpaceString.length) {\n\t var pos = Pos(n, curSpaceString.length);\n\t replaceOneSelection(doc, i, new Range(pos, pos));\n\t break;\n\t }\n\t }\n\t }\n\t }", "function indentLine(cm, n, how, aggressive) {\n\t var doc = cm.doc, state;\n\t if (how == null) how = \"add\";\n\t if (how == \"smart\") {\n\t // Fall back to \"prev\" when the mode doesn't have an indentation\n\t // method.\n\t if (!doc.mode.indent) how = \"prev\";\n\t else state = getStateBefore(cm, n);\n\t }\n\t\n\t var tabSize = cm.options.tabSize;\n\t var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n\t if (line.stateAfter) line.stateAfter = null;\n\t var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n\t if (!aggressive && !/\\S/.test(line.text)) {\n\t indentation = 0;\n\t how = \"not\";\n\t } else if (how == \"smart\") {\n\t indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n\t if (indentation == Pass || indentation > 150) {\n\t if (!aggressive) return;\n\t how = \"prev\";\n\t }\n\t }\n\t if (how == \"prev\") {\n\t if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);\n\t else indentation = 0;\n\t } else if (how == \"add\") {\n\t indentation = curSpace + cm.options.indentUnit;\n\t } else if (how == \"subtract\") {\n\t indentation = curSpace - cm.options.indentUnit;\n\t } else if (typeof how == \"number\") {\n\t indentation = curSpace + how;\n\t }\n\t indentation = Math.max(0, indentation);\n\t\n\t var indentString = \"\", pos = 0;\n\t if (cm.options.indentWithTabs)\n\t for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n\t if (pos < indentation) indentString += spaceStr(indentation - pos);\n\t\n\t if (indentString != curSpaceString) {\n\t replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n\t line.stateAfter = null;\n\t return true;\n\t } else {\n\t // Ensure that, if the cursor was in the whitespace at the start\n\t // of the line, it is moved to the end of that space.\n\t for (var i = 0; i < doc.sel.ranges.length; i++) {\n\t var range = doc.sel.ranges[i];\n\t if (range.head.line == n && range.head.ch < curSpaceString.length) {\n\t var pos = Pos(n, curSpaceString.length);\n\t replaceOneSelection(doc, i, new Range(pos, pos));\n\t break;\n\t }\n\t }\n\t }\n\t }", "function indentLine(cm, n, how, aggressive) {\n\t\t var doc = cm.doc, state;\n\t\t if (how == null) { how = \"add\"; }\n\t\t if (how == \"smart\") {\n\t\t // Fall back to \"prev\" when the mode doesn't have an indentation\n\t\t // method.\n\t\t if (!doc.mode.indent) { how = \"prev\"; }\n\t\t else { state = getContextBefore(cm, n).state; }\n\t\t }\n\n\t\t var tabSize = cm.options.tabSize;\n\t\t var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n\t\t if (line.stateAfter) { line.stateAfter = null; }\n\t\t var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n\t\t if (!aggressive && !/\\S/.test(line.text)) {\n\t\t indentation = 0;\n\t\t how = \"not\";\n\t\t } else if (how == \"smart\") {\n\t\t indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n\t\t if (indentation == Pass || indentation > 150) {\n\t\t if (!aggressive) { return }\n\t\t how = \"prev\";\n\t\t }\n\t\t }\n\t\t if (how == \"prev\") {\n\t\t if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n\t\t else { indentation = 0; }\n\t\t } else if (how == \"add\") {\n\t\t indentation = curSpace + cm.options.indentUnit;\n\t\t } else if (how == \"subtract\") {\n\t\t indentation = curSpace - cm.options.indentUnit;\n\t\t } else if (typeof how == \"number\") {\n\t\t indentation = curSpace + how;\n\t\t }\n\t\t indentation = Math.max(0, indentation);\n\n\t\t var indentString = \"\", pos = 0;\n\t\t if (cm.options.indentWithTabs)\n\t\t { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n\t\t if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n\t\t if (indentString != curSpaceString) {\n\t\t replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n\t\t line.stateAfter = null;\n\t\t return true\n\t\t } else {\n\t\t // Ensure that, if the cursor was in the whitespace at the start\n\t\t // of the line, it is moved to the end of that space.\n\t\t for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n\t\t var range = doc.sel.ranges[i$1];\n\t\t if (range.head.line == n && range.head.ch < curSpaceString.length) {\n\t\t var pos$1 = Pos(n, curSpaceString.length);\n\t\t replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n\t\t break\n\t\t }\n\t\t }\n\t\t }\n\t\t }", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc,\n state;\n\n if (how == null) {\n how = \"add\";\n }\n\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) {\n how = \"prev\";\n } else {\n state = getContextBefore(cm, n).state;\n }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n),\n curSpace = countColumn(line.text, null, tabSize);\n\n if (line.stateAfter) {\n line.stateAfter = null;\n }\n\n var curSpaceString = line.text.match(/^\\s*/)[0],\n indentation;\n\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) {\n return;\n }\n\n how = \"prev\";\n }\n }\n\n if (how == \"prev\") {\n if (n > doc.first) {\n indentation = countColumn(getLine(doc, n - 1).text, null, tabSize);\n } else {\n indentation = 0;\n }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n\n indentation = Math.max(0, indentation);\n var indentString = \"\",\n pos = 0;\n\n if (cm.options.indentWithTabs) {\n for (var i = Math.floor(indentation / tabSize); i; --i) {\n pos += tabSize;\n indentString += \"\\t\";\n }\n }\n\n if (pos < indentation) {\n indentString += spaceStr(indentation - pos);\n }\n\n if (indentString != curSpaceString) {\n _replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n\n line.stateAfter = null;\n return true;\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break;\n }\n }\n }\n } // This will be set to a {lineWise: bool, text: [string]} object, so", "function indentLine(cm, n, how, aggressive) {\n\t\t var doc = cm.doc, state;\n\t\t if (how == null) how = \"add\";\n\t\t if (how == \"smart\") {\n\t\t // Fall back to \"prev\" when the mode doesn't have an indentation\n\t\t // method.\n\t\t if (!doc.mode.indent) how = \"prev\";\n\t\t else state = getStateBefore(cm, n);\n\t\t }\n\t\t\n\t\t var tabSize = cm.options.tabSize;\n\t\t var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n\t\t if (line.stateAfter) line.stateAfter = null;\n\t\t var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n\t\t if (!aggressive && !/\\S/.test(line.text)) {\n\t\t indentation = 0;\n\t\t how = \"not\";\n\t\t } else if (how == \"smart\") {\n\t\t indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n\t\t if (indentation == Pass || indentation > 150) {\n\t\t if (!aggressive) return;\n\t\t how = \"prev\";\n\t\t }\n\t\t }\n\t\t if (how == \"prev\") {\n\t\t if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);\n\t\t else indentation = 0;\n\t\t } else if (how == \"add\") {\n\t\t indentation = curSpace + cm.options.indentUnit;\n\t\t } else if (how == \"subtract\") {\n\t\t indentation = curSpace - cm.options.indentUnit;\n\t\t } else if (typeof how == \"number\") {\n\t\t indentation = curSpace + how;\n\t\t }\n\t\t indentation = Math.max(0, indentation);\n\t\t\n\t\t var indentString = \"\", pos = 0;\n\t\t if (cm.options.indentWithTabs)\n\t\t for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n\t\t if (pos < indentation) indentString += spaceStr(indentation - pos);\n\t\t\n\t\t if (indentString != curSpaceString) {\n\t\t replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n\t\t line.stateAfter = null;\n\t\t return true;\n\t\t } else {\n\t\t // Ensure that, if the cursor was in the whitespace at the start\n\t\t // of the line, it is moved to the end of that space.\n\t\t for (var i = 0; i < doc.sel.ranges.length; i++) {\n\t\t var range = doc.sel.ranges[i];\n\t\t if (range.head.line == n && range.head.ch < curSpaceString.length) {\n\t\t var pos = Pos(n, curSpaceString.length);\n\t\t replaceOneSelection(doc, i, new Range(pos, pos));\n\t\t break;\n\t\t }\n\t\t }\n\t\t }\n\t\t }", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) how = \"add\";\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) how = \"prev\";\n else state = getStateBefore(cm, n);\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) line.stateAfter = null;\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) return;\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);\n else indentation = 0;\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n if (pos < indentation) indentString += spaceStr(indentation - pos);\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true;\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i, new Range(pos, pos));\n break;\n }\n }\n }\n }", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) how = \"add\";\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) how = \"prev\";\n else state = getStateBefore(cm, n);\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) line.stateAfter = null;\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) return;\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);\n else indentation = 0;\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n if (pos < indentation) indentString += spaceStr(indentation - pos);\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true;\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i, new Range(pos, pos));\n break;\n }\n }\n }\n }", "function indentLine(cm, n, how, aggressive) {\r\n var doc = cm.doc, state;\r\n if (how == null) how = \"add\";\r\n if (how == \"smart\") {\r\n // Fall back to \"prev\" when the mode doesn't have an indentation\r\n // method.\r\n if (!doc.mode.indent) how = \"prev\";\r\n else state = getStateBefore(cm, n);\r\n }\r\n\r\n var tabSize = cm.options.tabSize;\r\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\r\n if (line.stateAfter) line.stateAfter = null;\r\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\r\n if (!aggressive && !/\\S/.test(line.text)) {\r\n indentation = 0;\r\n how = \"not\";\r\n } else if (how == \"smart\") {\r\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\r\n if (indentation == Pass || indentation > 150) {\r\n if (!aggressive) return;\r\n how = \"prev\";\r\n }\r\n }\r\n if (how == \"prev\") {\r\n if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);\r\n else indentation = 0;\r\n } else if (how == \"add\") {\r\n indentation = curSpace + cm.options.indentUnit;\r\n } else if (how == \"subtract\") {\r\n indentation = curSpace - cm.options.indentUnit;\r\n } else if (typeof how == \"number\") {\r\n indentation = curSpace + how;\r\n }\r\n indentation = Math.max(0, indentation);\r\n\r\n var indentString = \"\", pos = 0;\r\n if (cm.options.indentWithTabs)\r\n for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\r\n if (pos < indentation) indentString += spaceStr(indentation - pos);\r\n\r\n if (indentString != curSpaceString) {\r\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\r\n } else {\r\n // Ensure that, if the cursor was in the whitespace at the start\r\n // of the line, it is moved to the end of that space.\r\n for (var i = 0; i < doc.sel.ranges.length; i++) {\r\n var range = doc.sel.ranges[i];\r\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\r\n var pos = Pos(n, curSpaceString.length);\r\n replaceOneSelection(doc, i, new Range(pos, pos));\r\n break;\r\n }\r\n }\r\n }\r\n line.stateAfter = null;\r\n }", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) how = \"add\";\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) how = \"prev\";\n else state = getStateBefore(cm, n);\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) line.stateAfter = null;\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) return;\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);\n else indentation = 0;\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n if (pos < indentation) indentString += spaceStr(indentation - pos);\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i, new Range(pos, pos));\n break;\n }\n }\n }\n line.stateAfter = null;\n }", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) how = \"add\";\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) how = \"prev\";\n else state = getStateBefore(cm, n);\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) line.stateAfter = null;\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) return;\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);\n else indentation = 0;\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n if (pos < indentation) indentString += spaceStr(indentation - pos);\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i, new Range(pos, pos));\n break;\n }\n }\n }\n line.stateAfter = null;\n }", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) how = \"add\";\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) how = \"prev\";\n else state = getStateBefore(cm, n);\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) line.stateAfter = null;\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) return;\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);\n else indentation = 0;\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n if (pos < indentation) indentString += spaceStr(indentation - pos);\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i, new Range(pos, pos));\n break;\n }\n }\n }\n line.stateAfter = null;\n }", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) how = \"add\";\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) how = \"prev\";\n else state = getStateBefore(cm, n);\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) line.stateAfter = null;\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) return;\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);\n else indentation = 0;\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n if (pos < indentation) indentString += spaceStr(indentation - pos);\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i, new Range(pos, pos));\n break;\n }\n }\n }\n line.stateAfter = null;\n }", "function indentLine(cm, n, how, aggressive) {\r\n var doc = cm.doc, state;\r\n if (how == null) { how = \"add\"; }\r\n if (how == \"smart\") {\r\n // Fall back to \"prev\" when the mode doesn't have an indentation\r\n // method.\r\n if (!doc.mode.indent) { how = \"prev\"; }\r\n else { state = getContextBefore(cm, n).state; }\r\n }\r\n\r\n var tabSize = cm.options.tabSize;\r\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\r\n if (line.stateAfter) { line.stateAfter = null; }\r\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\r\n if (!aggressive && !/\\S/.test(line.text)) {\r\n indentation = 0;\r\n how = \"not\";\r\n } else if (how == \"smart\") {\r\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\r\n if (indentation == Pass || indentation > 150) {\r\n if (!aggressive) { return }\r\n how = \"prev\";\r\n }\r\n }\r\n if (how == \"prev\") {\r\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\r\n else { indentation = 0; }\r\n } else if (how == \"add\") {\r\n indentation = curSpace + cm.options.indentUnit;\r\n } else if (how == \"subtract\") {\r\n indentation = curSpace - cm.options.indentUnit;\r\n } else if (typeof how == \"number\") {\r\n indentation = curSpace + how;\r\n }\r\n indentation = Math.max(0, indentation);\r\n\r\n var indentString = \"\", pos = 0;\r\n if (cm.options.indentWithTabs)\r\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\r\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\r\n\r\n if (indentString != curSpaceString) {\r\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\r\n line.stateAfter = null;\r\n return true\r\n } else {\r\n // Ensure that, if the cursor was in the whitespace at the start\r\n // of the line, it is moved to the end of that space.\r\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\r\n var range = doc.sel.ranges[i$1];\r\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\r\n var pos$1 = Pos(n, curSpaceString.length);\r\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\r\n break\r\n }\r\n }\r\n }\r\n}", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) how = \"add\";\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!cm.doc.mode.indent) how = \"prev\";\n else state = getStateBefore(cm, n);\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) line.stateAfter = null;\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = cm.doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass) {\n if (!aggressive) return;\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);\n else indentation = 0;\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n if (pos < indentation) indentString += spaceStr(indentation - pos);\n\n if (indentString != curSpaceString) {\n replaceRange(cm.doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i, new Range(pos, pos));\n break;\n }\n }\n }\n line.stateAfter = null;\n }", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n}", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n}", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n}", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n}", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n}", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n}", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n}", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n}", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n}", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n}", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n}", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state\n if (how == null) { how = \"add\" }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\" }\n else { state = getStateBefore(cm, n) }\n }\n\n var tabSize = cm.options.tabSize\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize)\n if (line.stateAfter) { line.stateAfter = null }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0\n how = \"not\"\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text)\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\"\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize) }\n else { indentation = 0 }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit\n } else if (typeof how == \"number\") {\n indentation = curSpace + how\n }\n indentation = Math.max(0, indentation)\n\n var indentString = \"\", pos = 0\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\"} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos) }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\")\n line.stateAfter = null\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1]\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length)\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1))\n break\n }\n }\n }\n}", "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state\n if (how == null) { how = \"add\" }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\" }\n else { state = getStateBefore(cm, n) }\n }\n\n var tabSize = cm.options.tabSize\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize)\n if (line.stateAfter) { line.stateAfter = null }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0\n how = \"not\"\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text)\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\"\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize) }\n else { indentation = 0 }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit\n } else if (typeof how == \"number\") {\n indentation = curSpace + how\n }\n indentation = Math.max(0, indentation)\n\n var indentString = \"\", pos = 0\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\"} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos) }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\")\n line.stateAfter = null\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1]\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length)\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1))\n break\n }\n }\n }\n}", "getInheritIndentForLine(autoIndent, model, lineNumber, honorIntentialIndent = true) {\r\n if (autoIndent < 4 /* Full */) {\r\n return null;\r\n }\r\n const indentRulesSupport = this.getIndentRulesSupport(model.getLanguageIdentifier().id);\r\n if (!indentRulesSupport) {\r\n return null;\r\n }\r\n if (lineNumber <= 1) {\r\n return {\r\n indentation: '',\r\n action: null\r\n };\r\n }\r\n const precedingUnIgnoredLine = this.getPrecedingValidLine(model, lineNumber, indentRulesSupport);\r\n if (precedingUnIgnoredLine < 0) {\r\n return null;\r\n }\r\n else if (precedingUnIgnoredLine < 1) {\r\n return {\r\n indentation: '',\r\n action: null\r\n };\r\n }\r\n const precedingUnIgnoredLineContent = model.getLineContent(precedingUnIgnoredLine);\r\n if (indentRulesSupport.shouldIncrease(precedingUnIgnoredLineContent) || indentRulesSupport.shouldIndentNextLine(precedingUnIgnoredLineContent)) {\r\n return {\r\n indentation: strings.getLeadingWhitespace(precedingUnIgnoredLineContent),\r\n action: IndentAction.Indent,\r\n line: precedingUnIgnoredLine\r\n };\r\n }\r\n else if (indentRulesSupport.shouldDecrease(precedingUnIgnoredLineContent)) {\r\n return {\r\n indentation: strings.getLeadingWhitespace(precedingUnIgnoredLineContent),\r\n action: null,\r\n line: precedingUnIgnoredLine\r\n };\r\n }\r\n else {\r\n // precedingUnIgnoredLine can not be ignored.\r\n // it doesn't increase indent of following lines\r\n // it doesn't increase just next line\r\n // so current line is not affect by precedingUnIgnoredLine\r\n // and then we should get a correct inheritted indentation from above lines\r\n if (precedingUnIgnoredLine === 1) {\r\n return {\r\n indentation: strings.getLeadingWhitespace(model.getLineContent(precedingUnIgnoredLine)),\r\n action: null,\r\n line: precedingUnIgnoredLine\r\n };\r\n }\r\n const previousLine = precedingUnIgnoredLine - 1;\r\n const previousLineIndentMetadata = indentRulesSupport.getIndentMetadata(model.getLineContent(previousLine));\r\n if (!(previousLineIndentMetadata & (1 /* INCREASE_MASK */ | 2 /* DECREASE_MASK */)) &&\r\n (previousLineIndentMetadata & 4 /* INDENT_NEXTLINE_MASK */)) {\r\n let stopLine = 0;\r\n for (let i = previousLine - 1; i > 0; i--) {\r\n if (indentRulesSupport.shouldIndentNextLine(model.getLineContent(i))) {\r\n continue;\r\n }\r\n stopLine = i;\r\n break;\r\n }\r\n return {\r\n indentation: strings.getLeadingWhitespace(model.getLineContent(stopLine + 1)),\r\n action: null,\r\n line: stopLine + 1\r\n };\r\n }\r\n if (honorIntentialIndent) {\r\n return {\r\n indentation: strings.getLeadingWhitespace(model.getLineContent(precedingUnIgnoredLine)),\r\n action: null,\r\n line: precedingUnIgnoredLine\r\n };\r\n }\r\n else {\r\n // search from precedingUnIgnoredLine until we find one whose indent is not temporary\r\n for (let i = precedingUnIgnoredLine; i > 0; i--) {\r\n const lineContent = model.getLineContent(i);\r\n if (indentRulesSupport.shouldIncrease(lineContent)) {\r\n return {\r\n indentation: strings.getLeadingWhitespace(lineContent),\r\n action: IndentAction.Indent,\r\n line: i\r\n };\r\n }\r\n else if (indentRulesSupport.shouldIndentNextLine(lineContent)) {\r\n let stopLine = 0;\r\n for (let j = i - 1; j > 0; j--) {\r\n if (indentRulesSupport.shouldIndentNextLine(model.getLineContent(i))) {\r\n continue;\r\n }\r\n stopLine = j;\r\n break;\r\n }\r\n return {\r\n indentation: strings.getLeadingWhitespace(model.getLineContent(stopLine + 1)),\r\n action: null,\r\n line: stopLine + 1\r\n };\r\n }\r\n else if (indentRulesSupport.shouldDecrease(lineContent)) {\r\n return {\r\n indentation: strings.getLeadingWhitespace(lineContent),\r\n action: null,\r\n line: i\r\n };\r\n }\r\n }\r\n return {\r\n indentation: strings.getLeadingWhitespace(model.getLineContent(1)),\r\n action: null,\r\n line: 1\r\n };\r\n }\r\n }\r\n }", "async _indentToLine() {\n const editor = vscode.window.activeTextEditor;\n\n if (editor && editor.selection.active.line) {\n const pos = editor.selection.active;\n\n await this._addUnderscore(editor.document, pos, '');\n\n // Update current line and preceeding lines\n const {lines, firstRow} = MagikUtils.indentRegion();\n if (lines) {\n await this._indentMagikLines(lines, firstRow, pos.line, true);\n }\n }\n }", "function indentLevel(linea) {\n var level = 0;\n for ( i in linea ) {\n if ( linea[i] != ' ' ) { break;}\n level += 1;\n }\n return (level);\n}", "function getIndent (line) {\n return line.match(/^\\s*/)[0].length\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 }", "autoIndentNewLine (start, end) {\n for (var i = start, scopeDiff = 0; i > 0; i--) {\n let char = this.text[i - 1];\n if (char === '\\n') {\n break;\n } else if (scopeDiff === 0) {\n if (char === \"}\") {\n scopeDiff = -1;\n } if (char === \"{\") {\n scopeDiff = 1;\n }\n }\n }\n\n let result = initialWhiteSpace.exec(this.text.substring(i, start));\n let indentation = result ? result[0] : \"\";\n \n if (scopeDiff === 1) {\n initialCloseParen.lastIndex = end;\n let suffix = initialCloseParen.exec(this.text) ? \"\\n\" + indentation : \"\";\n this.replaceText(start, end, \"\\n\\t\" + indentation + suffix, -suffix.length);\n } else {\n this.replaceText(start, end, \"\\n\" + indentation);\n }\n }", "function reindentCodeBlock(action, indent_level) {\n var width = 0;\n var lines = action\n .trim()\n .split('\\n')\n // measure the indent:\n .map(function checkIndentation(line, idx) {\n if (idx === 1) {\n // first line didn't matter: reset width to help us find the block indent level:\n width = Infinity;\n }\n if (line.trim() === '') return '';\n\n // take out any TABs: turn them into spaces (4 per TAB)\n line = line\n .replace(/^[ \\t]+/, function expandTabs(s) {\n return s.replace(/\\t/g, ' ');\n });\n\n var m = /^[ ]+/.exec(line);\n if (m) {\n width = Math.min(m[0].length, width);\n }\n\n return line;\n })\n // remove/adjust the indent:\n .map(function checkIndentation(line, idx) {\n line = line\n .replace(/^[ ]*/, function adjustIndent(s) {\n var l = Math.max(s.length - width, 0) + indent_level;\n var shift = (new Array(l + 1)).join(' ');\n return shift;\n });\n return line;\n });\n\n return lines.join('\\n');\n}", "function oneline(line, options) {\n var key = \"Allow: \",\n index = line.indexOf(key);\n\n if (index !== -1) {\n var page = line.substr(index + key.length).replace(/^\\s+|\\s+$/g, \"\");\n return base.input(options, page);\n }\n\n return true;\n}", "beautify() {\n if(atom.packages.isPackageActive('atom-beautify')) {\n setTimeout(() => {\n atom.commands.dispatch(atom.views.getView(this._editor), \"atom-beautify:beautify-editor\");\n });\n } else {\n atom.commands.dispatch(atom.views.getView(this._editor), \"editor:auto-indent\");\n }\n }", "function reindentCodeBlock(action, indent_level) {\n var width = 0;\n var lines = action.trim().split('\\n')\n // measure the indent:\n .map(function checkIndentation(line, idx) {\n if (idx === 1) {\n // first line didn't matter: reset width to help us find the block indent level:\n width = Infinity;\n }\n if (line.trim() === '') return '';\n\n // take out any TABs: turn them into spaces (4 per TAB)\n line = line.replace(/^[ \\t]+/, function expandTabs(s) {\n return s.replace(/\\t/g, ' ');\n });\n\n var m = /^[ ]+/.exec(line);\n if (m) {\n width = Math.min(m[0].length, width);\n }\n\n return line;\n })\n // remove/adjust the indent:\n .map(function checkIndentation(line, idx) {\n line = line.replace(/^[ ]*/, function adjustIndent(s) {\n var l = Math.max(s.length - width, 0) + indent_level;\n var shift = new Array(l + 1).join(' ');\n return shift;\n });\n return line;\n });\n\n return lines.join('\\n');\n}", "function indentOneSpace() {\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; });\n }", "function renderIndentation(inputObject, inputLine) {\n\n var leadingIndentTag = \"<a class=\\\"mIndentation\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" title=\\\"Line Level\\\">\";\n var trailingTag = \"</a>\";\n var tmpIndentation = \"\";\n\n if (inputObject.lineIndentationArray) {\n if (inputObject.lineIndentationArray.length > 0) {\n for (var i in inputObject.lineIndentationArray) {\n tmpIndentation = tmpIndentation + leadingIndentTag + \".\" + trailingTag + inputObject.lineIndentationArray[i];\n }\n inputLine = inputLine + tmpIndentation;\n }\n }\n return inputLine;\n}", "lineIndent(pos, bias = 1) {\n let { text, from } = this.lineAt(pos, bias);\n let override = this.options.overrideIndentation;\n if (override) {\n let overriden = override(from);\n if (overriden > -1)\n return overriden;\n }\n return this.countColumn(text, text.search(/\\S|$/));\n }", "increaseIndent() {\n if (this.owner.editor) {\n this.owner.editor.increaseIndent();\n }\n }", "function intakeSpace(ov){\n\tvar iRes, maxsp=0, ops = \"\";\n\tov = ov.trim().split(\"\\n\").map((il)=>{\n\t\tiRes = intakeLineToObject(il);\n\t\tif(iRes){\n\t\t\tif(iRes.tl > maxsp){\n\t\t\t\tmaxsp = iRes.tl;\n\t\t\t}\n\t\t\treturn iRes;\n\t\t} else {\n\t\t\treturn il;\n\t\t}\n\t});\n\tov.map((il)=>{\n\t\tif(typeof il == \"object\"){\n\t\t\tops += \til.ind + \" \" +\n\t\t\t\t\til.alg + \" \".repeat(maxsp - il.tl + 1) + \n\t\t\t\t\til.sub + \": \" +\n\t\t\t\t\til.qty + \"\\n\";\n\t\t} else if(il.length > 1){\n\t\t\t//offsets 5 characters to the left. Right justified.\n\t\t\tops += \" \".repeat(maxsp + 5 - il.length) + il + \"\\n\";\n\t\t} else {\n\t\t\tops += il + \"\\n\";\n\t\t}\n\t});\n\treturn ops;\n}", "set firstLineIndent(value) {\n if (value === this.firstLineIndentIn) {\n return;\n }\n this.firstLineIndentIn = value;\n this.notifyPropertyChanged('firstLineIndent');\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 appendLine (line) {\n\tline.ishidden = false;\n\tswitch (line.exclude) {\n\t\tcase 'rule':\n\t\t\tappendProblemLineExcludingRule(line);\n\t\t\tbreak;\n\t\tcase 'premises':\n\t\t\tappendProblemLineExcludingPremise(line);\n\t\t\tbreak;\n\t\tcase 'both':\n\t\t\tappendProblemLineExcludingBoth(line);\n\t\t\tbreak;\n\t\tcase 'allbutderived':\n\t\t\tappendProblemLineExcludingBoth(line);\n\t\t\tbreak;\n\t}\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],\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 }", "editorEnter (cm) {\n const cur = cm.getCursor()\n\n const { lineString, lineTokens } = this._getTokenLine(cm, cur)\n const [, indent, firstArrayItem] = lineString.match(/^(\\s*)(-\\s)?(.*?)?$/) || []\n let extraIntent = ''\n if (firstArrayItem) {\n extraIntent = `${repeat(' ', this.arrayBulletIndent)}`\n } else if (this._isTokenLineStartingObject(lineTokens)) {\n extraIntent = `${repeat(' ', this.indentUnit)}`\n }\n cm.replaceSelection(`\\n${indent}${extraIntent}`)\n }", "function incrementsIndent(token) {\n return token.type.label == \"{\"\n || token.isArrayLiteral\n || token.type.keyword == \"switch\";\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) {\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) {\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, 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 }", "isNextLineIndented(ignoreComments = true) {\n var EOF, currentIndentation, ret;\n currentIndentation = this.getCurrentLineIndentation();\n EOF = !this.moveToNextLine();\n if (ignoreComments) {\n while (!EOF && this.isCurrentLineEmpty()) {\n EOF = !this.moveToNextLine();\n }\n } else {\n while (!EOF && this.isCurrentLineBlank()) {\n EOF = !this.moveToNextLine();\n }\n }\n if (EOF) {\n return false;\n }\n ret = false;\n if (this.getCurrentLineIndentation() > currentIndentation) {\n ret = true;\n }\n this.moveToPreviousLine();\n return ret;\n }", "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 betterTab(cm) {\n if (cm.somethingSelected()) {\n cm.indentSelection(\"add\");\n } else {\n cm.replaceSelection(cm.getOption(\"indentWithTabs\")? \"\\t\":\n Array(cm.getOption(\"indentUnit\") + 1).join(\" \"), \"end\", \"+input\");\n }\n}", "lineToken({chunk = this.chunk, offset = 0} = {}) {\r\n\t\t\t\tvar backslash, diff, endsContinuationLineIndentation, indent, match, minLiteralLength, newIndentLiteral, noNewlines, prev, ref, size;\r\n\t\t\t\tif (!(match = MULTI_DENT.exec(chunk))) {\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t\tindent = match[0];\r\n\t\t\t\tprev = this.prev();\r\n\t\t\t\tbackslash = (prev != null ? prev[0] : void 0) === '\\\\';\r\n\t\t\t\tif (!((backslash || ((ref = this.seenFor) != null ? ref.endsLength : void 0) < this.ends.length) && this.seenFor)) {\r\n\t\t\t\t\tthis.seenFor = false;\r\n\t\t\t\t}\r\n\t\t\t\tif (!((backslash && this.seenImport) || this.importSpecifierList)) {\r\n\t\t\t\t\tthis.seenImport = false;\r\n\t\t\t\t}\r\n\t\t\t\tif (!((backslash && this.seenExport) || this.exportSpecifierList)) {\r\n\t\t\t\t\tthis.seenExport = false;\r\n\t\t\t\t}\r\n\t\t\t\tsize = indent.length - 1 - indent.lastIndexOf('\\n');\r\n\t\t\t\tnoNewlines = this.unfinished();\r\n\t\t\t\tnewIndentLiteral = size > 0 ? indent.slice(-size) : '';\r\n\t\t\t\tif (!/^(.?)\\1*$/.exec(newIndentLiteral)) {\r\n\t\t\t\t\tthis.error('mixed indentation', {\r\n\t\t\t\t\t\toffset: indent.length\r\n\t\t\t\t\t});\r\n\t\t\t\t\treturn indent.length;\r\n\t\t\t\t}\r\n\t\t\t\tminLiteralLength = Math.min(newIndentLiteral.length, this.indentLiteral.length);\r\n\t\t\t\tif (newIndentLiteral.slice(0, minLiteralLength) !== this.indentLiteral.slice(0, minLiteralLength)) {\r\n\t\t\t\t\tthis.error('indentation mismatch', {\r\n\t\t\t\t\t\toffset: indent.length\r\n\t\t\t\t\t});\r\n\t\t\t\t\treturn indent.length;\r\n\t\t\t\t}\r\n\t\t\t\tif (size - this.continuationLineAdditionalIndent === this.indent) {\r\n\t\t\t\t\tif (noNewlines) {\r\n\t\t\t\t\t\tthis.suppressNewlines();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.newlineToken(offset);\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn indent.length;\r\n\t\t\t\t}\r\n\t\t\t\tif (size > this.indent) {\r\n\t\t\t\t\tif (noNewlines) {\r\n\t\t\t\t\t\tif (!backslash) {\r\n\t\t\t\t\t\t\tthis.continuationLineAdditionalIndent = size - this.indent;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (this.continuationLineAdditionalIndent) {\r\n\t\t\t\t\t\t\tprev.continuationLineIndent = this.indent + this.continuationLineAdditionalIndent;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.suppressNewlines();\r\n\t\t\t\t\t\treturn indent.length;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!this.tokens.length) {\r\n\t\t\t\t\t\tthis.baseIndent = this.indent = size;\r\n\t\t\t\t\t\tthis.indentLiteral = newIndentLiteral;\r\n\t\t\t\t\t\treturn indent.length;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdiff = size - this.indent + this.outdebt;\r\n\t\t\t\t\tthis.token('INDENT', diff, {\r\n\t\t\t\t\t\toffset: offset + indent.length - size,\r\n\t\t\t\t\t\tlength: size\r\n\t\t\t\t\t});\r\n\t\t\t\t\tthis.indents.push(diff);\r\n\t\t\t\t\tthis.ends.push({\r\n\t\t\t\t\t\ttag: 'OUTDENT'\r\n\t\t\t\t\t});\r\n\t\t\t\t\tthis.outdebt = this.continuationLineAdditionalIndent = 0;\r\n\t\t\t\t\tthis.indent = size;\r\n\t\t\t\t\tthis.indentLiteral = newIndentLiteral;\r\n\t\t\t\t} else if (size < this.baseIndent) {\r\n\t\t\t\t\tthis.error('missing indentation', {\r\n\t\t\t\t\t\toffset: offset + indent.length\r\n\t\t\t\t\t});\r\n\t\t\t\t} else {\r\n\t\t\t\t\tendsContinuationLineIndentation = this.continuationLineAdditionalIndent > 0;\r\n\t\t\t\t\tthis.continuationLineAdditionalIndent = 0;\r\n\t\t\t\t\tthis.outdentToken({\r\n\t\t\t\t\t\tmoveOut: this.indent - size,\r\n\t\t\t\t\t\tnoNewlines,\r\n\t\t\t\t\t\toutdentLength: indent.length,\r\n\t\t\t\t\t\toffset,\r\n\t\t\t\t\t\tindentSize: size,\r\n\t\t\t\t\t\tendsContinuationLineIndentation\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\treturn indent.length;\r\n\t\t\t}", "function do_js_beautify(js_source, indent_size, preserve_newlines, keep_array_indentation, braces_on_own_line)\r\n{\r\n\tindent_char = ' ';\r\n\tif(indent_size == 1) indent_char = '\\t';\r\n\treturn js_beautify(js_source,\r\n\t{\r\n\t\tindent_size: indent_size,\r\n\t\tindent_char: indent_char,\r\n\t\tpreserve_newlines: preserve_newlines,\r\n\t\tbraces_on_own_line: braces_on_own_line,\r\n\t\tkeep_array_indentation: keep_array_indentation,\r\n\t\tspace_after_anon_function: true\r\n\t});\r\n}", "getCurrentLineIndentation() {\n return this.currentLine.length - Utils.ltrim(this.currentLine, ' ').length;\n }" ]
[ "0.7559429", "0.7559429", "0.75495756", "0.75352246", "0.75240046", "0.7493951", "0.74812", "0.74812", "0.74668497", "0.74473864", "0.74473864", "0.74473864", "0.74473864", "0.74359816", "0.7413695", "0.7406404", "0.7406404", "0.7406404", "0.7406404", "0.7406404", "0.7406404", "0.7406404", "0.7406404", "0.7406404", "0.7406404", "0.7406404", "0.73740673", "0.73740673", "0.493993", "0.46880662", "0.45860708", "0.4538068", "0.44688812", "0.44526955", "0.4443222", "0.4420371", "0.43920627", "0.43825272", "0.4359265", "0.4346917", "0.43357462", "0.4322175", "0.42577976", "0.42532954", "0.42266032", "0.4215293", "0.42088154", "0.41966233", "0.4181088", "0.4180979", "0.4180979", "0.41718656", "0.41718656", "0.41718656", "0.41718656", "0.41718656", "0.41718656", "0.41718656", "0.41718656", "0.41718656", "0.4162132", "0.4154887", "0.4154887", "0.4154887", "0.4154887", "0.4154887", "0.4154887", "0.4154887", "0.4154887", "0.4154887", "0.4154887", "0.4154887", "0.4154887", "0.4154887", "0.4154887", "0.4154887", "0.4154887", "0.4154887", "0.415172", "0.4103545", "0.40873593", "0.4084994", "0.40846112", "0.4081284" ]
0.7503435
16
The publicly visible API. Note that methodOp(f) means 'wrap f in an operation, performed on its `this` parameter'. This is not the complete set of editor methods. Most of the methods defined on the Doc type are also injected into CodeMirror.prototype, for backwards compatibility and convenience.
function addEditorMethods(CodeMirror) { var optionHandlers = CodeMirror.optionHandlers; var helpers = CodeMirror.helpers = {}; CodeMirror.prototype = { constructor: CodeMirror, focus: function(){window.focus(); this.display.input.focus();}, setOption: function(option, value) { var options = this.options, old = options[option]; if (options[option] == value && option != "mode") { return } options[option] = value; if (optionHandlers.hasOwnProperty(option)) { operation(this, optionHandlers[option])(this, value, old); } signal(this, "optionChange", this, option); }, getOption: function(option) {return this.options[option]}, getDoc: function() {return this.doc}, addKeyMap: function(map$$1, bottom) { this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map$$1)); }, removeKeyMap: function(map$$1) { var maps = this.state.keyMaps; for (var i = 0; i < maps.length; ++i) { if (maps[i] == map$$1 || maps[i].name == map$$1) { maps.splice(i, 1); return true } } }, addOverlay: methodOp(function(spec, options) { var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec); if (mode.startState) { throw new Error("Overlays may not be stateful.") } insertSorted(this.state.overlays, {mode: mode, modeSpec: spec, opaque: options && options.opaque, priority: (options && options.priority) || 0}, function (overlay) { return overlay.priority; }); this.state.modeGen++; regChange(this); }), removeOverlay: methodOp(function(spec) { var this$1 = this; var overlays = this.state.overlays; for (var i = 0; i < overlays.length; ++i) { var cur = overlays[i].modeSpec; if (cur == spec || typeof spec == "string" && cur.name == spec) { overlays.splice(i, 1); this$1.state.modeGen++; regChange(this$1); return } } }), indentLine: methodOp(function(n, dir, aggressive) { if (typeof dir != "string" && typeof dir != "number") { if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; } else { dir = dir ? "add" : "subtract"; } } if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); } }), indentSelection: methodOp(function(how) { var this$1 = this; var ranges = this.doc.sel.ranges, end = -1; for (var i = 0; i < ranges.length; i++) { var range$$1 = ranges[i]; if (!range$$1.empty()) { var from = range$$1.from(), to = range$$1.to(); var start = Math.max(end, from.line); end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1; for (var j = start; j < end; ++j) { indentLine(this$1, j, how); } var newRanges = this$1.doc.sel.ranges; if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0) { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); } } else if (range$$1.head.line > end) { indentLine(this$1, range$$1.head.line, how, true); end = range$$1.head.line; if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); } } } }), // Fetch the parser token for a given character. Useful for hacks // that want to inspect the mode state (say, for completion). getTokenAt: function(pos, precise) { return takeToken(this, pos, precise) }, getLineTokens: function(line, precise) { return takeToken(this, Pos(line), precise, true) }, getTokenTypeAt: function(pos) { pos = clipPos(this.doc, pos); var styles = getLineStyles(this, getLine(this.doc, pos.line)); var before = 0, after = (styles.length - 1) / 2, ch = pos.ch; var type; if (ch == 0) { type = styles[2]; } else { for (;;) { var mid = (before + after) >> 1; if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; } else if (styles[mid * 2 + 1] < ch) { before = mid + 1; } else { type = styles[mid * 2 + 2]; break } } } var cut = type ? type.indexOf("overlay ") : -1; return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1) }, getModeAt: function(pos) { var mode = this.doc.mode; if (!mode.innerMode) { return mode } return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode }, getHelper: function(pos, type) { return this.getHelpers(pos, type)[0] }, getHelpers: function(pos, type) { var this$1 = this; var found = []; if (!helpers.hasOwnProperty(type)) { return found } var help = helpers[type], mode = this.getModeAt(pos); if (typeof mode[type] == "string") { if (help[mode[type]]) { found.push(help[mode[type]]); } } else if (mode[type]) { for (var i = 0; i < mode[type].length; i++) { var val = help[mode[type][i]]; if (val) { found.push(val); } } } else if (mode.helperType && help[mode.helperType]) { found.push(help[mode.helperType]); } else if (help[mode.name]) { found.push(help[mode.name]); } for (var i$1 = 0; i$1 < help._global.length; i$1++) { var cur = help._global[i$1]; if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1) { found.push(cur.val); } } return found }, getStateAfter: function(line, precise) { var doc = this.doc; line = clipLine(doc, line == null ? doc.first + doc.size - 1: line); return getContextBefore(this, line + 1, precise).state }, cursorCoords: function(start, mode) { var pos, range$$1 = this.doc.sel.primary(); if (start == null) { pos = range$$1.head; } else if (typeof start == "object") { pos = clipPos(this.doc, start); } else { pos = start ? range$$1.from() : range$$1.to(); } return cursorCoords(this, pos, mode || "page") }, charCoords: function(pos, mode) { return charCoords(this, clipPos(this.doc, pos), mode || "page") }, coordsChar: function(coords, mode) { coords = fromCoordSystem(this, coords, mode || "page"); return coordsChar(this, coords.left, coords.top) }, lineAtHeight: function(height, mode) { height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top; return lineAtHeight(this.doc, height + this.display.viewOffset) }, heightAtLine: function(line, mode, includeWidgets) { var end = false, lineObj; if (typeof line == "number") { var last = this.doc.first + this.doc.size - 1; if (line < this.doc.first) { line = this.doc.first; } else if (line > last) { line = last; end = true; } lineObj = getLine(this.doc, line); } else { lineObj = line; } return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top + (end ? this.doc.height - heightAtLine(lineObj) : 0) }, defaultTextHeight: function() { return textHeight(this.display) }, defaultCharWidth: function() { return charWidth(this.display) }, getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}}, addWidget: function(pos, node, scroll, vert, horiz) { var display = this.display; pos = cursorCoords(this, clipPos(this.doc, pos)); var top = pos.bottom, left = pos.left; node.style.position = "absolute"; node.setAttribute("cm-ignore-events", "true"); this.display.input.setUneditable(node); display.sizer.appendChild(node); if (vert == "over") { top = pos.top; } else if (vert == "above" || vert == "near") { var vspace = Math.max(display.wrapper.clientHeight, this.doc.height), hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth); // Default to positioning above (if specified and possible); otherwise default to positioning below if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight) { top = pos.top - node.offsetHeight; } else if (pos.bottom + node.offsetHeight <= vspace) { top = pos.bottom; } if (left + node.offsetWidth > hspace) { left = hspace - node.offsetWidth; } } node.style.top = top + "px"; node.style.left = node.style.right = ""; if (horiz == "right") { left = display.sizer.clientWidth - node.offsetWidth; node.style.right = "0px"; } else { if (horiz == "left") { left = 0; } else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; } node.style.left = left + "px"; } if (scroll) { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); } }, triggerOnKeyDown: methodOp(onKeyDown), triggerOnKeyPress: methodOp(onKeyPress), triggerOnKeyUp: onKeyUp, triggerOnMouseDown: methodOp(onMouseDown), execCommand: function(cmd) { if (commands.hasOwnProperty(cmd)) { return commands[cmd].call(null, this) } }, triggerElectric: methodOp(function(text) { triggerElectric(this, text); }), findPosH: function(from, amount, unit, visually) { var this$1 = this; var dir = 1; if (amount < 0) { dir = -1; amount = -amount; } var cur = clipPos(this.doc, from); for (var i = 0; i < amount; ++i) { cur = findPosH(this$1.doc, cur, dir, unit, visually); if (cur.hitSide) { break } } return cur }, moveH: methodOp(function(dir, unit) { var this$1 = this; this.extendSelectionsBy(function (range$$1) { if (this$1.display.shift || this$1.doc.extend || range$$1.empty()) { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) } else { return dir < 0 ? range$$1.from() : range$$1.to() } }, sel_move); }), deleteH: methodOp(function(dir, unit) { var sel = this.doc.sel, doc = this.doc; if (sel.somethingSelected()) { doc.replaceSelection("", null, "+delete"); } else { deleteNearSelection(this, function (range$$1) { var other = findPosH(doc, range$$1.head, dir, unit, false); return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other} }); } }), findPosV: function(from, amount, unit, goalColumn) { var this$1 = this; var dir = 1, x = goalColumn; if (amount < 0) { dir = -1; amount = -amount; } var cur = clipPos(this.doc, from); for (var i = 0; i < amount; ++i) { var coords = cursorCoords(this$1, cur, "div"); if (x == null) { x = coords.left; } else { coords.left = x; } cur = findPosV(this$1, coords, dir, unit); if (cur.hitSide) { break } } return cur }, moveV: methodOp(function(dir, unit) { var this$1 = this; var doc = this.doc, goals = []; var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected(); doc.extendSelectionsBy(function (range$$1) { if (collapse) { return dir < 0 ? range$$1.from() : range$$1.to() } var headPos = cursorCoords(this$1, range$$1.head, "div"); if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; } goals.push(headPos.left); var pos = findPosV(this$1, headPos, dir, unit); if (unit == "page" && range$$1 == doc.sel.primary()) { addToScrollTop(this$1, charCoords(this$1, pos, "div").top - headPos.top); } return pos }, sel_move); if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++) { doc.sel.ranges[i].goalColumn = goals[i]; } } }), // Find the word at the given position (as returned by coordsChar). findWordAt: function(pos) { var doc = this.doc, line = getLine(doc, pos.line).text; var start = pos.ch, end = pos.ch; if (line) { var helper = this.getHelper(pos, "wordChars"); if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; } var startChar = line.charAt(start); var check = isWordChar(startChar, helper) ? function (ch) { return isWordChar(ch, helper); } : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); } : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); }; while (start > 0 && check(line.charAt(start - 1))) { --start; } while (end < line.length && check(line.charAt(end))) { ++end; } } return new Range(Pos(pos.line, start), Pos(pos.line, end)) }, toggleOverwrite: function(value) { if (value != null && value == this.state.overwrite) { return } if (this.state.overwrite = !this.state.overwrite) { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); } else { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); } signal(this, "overwriteToggle", this, this.state.overwrite); }, hasFocus: function() { return this.display.input.getField() == activeElt() }, isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) }, scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }), getScrollInfo: function() { var scroller = this.display.scroller; return {left: scroller.scrollLeft, top: scroller.scrollTop, height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight, width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth, clientHeight: displayHeight(this), clientWidth: displayWidth(this)} }, scrollIntoView: methodOp(function(range$$1, margin) { if (range$$1 == null) { range$$1 = {from: this.doc.sel.primary().head, to: null}; if (margin == null) { margin = this.options.cursorScrollMargin; } } else if (typeof range$$1 == "number") { range$$1 = {from: Pos(range$$1, 0), to: null}; } else if (range$$1.from == null) { range$$1 = {from: range$$1, to: null}; } if (!range$$1.to) { range$$1.to = range$$1.from; } range$$1.margin = margin || 0; if (range$$1.from.line != null) { scrollToRange(this, range$$1); } else { scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin); } }), setSize: methodOp(function(width, height) { var this$1 = this; var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; }; if (width != null) { this.display.wrapper.style.width = interpret(width); } if (height != null) { this.display.wrapper.style.height = interpret(height); } if (this.options.lineWrapping) { clearLineMeasurementCache(this); } var lineNo$$1 = this.display.viewFrom; this.doc.iter(lineNo$$1, this.display.viewTo, function (line) { if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, "widget"); break } } } ++lineNo$$1; }); this.curOp.forceUpdate = true; signal(this, "refresh", this); }), operation: function(f){return runInOp(this, f)}, startOperation: function(){return startOperation(this)}, endOperation: function(){return endOperation(this)}, refresh: methodOp(function() { var oldHeight = this.display.cachedTextHeight; regChange(this); this.curOp.forceUpdate = true; clearCaches(this); scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop); updateGutterSpace(this); if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5) { estimateLineHeights(this); } signal(this, "refresh", this); }), swapDoc: methodOp(function(doc) { var old = this.doc; old.cm = null; attachDoc(this, doc); clearCaches(this); this.display.input.reset(); scrollToCoords(this, doc.scrollLeft, doc.scrollTop); this.curOp.forceScroll = true; signalLater(this, "swapDoc", this, old); return old }), phrase: function(phraseText) { var phrases = this.options.phrases; return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText }, getInputField: function(){return this.display.input.getField()}, getWrapperElement: function(){return this.display.wrapper}, getScrollerElement: function(){return this.display.scroller}, getGutterElement: function(){return this.display.gutters} }; eventMixin(CodeMirror); CodeMirror.registerHelper = function(type, name, value) { if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; } helpers[type][name] = value; }; CodeMirror.registerGlobalHelper = function(type, name, predicate, value) { CodeMirror.registerHelper(type, name, value); helpers[type]._global.push({pred: predicate, val: value}); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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.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 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(){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, 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\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\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 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) {\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 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) {\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 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) {\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 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 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 CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\n this.doc = doc;\n\n var display = this.display = new Display(place, doc);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) focusInput(this);\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false, focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null // Unfinished key sequence\n };\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || activeElt() == display.input)\n setTimeout(bind(onFocus, this), 20);\n else\n onBlur(this);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](this, options[opt], Init);\n maybeUpdateLineNumberWidth(this);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n display.lineDiv.style.textRendering = \"auto\";\n }", "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\n this.doc = doc;\n\n var display = this.display = new Display(place, doc);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) focusInput(this);\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false, focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null // Unfinished key sequence\n };\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || activeElt() == display.input)\n setTimeout(bind(onFocus, this), 20);\n else\n onBlur(this);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](this, options[opt], Init);\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) options.finishInit(this);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n display.lineDiv.style.textRendering = \"auto\";\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) {\n return new CodeMirror(place, options);\n }\n\n this.options = options = options ? copyObj(options) : {}; // Determine effective options based on given values and defaults.\n\n copyObj(defaults, options, false);\n var doc = options.value;\n\n if (typeof doc == \"string\") {\n doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction);\n } else if (options.mode) {\n doc.modeOption = options.mode;\n }\n\n this.doc = doc;\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n\n if (options.lineWrapping) {\n this.display.wrapper.className += \" CodeMirror-wrap\";\n }\n\n initScrollbars(this);\n this.state = {\n keyMaps: [],\n // stores maps added by addKeyMap\n overlays: [],\n // highlighting overlays, as added by addOverlay\n modeGen: 0,\n // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false,\n // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1,\n cutIncoming: -1,\n // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(),\n // stores highlight worker timeout\n keySeq: null,\n // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) {\n display.input.focus();\n } // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n\n\n if (ie && ie_version < 11) {\n setTimeout(function () {\n return this$1.display.input.reset(true);\n }, 20);\n }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n _startOperation(this);\n\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if (options.autofocus && !mobile || this.hasFocus()) {\n setTimeout(bind(onFocus, this), 20);\n } else {\n onBlur(this);\n }\n\n for (var opt in optionHandlers) {\n if (optionHandlers.hasOwnProperty(opt)) {\n optionHandlers[opt](this, options[opt], Init);\n }\n }\n\n maybeUpdateLineNumberWidth(this);\n\n if (options.finishInit) {\n options.finishInit(this);\n }\n\n for (var i = 0; i < initHooks.length; ++i) {\n initHooks[i](this);\n }\n\n _endOperation(this); // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n\n\n if (webkit && options.lineWrapping && getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\") {\n display.lineDiv.style.textRendering = \"auto\";\n }\n } // The default configuration options.", "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\n this.doc = doc;\n\n var display = this.display = new Display(place, doc);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) focusInput(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false, focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null // Unfinished key sequence\n };\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || activeElt() == display.input)\n setTimeout(bind(onFocus, this), 20);\n else\n onBlur(this);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](this, options[opt], Init);\n maybeUpdateLineNumberWidth(this);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n endOperation(this);\n }", "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) display.input.focus();\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n var cm = this;\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || cm.hasFocus())\n setTimeout(bind(onFocus, this), 20);\n else\n onBlur(this);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](this, options[opt], Init);\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) options.finishInit(this);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n display.lineDiv.style.textRendering = \"auto\";\n }", "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options || {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\n this.doc = doc;\n\n var display = this.display = new Display(place, doc);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) focusInput(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false, focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput\n draggingText: false,\n highlight: new Delayed() // stores highlight worker timeout\n };\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n var cm = this;\n runInOp(this, function() {\n cm.curOp.forceUpdate = true;\n attachDoc(cm, doc);\n\n if ((options.autofocus && !mobile) || activeElt() == display.input)\n setTimeout(bind(onFocus, cm), 20);\n else\n onBlur(cm);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](cm, options[opt], Init);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](cm);\n });\n }", "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options || {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\n this.doc = doc;\n\n var display = this.display = new Display(place, doc);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) focusInput(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false, focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput\n draggingText: false,\n highlight: new Delayed() // stores highlight worker timeout\n };\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n var cm = this;\n runInOp(this, function() {\n cm.curOp.forceUpdate = true;\n attachDoc(cm, doc);\n\n if ((options.autofocus && !mobile) || activeElt() == display.input)\n setTimeout(bind(onFocus, cm), 20);\n else\n onBlur(cm);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](cm, options[opt], Init);\n maybeUpdateLineNumberWidth(cm);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](cm);\n });\n }", "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options || {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\n this.doc = doc;\n\n var display = this.display = new Display(place, doc);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) focusInput(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false, focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput\n draggingText: false,\n highlight: new Delayed() // stores highlight worker timeout\n };\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n var cm = this;\n runInOp(this, function() {\n cm.curOp.forceUpdate = true;\n attachDoc(cm, doc);\n\n if ((options.autofocus && !mobile) || activeElt() == display.input)\n setTimeout(bind(onFocus, cm), 20);\n else\n onBlur(cm);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](cm, options[opt], Init);\n maybeUpdateLineNumberWidth(cm);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](cm);\n });\n }", "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode, null, options.lineSeparator);\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) display.input.focus();\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n var cm = this;\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || cm.hasFocus())\n setTimeout(bind(onFocus, this), 20);\n else\n onBlur(this);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](this, options[opt], Init);\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) options.finishInit(this);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n display.lineDiv.style.textRendering = \"auto\";\n }", "function CodeMirror(place, options) {\r\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\r\n\r\n this.options = options = options || {};\r\n // Determine effective options based on given values and defaults.\r\n copyObj(defaults, options, false);\r\n setGuttersForLineNumbers(options);\r\n\r\n var doc = options.value;\r\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode);\r\n this.doc = doc;\r\n\r\n var display = this.display = new Display(place, doc);\r\n display.wrapper.CodeMirror = this;\r\n updateGutters(this);\r\n themeChanged(this);\r\n if (options.lineWrapping)\r\n this.display.wrapper.className += \" CodeMirror-wrap\";\r\n if (options.autofocus && !mobile) focusInput(this);\r\n\r\n this.state = {\r\n keyMaps: [], // stores maps added by addKeyMap\r\n overlays: [], // highlighting overlays, as added by addOverlay\r\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\r\n overwrite: false, focused: false,\r\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\r\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput\r\n draggingText: false,\r\n highlight: new Delayed() // stores highlight worker timeout\r\n };\r\n\r\n // Override magic textarea content restore that IE sometimes does\r\n // on our hidden textarea on reload\r\n if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);\r\n\r\n registerEventHandlers(this);\r\n ensureGlobalHandlers();\r\n\r\n var cm = this;\r\n runInOp(this, function() {\r\n cm.curOp.forceUpdate = true;\r\n attachDoc(cm, doc);\r\n\r\n if ((options.autofocus && !mobile) || activeElt() == display.input)\r\n setTimeout(bind(onFocus, cm), 20);\r\n else\r\n onBlur(cm);\r\n\r\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\r\n optionHandlers[opt](cm, options[opt], Init);\r\n maybeUpdateLineNumberWidth(cm);\r\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](cm);\r\n });\r\n }", "function CodeMirror(place, options) {\n\t if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n\t this.options = options = options ? copyObj(options) : {};\n\t // Determine effective options based on given values and defaults.\n\t copyObj(defaults, options, false);\n\t setGuttersForLineNumbers(options);\n\n\t var doc = options.value;\n\t if (typeof doc == \"string\") doc = new Doc(doc, options.mode, null, options.lineSeparator);\n\t this.doc = doc;\n\n\t var input = new CodeMirror.inputStyles[options.inputStyle](this);\n\t var display = this.display = new Display(place, doc, input);\n\t display.wrapper.CodeMirror = this;\n\t updateGutters(this);\n\t themeChanged(this);\n\t if (options.lineWrapping)\n\t this.display.wrapper.className += \" CodeMirror-wrap\";\n\t if (options.autofocus && !mobile) display.input.focus();\n\t initScrollbars(this);\n\n\t this.state = {\n\t keyMaps: [], // stores maps added by addKeyMap\n\t overlays: [], // highlighting overlays, as added by addOverlay\n\t modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n\t overwrite: false,\n\t delayingBlurEvent: false,\n\t focused: false,\n\t suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n\t pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n\t selectingText: false,\n\t draggingText: false,\n\t highlight: new Delayed(), // stores highlight worker timeout\n\t keySeq: null, // Unfinished key sequence\n\t specialChars: null\n\t };\n\n\t var cm = this;\n\n\t // Override magic textarea content restore that IE sometimes does\n\t // on our hidden textarea on reload\n\t if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);\n\n\t registerEventHandlers(this);\n\t ensureGlobalHandlers();\n\n\t startOperation(this);\n\t this.curOp.forceUpdate = true;\n\t attachDoc(this, doc);\n\n\t if ((options.autofocus && !mobile) || cm.hasFocus())\n\t setTimeout(bind(onFocus, this), 20);\n\t else\n\t onBlur(this);\n\n\t for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n\t optionHandlers[opt](this, options[opt], Init);\n\t maybeUpdateLineNumberWidth(this);\n\t if (options.finishInit) options.finishInit(this);\n\t for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n\t endOperation(this);\n\t // Suppress optimizelegibility in Webkit, since it breaks text\n\t // measuring on line wrapping boundaries.\n\t if (webkit && options.lineWrapping &&\n\t getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n\t display.lineDiv.style.textRendering = \"auto\";\n\t }", "function CodeMirror(place, options) {\n\t if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n\t this.options = options = options ? copyObj(options) : {};\n\t // Determine effective options based on given values and defaults.\n\t copyObj(defaults, options, false);\n\t setGuttersForLineNumbers(options);\n\n\t var doc = options.value;\n\t if (typeof doc == \"string\") doc = new Doc(doc, options.mode, null, options.lineSeparator);\n\t this.doc = doc;\n\n\t var input = new CodeMirror.inputStyles[options.inputStyle](this);\n\t var display = this.display = new Display(place, doc, input);\n\t display.wrapper.CodeMirror = this;\n\t updateGutters(this);\n\t themeChanged(this);\n\t if (options.lineWrapping)\n\t this.display.wrapper.className += \" CodeMirror-wrap\";\n\t if (options.autofocus && !mobile) display.input.focus();\n\t initScrollbars(this);\n\n\t this.state = {\n\t keyMaps: [], // stores maps added by addKeyMap\n\t overlays: [], // highlighting overlays, as added by addOverlay\n\t modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n\t overwrite: false,\n\t delayingBlurEvent: false,\n\t focused: false,\n\t suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n\t pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n\t selectingText: false,\n\t draggingText: false,\n\t highlight: new Delayed(), // stores highlight worker timeout\n\t keySeq: null, // Unfinished key sequence\n\t specialChars: null\n\t };\n\n\t var cm = this;\n\n\t // Override magic textarea content restore that IE sometimes does\n\t // on our hidden textarea on reload\n\t if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);\n\n\t registerEventHandlers(this);\n\t ensureGlobalHandlers();\n\n\t startOperation(this);\n\t this.curOp.forceUpdate = true;\n\t attachDoc(this, doc);\n\n\t if ((options.autofocus && !mobile) || cm.hasFocus())\n\t setTimeout(bind(onFocus, this), 20);\n\t else\n\t onBlur(this);\n\n\t for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n\t optionHandlers[opt](this, options[opt], Init);\n\t maybeUpdateLineNumberWidth(this);\n\t if (options.finishInit) options.finishInit(this);\n\t for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n\t endOperation(this);\n\t // Suppress optimizelegibility in Webkit, since it breaks text\n\t // measuring on line wrapping boundaries.\n\t if (webkit && options.lineWrapping &&\n\t getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n\t display.lineDiv.style.textRendering = \"auto\";\n\t }", "function CodeMirror$1(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n}", "function CodeMirror$1(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n}", "function CodeMirror$1(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n}", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n\t\t if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\t\t\n\t\t this.options = options = options ? copyObj(options) : {};\n\t\t // Determine effective options based on given values and defaults.\n\t\t copyObj(defaults, options, false);\n\t\t setGuttersForLineNumbers(options);\n\t\t\n\t\t var doc = options.value;\n\t\t if (typeof doc == \"string\") doc = new Doc(doc, options.mode, null, options.lineSeparator);\n\t\t this.doc = doc;\n\t\t\n\t\t var input = new CodeMirror.inputStyles[options.inputStyle](this);\n\t\t var display = this.display = new Display(place, doc, input);\n\t\t display.wrapper.CodeMirror = this;\n\t\t updateGutters(this);\n\t\t themeChanged(this);\n\t\t if (options.lineWrapping)\n\t\t this.display.wrapper.className += \" CodeMirror-wrap\";\n\t\t if (options.autofocus && !mobile) display.input.focus();\n\t\t initScrollbars(this);\n\t\t\n\t\t this.state = {\n\t\t keyMaps: [], // stores maps added by addKeyMap\n\t\t overlays: [], // highlighting overlays, as added by addOverlay\n\t\t modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n\t\t overwrite: false,\n\t\t delayingBlurEvent: false,\n\t\t focused: false,\n\t\t suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n\t\t pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n\t\t selectingText: false,\n\t\t draggingText: false,\n\t\t highlight: new Delayed(), // stores highlight worker timeout\n\t\t keySeq: null, // Unfinished key sequence\n\t\t specialChars: null\n\t\t };\n\t\t\n\t\t var cm = this;\n\t\t\n\t\t // Override magic textarea content restore that IE sometimes does\n\t\t // on our hidden textarea on reload\n\t\t if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);\n\t\t\n\t\t registerEventHandlers(this);\n\t\t ensureGlobalHandlers();\n\t\t\n\t\t startOperation(this);\n\t\t this.curOp.forceUpdate = true;\n\t\t attachDoc(this, doc);\n\t\t\n\t\t if ((options.autofocus && !mobile) || cm.hasFocus())\n\t\t setTimeout(bind(onFocus, this), 20);\n\t\t else\n\t\t onBlur(this);\n\t\t\n\t\t for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n\t\t optionHandlers[opt](this, options[opt], Init);\n\t\t maybeUpdateLineNumberWidth(this);\n\t\t if (options.finishInit) options.finishInit(this);\n\t\t for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n\t\t endOperation(this);\n\t\t // Suppress optimizelegibility in Webkit, since it breaks text\n\t\t // measuring on line wrapping boundaries.\n\t\t if (webkit && options.lineWrapping &&\n\t\t getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n\t\t display.lineDiv.style.textRendering = \"auto\";\n\t\t }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }", "function CodeMirror(place, options) {\n\t if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\t\n\t this.options = options = options ? copyObj(options) : {};\n\t // Determine effective options based on given values and defaults.\n\t copyObj(defaults, options, false);\n\t setGuttersForLineNumbers(options);\n\t\n\t var doc = options.value;\n\t if (typeof doc == \"string\") doc = new Doc(doc, options.mode, null, options.lineSeparator);\n\t this.doc = doc;\n\t\n\t var input = new CodeMirror.inputStyles[options.inputStyle](this);\n\t var display = this.display = new Display(place, doc, input);\n\t display.wrapper.CodeMirror = this;\n\t updateGutters(this);\n\t themeChanged(this);\n\t if (options.lineWrapping)\n\t this.display.wrapper.className += \" CodeMirror-wrap\";\n\t if (options.autofocus && !mobile) display.input.focus();\n\t initScrollbars(this);\n\t\n\t this.state = {\n\t keyMaps: [], // stores maps added by addKeyMap\n\t overlays: [], // highlighting overlays, as added by addOverlay\n\t modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n\t overwrite: false,\n\t delayingBlurEvent: false,\n\t focused: false,\n\t suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n\t pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n\t selectingText: false,\n\t draggingText: false,\n\t highlight: new Delayed(), // stores highlight worker timeout\n\t keySeq: null, // Unfinished key sequence\n\t specialChars: null\n\t };\n\t\n\t var cm = this;\n\t\n\t // Override magic textarea content restore that IE sometimes does\n\t // on our hidden textarea on reload\n\t if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);\n\t\n\t registerEventHandlers(this);\n\t ensureGlobalHandlers();\n\t\n\t startOperation(this);\n\t this.curOp.forceUpdate = true;\n\t attachDoc(this, doc);\n\t\n\t if ((options.autofocus && !mobile) || cm.hasFocus())\n\t setTimeout(bind(onFocus, this), 20);\n\t else\n\t onBlur(this);\n\t\n\t for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n\t optionHandlers[opt](this, options[opt], Init);\n\t maybeUpdateLineNumberWidth(this);\n\t if (options.finishInit) options.finishInit(this);\n\t for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n\t endOperation(this);\n\t // Suppress optimizelegibility in Webkit, since it breaks text\n\t // measuring on line wrapping boundaries.\n\t if (webkit && options.lineWrapping &&\n\t getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n\t display.lineDiv.style.textRendering = \"auto\";\n\t }", "function CodeMirror$1(place, options) {\r\n var this$1 = this;\r\n\r\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\r\n\r\n this.options = options = options ? copyObj(options) : {};\r\n // Determine effective options based on given values and defaults.\r\n copyObj(defaults, options, false);\r\n setGuttersForLineNumbers(options);\r\n\r\n var doc = options.value;\r\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\r\n this.doc = doc;\r\n\r\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\r\n var display = this.display = new Display(place, doc, input);\r\n display.wrapper.CodeMirror = this;\r\n updateGutters(this);\r\n themeChanged(this);\r\n if (options.lineWrapping)\r\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\r\n initScrollbars(this);\r\n\r\n this.state = {\r\n keyMaps: [], // stores maps added by addKeyMap\r\n overlays: [], // highlighting overlays, as added by addOverlay\r\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\r\n overwrite: false,\r\n delayingBlurEvent: false,\r\n focused: false,\r\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\r\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\r\n selectingText: false,\r\n draggingText: false,\r\n highlight: new Delayed(), // stores highlight worker timeout\r\n keySeq: null, // Unfinished key sequence\r\n specialChars: null\r\n };\r\n\r\n if (options.autofocus && !mobile) { display.input.focus(); }\r\n\r\n // Override magic textarea content restore that IE sometimes does\r\n // on our hidden textarea on reload\r\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\r\n\r\n registerEventHandlers(this);\r\n ensureGlobalHandlers();\r\n\r\n startOperation(this);\r\n this.curOp.forceUpdate = true;\r\n attachDoc(this, doc);\r\n\r\n if ((options.autofocus && !mobile) || this.hasFocus())\r\n { setTimeout(bind(onFocus, this), 20); }\r\n else\r\n { onBlur(this); }\r\n\r\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\r\n { optionHandlers[opt](this$1, options[opt], Init); } }\r\n maybeUpdateLineNumberWidth(this);\r\n if (options.finishInit) { options.finishInit(this); }\r\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\r\n endOperation(this);\r\n // Suppress optimizelegibility in Webkit, since it breaks text\r\n // measuring on line wrapping boundaries.\r\n if (webkit && options.lineWrapping &&\r\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\r\n { display.lineDiv.style.textRendering = \"auto\"; }\r\n}" ]
[ "0.6675193", "0.6675193", "0.6675193", "0.6675193", "0.6675193", "0.66579515", "0.6635314", "0.6635314", "0.66196305", "0.66196305", "0.66196305", "0.66196305", "0.66196305", "0.66196305", "0.66078043", "0.6596803", "0.6596803", "0.61544967", "0.613479", "0.613479", "0.613479", "0.61116123", "0.60292244", "0.60292244", "0.60292244", "0.60292244", "0.60292244", "0.60292244", "0.60292244", "0.60292244", "0.5966656", "0.5966656", "0.5966656", "0.5966656", "0.5966656", "0.5966656", "0.5966656", "0.5966656", "0.5966656", "0.5966656", "0.5966656", "0.5966656", "0.5966656", "0.5966656", "0.5966656", "0.5966656", "0.5966656", "0.5954224", "0.58728135", "0.58636", "0.58636", "0.58636", "0.58636", "0.58636", "0.58636", "0.58636", "0.58636", "0.58636", "0.58636", "0.58636", "0.5840606", "0.5840606", "0.5742635", "0.57214713", "0.5695726", "0.5684972", "0.5663528", "0.5634371", "0.5629436", "0.5629436", "0.56273", "0.5615026", "0.55515766", "0.55515766", "0.55443937", "0.55443937", "0.55443937", "0.55408144", "0.55408144", "0.55408144", "0.55408144", "0.55408144", "0.55408144", "0.55408144", "0.55310726", "0.5519884", "0.5519389", "0.5519389", "0.5519389", "0.5514074", "0.5514074", "0.5514074", "0.5514074", "0.5514074", "0.5514074", "0.55132943", "0.5470842" ]
0.6675193
5
Used for horizontal relative motion. Dir is 1 or 1 (left or right), unit can be "char", "column" (like char, but doesn't cross line boundaries), "word" (across next word), or "group" (to the start of next group of word or nonwordnonwhitespace chars). The visually param controls whether, in righttoleft text, direction 1 means to move towards the next index in the string, or towards the character to the right of the current position. The resulting position will have a hitSide=true property if it reached the end of the document.
function findPosH(doc, pos, dir, unit, visually) { var oldPos = pos; var origDir = dir; var lineObj = getLine(doc, pos.line); function findNextLine() { var l = pos.line + dir; if (l < doc.first || l >= doc.first + doc.size) { return false } pos = new Pos(l, pos.ch, pos.sticky); return lineObj = getLine(doc, l) } function moveOnce(boundToLine) { var next; if (visually) { next = moveVisually(doc.cm, lineObj, pos, dir); } else { next = moveLogically(lineObj, pos, dir); } if (next == null) { if (!boundToLine && findNextLine()) { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); } else { return false } } else { pos = next; } return true } if (unit == "char") { moveOnce(); } else if (unit == "column") { moveOnce(true); } else if (unit == "word" || unit == "group") { var sawType = null, group = unit == "group"; var helper = doc.cm && doc.cm.getHelper(pos, "wordChars"); for (var first = true;; first = false) { if (dir < 0 && !moveOnce(!first)) { break } var cur = lineObj.text.charAt(pos.ch) || "\n"; var type = isWordChar(cur, helper) ? "w" : group && cur == "\n" ? "n" : !group || /\s/.test(cur) ? null : "p"; if (group && !first && !type) { type = "s"; } if (sawType && sawType != type) { if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";} break } if (type) { sawType = type; } if (dir > 0 && !moveOnce(!first)) { break } } } var result = skipAtomic(doc, pos, oldPos, origDir, true); if (equalCursorPos(oldPos, result)) { result.hitSide = true; } return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findPosH(doc, pos, dir, unit, visually) {\r\n var line = pos.line, ch = pos.ch, origDir = dir;\r\n var lineObj = getLine(doc, line);\r\n var possible = true;\r\n function findNextLine() {\r\n var l = line + dir;\r\n if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\r\n line = l;\r\n return lineObj = getLine(doc, l);\r\n }\r\n function moveOnce(boundToLine) {\r\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\r\n if (next == null) {\r\n if (!boundToLine && findNextLine()) {\r\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\r\n else ch = dir < 0 ? lineObj.text.length : 0;\r\n } else return (possible = false);\r\n } else ch = next;\r\n return true;\r\n }\r\n\r\n if (unit == \"char\") moveOnce();\r\n else if (unit == \"column\") moveOnce(true);\r\n else if (unit == \"word\" || unit == \"group\") {\r\n var sawType = null, group = unit == \"group\";\r\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\r\n for (var first = true;; first = false) {\r\n if (dir < 0 && !moveOnce(!first)) break;\r\n var cur = lineObj.text.charAt(ch) || \"\\n\";\r\n var type = isWordChar(cur, helper) ? \"w\"\r\n : group && cur == \"\\n\" ? \"n\"\r\n : !group || /\\s/.test(cur) ? null\r\n : \"p\";\r\n if (group && !first && !type) type = \"s\";\r\n if (sawType && sawType != type) {\r\n if (dir < 0) {dir = 1; moveOnce();}\r\n break;\r\n }\r\n\r\n if (type) sawType = type;\r\n if (dir > 0 && !moveOnce(!first)) break;\r\n }\r\n }\r\n var result = skipAtomic(doc, Pos(line, ch), origDir, true);\r\n if (!possible) result.hitSide = true;\r\n return result;\r\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n var possible = true;\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return (possible = false);\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), origDir, true);\n if (!possible) result.hitSide = true;\n return result;\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n var possible = true;\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return (possible = false);\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), origDir, true);\n if (!possible) result.hitSide = true;\n return result;\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n var possible = true;\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return (possible = false);\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), origDir, true);\n if (!possible) result.hitSide = true;\n return result;\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n var possible = true;\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return (possible = false);\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), origDir, true);\n if (!possible) result.hitSide = true;\n return result;\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n var possible = true;\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return (possible = false);\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), origDir, true);\n if (!possible) result.hitSide = true;\n return result;\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n var possible = true;\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return (possible = false);\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), origDir, true);\n if (!possible) result.hitSide = true;\n return result;\n }", "function findPosH(doc, pos, dir, unit, visually) {\n\t\t var line = pos.line, ch = pos.ch, origDir = dir;\n\t\t var lineObj = getLine(doc, line);\n\t\t function findNextLine() {\n\t\t var l = line + dir;\n\t\t if (l < doc.first || l >= doc.first + doc.size) return false\n\t\t line = l;\n\t\t return lineObj = getLine(doc, l);\n\t\t }\n\t\t function moveOnce(boundToLine) {\n\t\t var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n\t\t if (next == null) {\n\t\t if (!boundToLine && findNextLine()) {\n\t\t if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n\t\t else ch = dir < 0 ? lineObj.text.length : 0;\n\t\t } else return false\n\t\t } else ch = next;\n\t\t return true;\n\t\t }\n\t\t\n\t\t if (unit == \"char\") {\n\t\t moveOnce()\n\t\t } else if (unit == \"column\") {\n\t\t moveOnce(true)\n\t\t } else if (unit == \"word\" || unit == \"group\") {\n\t\t var sawType = null, group = unit == \"group\";\n\t\t var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n\t\t for (var first = true;; first = false) {\n\t\t if (dir < 0 && !moveOnce(!first)) break;\n\t\t var cur = lineObj.text.charAt(ch) || \"\\n\";\n\t\t var type = isWordChar(cur, helper) ? \"w\"\n\t\t : group && cur == \"\\n\" ? \"n\"\n\t\t : !group || /\\s/.test(cur) ? null\n\t\t : \"p\";\n\t\t if (group && !first && !type) type = \"s\";\n\t\t if (sawType && sawType != type) {\n\t\t if (dir < 0) {dir = 1; moveOnce();}\n\t\t break;\n\t\t }\n\t\t\n\t\t if (type) sawType = type;\n\t\t if (dir > 0 && !moveOnce(!first)) break;\n\t\t }\n\t\t }\n\t\t var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true);\n\t\t if (!cmp(pos, result)) result.hitSide = true;\n\t\t return result;\n\t\t }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return false\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return false\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") {\n moveOnce()\n } else if (unit == \"column\") {\n moveOnce(true)\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true);\n if (!cmp(pos, result)) result.hitSide = true;\n return result;\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir\n var lineObj = getLine(doc, line)\n function findNextLine() {\n var l = line + dir\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n line = l\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true)\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) { ch = (dir < 0 ? lineRight : lineLeft)(lineObj) }\n else { ch = dir < 0 ? lineObj.text.length : 0 }\n } else { return false }\n } else { ch = next }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce()\n } else if (unit == \"column\") {\n moveOnce(true)\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\"\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\")\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(ch) || \"\\n\"\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\"\n if (group && !first && !type) { type = \"s\" }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce()}\n break\n }\n\n if (type) { sawType = type }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true)\n if (!cmp(pos, result)) { result.hitSide = true }\n return result\n}", "function horizontalDirection(startX, startY, targetX, targetY, bufferService, applicationCursor) {\n let startRow;\n if (moveToRequestedRow(targetX, targetY, bufferService, applicationCursor).length > 0) {\n startRow = targetY - wrappedRowsForRow(bufferService, targetY);\n }\n else {\n startRow = startY;\n }\n if ((startX < targetX &&\n startRow <= targetY) || // down/right or same y/right\n (startX >= targetX &&\n startRow < targetY)) { // down/left or same y/left\n return \"C\" /* RIGHT */;\n }\n return \"D\" /* LEFT */;\n}", "function findPosH(doc, pos, dir, unit, visually) {\n\t var line = pos.line, ch = pos.ch, origDir = dir;\n\t var lineObj = getLine(doc, line);\n\t var possible = true;\n\t function findNextLine() {\n\t var l = line + dir;\n\t if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\n\t line = l;\n\t return lineObj = getLine(doc, l);\n\t }\n\t function moveOnce(boundToLine) {\n\t var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n\t if (next == null) {\n\t if (!boundToLine && findNextLine()) {\n\t if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n\t else ch = dir < 0 ? lineObj.text.length : 0;\n\t } else return (possible = false);\n\t } else ch = next;\n\t return true;\n\t }\n\n\t if (unit == \"char\") moveOnce();\n\t else if (unit == \"column\") moveOnce(true);\n\t else if (unit == \"word\" || unit == \"group\") {\n\t var sawType = null, group = unit == \"group\";\n\t var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n\t for (var first = true;; first = false) {\n\t if (dir < 0 && !moveOnce(!first)) break;\n\t var cur = lineObj.text.charAt(ch) || \"\\n\";\n\t var type = isWordChar(cur, helper) ? \"w\"\n\t : group && cur == \"\\n\" ? \"n\"\n\t : !group || /\\s/.test(cur) ? null\n\t : \"p\";\n\t if (group && !first && !type) type = \"s\";\n\t if (sawType && sawType != type) {\n\t if (dir < 0) {dir = 1; moveOnce();}\n\t break;\n\t }\n\n\t if (type) sawType = type;\n\t if (dir > 0 && !moveOnce(!first)) break;\n\t }\n\t }\n\t var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true);\n\t if (!possible) result.hitSide = true;\n\t return result;\n\t }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var moveOneUnit = byUnit ? function(pos, dir) {\n do pos += dir;\n while (pos > 0 && isExtendingChar.test(line.text.charAt(pos)));\n return pos;\n } : function(pos, dir) { return pos + dir; };\n var linedir = bidi[0].level;\n for (var i = 0; i < bidi.length; ++i) {\n var part = bidi[i], sticky = part.level % 2 == linedir;\n if ((part.from < start && part.to > start) ||\n (sticky && (part.from == start || part.to == start))) break;\n }\n var target = moveOneUnit(start, part.level % 2 ? -dir : dir);\n\n while (target != null) {\n if (part.level % 2 == linedir) {\n if (target < part.from || target > part.to) {\n part = bidi[i += dir];\n target = part && (dir > 0 == part.level % 2 ? moveOneUnit(part.to, -1) : moveOneUnit(part.from, 1));\n } else break;\n } else {\n if (target == bidiLeft(part)) {\n part = bidi[--i];\n target = part && bidiRight(part);\n } else if (target == bidiRight(part)) {\n part = bidi[++i];\n target = part && bidiLeft(part);\n } else break;\n }\n }\n\n return target < 0 || target > line.text.length ? null : target;\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var moveOneUnit = byUnit ? function(pos, dir) {\n do pos += dir;\n while (pos > 0 && isExtendingChar.test(line.text.charAt(pos)));\n return pos;\n } : function(pos, dir) { return pos + dir; };\n var linedir = bidi[0].level;\n for (var i = 0; i < bidi.length; ++i) {\n var part = bidi[i], sticky = part.level % 2 == linedir;\n if ((part.from < start && part.to > start) ||\n (sticky && (part.from == start || part.to == start))) break;\n }\n var target = moveOneUnit(start, part.level % 2 ? -dir : dir);\n\n while (target != null) {\n if (part.level % 2 == linedir) {\n if (target < part.from || target > part.to) {\n part = bidi[i += dir];\n target = part && (dir > 0 == part.level % 2 ? moveOneUnit(part.to, -1) : moveOneUnit(part.from, 1));\n } else break;\n } else {\n if (target == bidiLeft(part)) {\n part = bidi[--i];\n target = part && bidiRight(part);\n } else if (target == bidiRight(part)) {\n part = bidi[++i];\n target = part && bidiLeft(part);\n } else break;\n }\n }\n\n return target < 0 || target > line.text.length ? null : target;\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var moveOneUnit = byUnit ? function(pos, dir) {\n do pos += dir;\n while (pos > 0 && isExtendingChar.test(line.text.charAt(pos)));\n return pos;\n } : function(pos, dir) { return pos + dir; };\n var linedir = bidi[0].level;\n for (var i = 0; i < bidi.length; ++i) {\n var part = bidi[i], sticky = part.level % 2 == linedir;\n if ((part.from < start && part.to > start) ||\n (sticky && (part.from == start || part.to == start))) break;\n }\n var target = moveOneUnit(start, part.level % 2 ? -dir : dir);\n\n while (target != null) {\n if (part.level % 2 == linedir) {\n if (target < part.from || target > part.to) {\n part = bidi[i += dir];\n target = part && (dir > 0 == part.level % 2 ? moveOneUnit(part.to, -1) : moveOneUnit(part.from, 1));\n } else break;\n } else {\n if (target == bidiLeft(part)) {\n part = bidi[--i];\n target = part && bidiRight(part);\n } else if (target == bidiRight(part)) {\n part = bidi[++i];\n target = part && bidiLeft(part);\n } else break;\n }\n }\n\n return target < 0 || target > line.text.length ? null : target;\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n\t var line = pos.line, ch = pos.ch, origDir = dir;\n\t var lineObj = getLine(doc, line);\n\t function findNextLine() {\n\t var l = line + dir;\n\t if (l < doc.first || l >= doc.first + doc.size) return false\n\t line = l;\n\t return lineObj = getLine(doc, l);\n\t }\n\t function moveOnce(boundToLine) {\n\t var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n\t if (next == null) {\n\t if (!boundToLine && findNextLine()) {\n\t if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n\t else ch = dir < 0 ? lineObj.text.length : 0;\n\t } else return false\n\t } else ch = next;\n\t return true;\n\t }\n\t\n\t if (unit == \"char\") {\n\t moveOnce()\n\t } else if (unit == \"column\") {\n\t moveOnce(true)\n\t } else if (unit == \"word\" || unit == \"group\") {\n\t var sawType = null, group = unit == \"group\";\n\t var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n\t for (var first = true;; first = false) {\n\t if (dir < 0 && !moveOnce(!first)) break;\n\t var cur = lineObj.text.charAt(ch) || \"\\n\";\n\t var type = isWordChar(cur, helper) ? \"w\"\n\t : group && cur == \"\\n\" ? \"n\"\n\t : !group || /\\s/.test(cur) ? null\n\t : \"p\";\n\t if (group && !first && !type) type = \"s\";\n\t if (sawType && sawType != type) {\n\t if (dir < 0) {dir = 1; moveOnce();}\n\t break;\n\t }\n\t\n\t if (type) sawType = type;\n\t if (dir > 0 && !moveOnce(!first)) break;\n\t }\n\t }\n\t var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true);\n\t if (!cmp(pos, result)) result.hitSide = true;\n\t return result;\n\t }", "function findPosH(doc, pos, dir, unit, visually) {\n\t var line = pos.line, ch = pos.ch, origDir = dir;\n\t var lineObj = getLine(doc, line);\n\t function findNextLine() {\n\t var l = line + dir;\n\t if (l < doc.first || l >= doc.first + doc.size) return false\n\t line = l;\n\t return lineObj = getLine(doc, l);\n\t }\n\t function moveOnce(boundToLine) {\n\t var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n\t if (next == null) {\n\t if (!boundToLine && findNextLine()) {\n\t if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n\t else ch = dir < 0 ? lineObj.text.length : 0;\n\t } else return false\n\t } else ch = next;\n\t return true;\n\t }\n\n\t if (unit == \"char\") {\n\t moveOnce()\n\t } else if (unit == \"column\") {\n\t moveOnce(true)\n\t } else if (unit == \"word\" || unit == \"group\") {\n\t var sawType = null, group = unit == \"group\";\n\t var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n\t for (var first = true;; first = false) {\n\t if (dir < 0 && !moveOnce(!first)) break;\n\t var cur = lineObj.text.charAt(ch) || \"\\n\";\n\t var type = isWordChar(cur, helper) ? \"w\"\n\t : group && cur == \"\\n\" ? \"n\"\n\t : !group || /\\s/.test(cur) ? null\n\t : \"p\";\n\t if (group && !first && !type) type = \"s\";\n\t if (sawType && sawType != type) {\n\t if (dir < 0) {dir = 1; moveOnce();}\n\t break;\n\t }\n\n\t if (type) sawType = type;\n\t if (dir > 0 && !moveOnce(!first)) break;\n\t }\n\t }\n\t var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true);\n\t if (!cmp(pos, result)) result.hitSide = true;\n\t return result;\n\t }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (unit > 0 ? 0 : -1));\n if (isNaN(ch)) { next = null; }\n else { next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (ch >= 0xD800 && ch < 0xDC00 ? 2 : 1))),\n -dir); }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\r\n var oldPos = pos;\r\n var origDir = dir;\r\n var lineObj = getLine(doc, pos.line);\r\n function findNextLine() {\r\n var l = pos.line + dir;\r\n if (l < doc.first || l >= doc.first + doc.size) { return false }\r\n pos = new Pos(l, pos.ch, pos.sticky);\r\n return lineObj = getLine(doc, l)\r\n }\r\n function moveOnce(boundToLine) {\r\n var next;\r\n if (visually) {\r\n next = moveVisually(doc.cm, lineObj, pos, dir);\r\n } else {\r\n next = moveLogically(lineObj, pos, dir);\r\n }\r\n if (next == null) {\r\n if (!boundToLine && findNextLine())\r\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\r\n else\r\n { return false }\r\n } else {\r\n pos = next;\r\n }\r\n return true\r\n }\r\n\r\n if (unit == \"char\") {\r\n moveOnce();\r\n } else if (unit == \"column\") {\r\n moveOnce(true);\r\n } else if (unit == \"word\" || unit == \"group\") {\r\n var sawType = null, group = unit == \"group\";\r\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\r\n for (var first = true;; first = false) {\r\n if (dir < 0 && !moveOnce(!first)) { break }\r\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\r\n var type = isWordChar(cur, helper) ? \"w\"\r\n : group && cur == \"\\n\" ? \"n\"\r\n : !group || /\\s/.test(cur) ? null\r\n : \"p\";\r\n if (group && !first && !type) { type = \"s\"; }\r\n if (sawType && sawType != type) {\r\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\r\n break\r\n }\r\n\r\n if (type) { sawType = type; }\r\n if (dir > 0 && !moveOnce(!first)) { break }\r\n }\r\n }\r\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\r\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\r\n return result\r\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));\n if (isNaN(ch)) {\n next = null;\n } else {\n var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;\n next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);\n }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));\n if (isNaN(ch)) {\n next = null;\n } else {\n var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;\n next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);\n }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));\n if (isNaN(ch)) {\n next = null;\n } else {\n var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;\n next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);\n }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));\n if (isNaN(ch)) {\n next = null;\n } else {\n var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;\n next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);\n }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));\n if (isNaN(ch)) {\n next = null;\n } else {\n var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;\n next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);\n }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function _findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n\n function findNextLine() {\n var l = pos.line + lineDir;\n\n if (l < doc.first || l >= doc.first + doc.size) {\n return false;\n }\n\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l);\n }\n\n function moveOnce(boundToLine) {\n var next;\n\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir);\n } else {\n return false;\n }\n } else {\n pos = next;\n }\n\n return true;\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null,\n group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) {\n break;\n }\n\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\" : group && cur == \"\\n\" ? \"n\" : !group || /\\s/.test(cur) ? null : \"p\";\n\n if (group && !first && !type) {\n type = \"s\";\n }\n\n if (sawType && sawType != type) {\n if (dir < 0) {\n dir = 1;\n moveOnce();\n pos.sticky = \"after\";\n }\n\n break;\n }\n\n if (type) {\n sawType = type;\n }\n\n if (dir > 0 && !moveOnce(!first)) {\n break;\n }\n }\n }\n\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n\n if (equalCursorPos(oldPos, result)) {\n result.hitSide = true;\n }\n\n return result;\n } // For relative vertical movement. Dir may be -1 or 1. Unit can be", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos\n var origDir = dir\n var lineObj = getLine(doc, pos.line)\n function findNextLine() {\n var l = pos.line + dir\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky)\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir)\n } else {\n next = moveLogically(lineObj, pos, dir)\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir) }\n else\n { return false }\n } else {\n pos = next\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce()\n } else if (unit == \"column\") {\n moveOnce(true)\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\"\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\")\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\"\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\"\n if (group && !first && !type) { type = \"s\" }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\"}\n break\n }\n\n if (type) { sawType = type }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true)\n if (equalCursorPos(oldPos, result)) { result.hitSide = true }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n\t\t var oldPos = pos;\n\t\t var origDir = dir;\n\t\t var lineObj = getLine(doc, pos.line);\n\t\t var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n\t\t function findNextLine() {\n\t\t var l = pos.line + lineDir;\n\t\t if (l < doc.first || l >= doc.first + doc.size) { return false }\n\t\t pos = new Pos(l, pos.ch, pos.sticky);\n\t\t return lineObj = getLine(doc, l)\n\t\t }\n\t\t function moveOnce(boundToLine) {\n\t\t var next;\n\t\t if (unit == \"codepoint\") {\n\t\t var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));\n\t\t if (isNaN(ch)) {\n\t\t next = null;\n\t\t } else {\n\t\t var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;\n\t\t next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);\n\t\t }\n\t\t } else if (visually) {\n\t\t next = moveVisually(doc.cm, lineObj, pos, dir);\n\t\t } else {\n\t\t next = moveLogically(lineObj, pos, dir);\n\t\t }\n\t\t if (next == null) {\n\t\t if (!boundToLine && findNextLine())\n\t\t { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n\t\t else\n\t\t { return false }\n\t\t } else {\n\t\t pos = next;\n\t\t }\n\t\t return true\n\t\t }\n\n\t\t if (unit == \"char\" || unit == \"codepoint\") {\n\t\t moveOnce();\n\t\t } else if (unit == \"column\") {\n\t\t moveOnce(true);\n\t\t } else if (unit == \"word\" || unit == \"group\") {\n\t\t var sawType = null, group = unit == \"group\";\n\t\t var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n\t\t for (var first = true;; first = false) {\n\t\t if (dir < 0 && !moveOnce(!first)) { break }\n\t\t var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n\t\t var type = isWordChar(cur, helper) ? \"w\"\n\t\t : group && cur == \"\\n\" ? \"n\"\n\t\t : !group || /\\s/.test(cur) ? null\n\t\t : \"p\";\n\t\t if (group && !first && !type) { type = \"s\"; }\n\t\t if (sawType && sawType != type) {\n\t\t if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n\t\t break\n\t\t }\n\n\t\t if (type) { sawType = type; }\n\t\t if (dir > 0 && !moveOnce(!first)) { break }\n\t\t }\n\t\t }\n\t\t var result = skipAtomic(doc, pos, oldPos, origDir, true);\n\t\t if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n\t\t return result\n\t\t }", "checkNextHorizontalPosition(typedLetter) {\n let nextPosition = null;\n let nextValue = null;\n\n typedLetter.parentWords.every(word => {\n if (word.horizontal) {\n // Look for the next x\n nextValue = typedLetter.position.x + 1;\n // Are we at the end of the word or grid?\n if (nextValue <= word.endX && nextValue < this.maxGridWidth) {\n nextPosition = { x: nextValue, y: typedLetter.position.y };\n this.direction = DirectionTypes.HORIZONTAL;\n }\n }\n return nextPosition == null;\n });\n\n return nextPosition;\n }", "move(direction) {\n if (direction === 'left') this.x -= 101; // Step left\n if (direction === 'up') this.y -= 85; // Step up\n if (direction === 'right') this.x += 101; // Step right\n if (direction === 'down') this.y += 85; // Step down\n }", "function navigateHorizontal(x, y, letters, dir, size) {\n let newY = y;\n if (dir === direction.FORWARD && y < size - 1) {\n do {\n newY++;\n } while (newY < size - 2 && letters[x][newY].isBlack)\n } else if (dir === direction.BACK && y > 0) {\n do {\n newY--;\n } while (newY > 1 && letters[x][newY].isBlack)\n }\n\n if (letters[x][newY].isBlack) {\n //we've hit start or end of row without finding a new square, so just stay put\n return y;\n } else {\n return newY;\n }\n}", "function moveVisually(line, start, dir, byUnit) {\n\t\t var bidi = getOrder(line);\n\t\t if (!bidi) return moveLogically(line, start, dir, byUnit);\n\t\t var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n\t\t var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\t\t\n\t\t for (;;) {\n\t\t if (target > part.from && target < part.to) return target;\n\t\t if (target == part.from || target == part.to) {\n\t\t if (getBidiPartAt(bidi, target) == pos) return target;\n\t\t part = bidi[pos += dir];\n\t\t return (dir > 0) == part.level % 2 ? part.to : part.from;\n\t\t } else {\n\t\t part = bidi[pos += dir];\n\t\t if (!part) return null;\n\t\t if ((dir > 0) == part.level % 2)\n\t\t target = moveInLine(line, part.to, -1, byUnit);\n\t\t else\n\t\t target = moveInLine(line, part.from, 1, byUnit);\n\t\t }\n\t\t }\n\t\t }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line)\n if (!bidi) { return moveLogically(line, start, dir, byUnit) }\n var pos = getBidiPartAt(bidi, start), part = bidi[pos]\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit)\n\n for (;;) {\n if (target > part.from && target < part.to) { return target }\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) { return target }\n part = bidi[pos += dir]\n return (dir > 0) == part.level % 2 ? part.to : part.from\n } else {\n part = bidi[pos += dir]\n if (!part) { return null }\n if ((dir > 0) == part.level % 2)\n { target = moveInLine(line, part.to, -1, byUnit) }\n else\n { target = moveInLine(line, part.from, 1, byUnit) }\n }\n }\n}", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\r\n var bidi = getOrder(line);\r\n if (!bidi) return moveLogically(line, start, dir, byUnit);\r\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\r\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\r\n\r\n for (;;) {\r\n if (target > part.from && target < part.to) return target;\r\n if (target == part.from || target == part.to) {\r\n if (getBidiPartAt(bidi, target) == pos) return target;\r\n part = bidi[pos += dir];\r\n return (dir > 0) == part.level % 2 ? part.to : part.from;\r\n } else {\r\n part = bidi[pos += dir];\r\n if (!part) return null;\r\n if ((dir > 0) == part.level % 2)\r\n target = moveInLine(line, part.to, -1, byUnit);\r\n else\r\n target = moveInLine(line, part.from, 1, byUnit);\r\n }\r\n }\r\n }", "moveWords() {\n if(this.x < 0 || this.x > width){\n this.xSpeed*=-1;}\n if(this.y < 0 || this.y > height){\n this.ySpeed*=-1;}\n this.x+=this.xSpeed;\n this.y+=this.ySpeed;\n }", "dir() {\n if (TouchInput.isPressed() && Input.isPressed('control')) {\n\n //if ($.editor.wedit = 'point' && !Input.isPressed('ctrl')) return;\n\n // RIGHT\n\n if (Haya.Mouse.x > this.mouse.x) {\n return 'right'\n }\n\n // LEFT\n\n if (Haya.Mouse.x < this.mouse.x) {\n return 'left'\n }\n\n // UP\n\n if (Haya.Mouse.y < this.mouse.y) {\n return 'up'\n }\n\n // DOWN\n if (Haya.Mouse.y > this.mouse.y) {\n return 'down'\n }\n } else {\n this.mouse.x = Haya.Mouse.x + this.threshold_mouse;\n this.mouse.y = Haya.Mouse.y + this.threshold_mouse;\n }\n\n }", "function moveVisually(line, start, dir, byUnit) {\n\t var bidi = getOrder(line);\n\t if (!bidi) return moveLogically(line, start, dir, byUnit);\n\t var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n\t var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\t\n\t for (;;) {\n\t if (target > part.from && target < part.to) return target;\n\t if (target == part.from || target == part.to) {\n\t if (getBidiPartAt(bidi, target) == pos) return target;\n\t part = bidi[pos += dir];\n\t return (dir > 0) == part.level % 2 ? part.to : part.from;\n\t } else {\n\t part = bidi[pos += dir];\n\t if (!part) return null;\n\t if ((dir > 0) == part.level % 2)\n\t target = moveInLine(line, part.to, -1, byUnit);\n\t else\n\t target = moveInLine(line, part.from, 1, byUnit);\n\t }\n\t }\n\t }", "stepDirection() {\n\n switch (this.direction) {\n case 'left':\n this.position['x'] -= 1\n break;\n\n case 'up':\n this.position['y'] -= 1\n break;\n\n case 'right':\n this.position['x'] += 1\n break;\n\n case 'down':\n this.position['y'] += 1\n break;\n }\n\n }", "function moveVisually(line, start, dir, byUnit) {\n\t var bidi = getOrder(line);\n\t if (!bidi) return moveLogically(line, start, dir, byUnit);\n\t var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n\t var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n\t for (;;) {\n\t if (target > part.from && target < part.to) return target;\n\t if (target == part.from || target == part.to) {\n\t if (getBidiPartAt(bidi, target) == pos) return target;\n\t part = bidi[pos += dir];\n\t return (dir > 0) == part.level % 2 ? part.to : part.from;\n\t } else {\n\t part = bidi[pos += dir];\n\t if (!part) return null;\n\t if ((dir > 0) == part.level % 2)\n\t target = moveInLine(line, part.to, -1, byUnit);\n\t else\n\t target = moveInLine(line, part.from, 1, byUnit);\n\t }\n\t }\n\t }", "function moveVisually(line, start, dir, byUnit) {\n\t var bidi = getOrder(line);\n\t if (!bidi) return moveLogically(line, start, dir, byUnit);\n\t var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n\t var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n\t for (;;) {\n\t if (target > part.from && target < part.to) return target;\n\t if (target == part.from || target == part.to) {\n\t if (getBidiPartAt(bidi, target) == pos) return target;\n\t part = bidi[pos += dir];\n\t return (dir > 0) == part.level % 2 ? part.to : part.from;\n\t } else {\n\t part = bidi[pos += dir];\n\t if (!part) return null;\n\t if ((dir > 0) == part.level % 2)\n\t target = moveInLine(line, part.to, -1, byUnit);\n\t else\n\t target = moveInLine(line, part.from, 1, byUnit);\n\t }\n\t }\n\t }", "function wrap_horizontal(direction){\n if(direction) {\n // this.xPos.push(this.xPos.shift());\n this.ptInfo.push(this.ptInfo.shift());\n for(var y = 0; y<this.numRows; y++) {\n this.ptInfo[this.numRows-1][y].update = true;\n }\n } else {\n // this.xPos.unshift(this.xPos.pop());\n this.ptInfo.unshift(this.ptInfo.pop());\n for(var y = 0; y<this.numRows; y++) {\n this.ptInfo[0][y].update = true;\n }\n } \n }", "textDirectionAt(pos) {\n let perLine = this.state.facet(perLineTextDirection);\n if (!perLine || pos < this.viewport.from || pos > this.viewport.to)\n return this.textDirection;\n this.readMeasured();\n return this.docView.textDirectionAt(pos);\n }", "function horizontal(direction){\n // a and d key\n // console.log(String.fromCharCode(key));\n if(index != vCount)\n return;\n var thetaRadian = toRadians( theta );\n // making adjustment for the rotation.\n var tX = Math.cos(thetaRadian) * displacementX[0]; // x component of transfromation\n var tY = Math.sin(thetaRadian) * displacementX[0]; // y component of transfromation\n\n var t;\n if (direction)\n t = [-tX, tY, 0]; // transformation based on rotatation\n else\n t = [tX, -tY, 0]; // transformation based on rotatation\n\n movePolygon(t);\n whereami();\n render();\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "_computePositionAnimationState(dir = this._getLayoutDirection()) {\n if (this._positionIndex < 0) {\n this._position = dir == 'ltr' ? 'left' : 'right';\n }\n else if (this._positionIndex > 0) {\n this._position = dir == 'ltr' ? 'right' : 'left';\n }\n else {\n this._position = 'center';\n }\n }", "function findPosV(cm, pos, dir, unit) {\n\t\t var doc = cm.doc, x = pos.left, y;\n\t\t if (unit == \"page\") {\n\t\t var pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight);\n\t\t var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n\t\t y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n\t\t } else if (unit == \"line\") {\n\t\t y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n\t\t }\n\t\t var target;\n\t\t for (;;) {\n\t\t target = coordsChar(cm, x, y);\n\t\t if (!target.outside) { break }\n\t\t if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n\t\t y += dir * 5;\n\t\t }\n\t\t return target\n\t\t }", "move(direction) {\r\n let parent = this.selection.parent;\r\n if (parent === null)\r\n return;\r\n let previous, next;\r\n if (direction < 0) {\r\n next = this.selection;\r\n previous = next.previous;\r\n if (previous === null)\r\n return;\r\n }\r\n else {\r\n previous = this.selection;\r\n next = previous.next;\r\n if (next === null)\r\n return;\r\n }\r\n parent.graphic.insertBefore(next.graphic, previous.graphic);\r\n parent.item.lastElementChild.insertBefore(next.item, previous.item);\r\n }", "logic() {\n if (this._headingX > 360 || this._headingX < -360) this._headingX = 0;\n if (this._headingY > 360 || this._headingY < -360) this._headingY = 0;\n\n if (this._x <= 0 || this._x >= this.maxXVal) {\n this._headingX = this._headingX + 180;\n }\n\n if (this._y <= 0 || this._y >= this.maxYVal) {\n this._headingY = -this._headingY;\n }\n\n this._distanceX = dir_x(2, this._headingX);\n this._distanceY = dir_y(2, this._headingY);\n\n //if (this._duration < 10) this._duration += 0.05;\n\n this._x = lerp(this._x, this._x + this._distanceX, this._duration);\n this._y = lerp(this._y, this._y + this._distanceY, this._duration);\n requestAnimationFrame(this.draw.bind(this));\n\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}" ]
[ "0.6130519", "0.6126427", "0.6126427", "0.6126427", "0.6126427", "0.6126427", "0.6126427", "0.6123693", "0.60945994", "0.60565317", "0.6052235", "0.6028111", "0.60225946", "0.60225946", "0.60225946", "0.59996206", "0.59996206", "0.5997345", "0.59868014", "0.5910987", "0.5906143", "0.5890131", "0.5890131", "0.5890131", "0.5890131", "0.5890131", "0.58873695", "0.58873695", "0.58873695", "0.58873695", "0.58873695", "0.58873695", "0.58873695", "0.58873695", "0.58873695", "0.58873695", "0.58873695", "0.5871745", "0.5833696", "0.580521", "0.5796464", "0.57660735", "0.5731949", "0.57050514", "0.5677683", "0.5671254", "0.5671254", "0.5671254", "0.5671254", "0.5671254", "0.5671254", "0.5671254", "0.5671254", "0.5671254", "0.5671254", "0.5671254", "0.5658975", "0.5657712", "0.5636218", "0.5584544", "0.5573618", "0.5573215", "0.5573215", "0.5476824", "0.54060113", "0.5405921", "0.5404938", "0.5404938", "0.5404845", "0.5404845", "0.5404845", "0.5404845", "0.5404845", "0.5404845", "0.5404845", "0.5404845", "0.5404845", "0.5404845", "0.5404845", "0.5404845", "0.5404845", "0.5404845", "0.5404845", "0.5390273", "0.5372181", "0.5354131", "0.53416157", "0.53077215", "0.53077215", "0.53077215", "0.53077215", "0.53077215" ]
0.5976428
24
For relative vertical movement. Dir may be 1 or 1. Unit can be "page" or "line". The resulting position will have a hitSide=true property if it reached the end of the document.
function findPosV(cm, pos, dir, unit) { var doc = cm.doc, x = pos.left, y; if (unit == "page") { var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight); var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3); y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount; } else if (unit == "line") { y = dir > 0 ? pos.bottom + 3 : pos.top - 3; } var target; for (;;) { target = coordsChar(cm, x, y); if (!target.outside) { break } if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break } y += dir * 5; } return target }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }", "function findPosV(cm, pos, dir, unit) {\r\n var doc = cm.doc, x = pos.left, y;\r\n if (unit == \"page\") {\r\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\r\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\r\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\r\n\r\n } else if (unit == \"line\") {\r\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\r\n }\r\n var target;\r\n for (;;) {\r\n target = coordsChar(cm, x, y);\r\n if (!target.outside) { break }\r\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\r\n y += dir * 5;\r\n }\r\n return target\r\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight)\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3)\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3\n }\n var target\n for (;;) {\n target = coordsChar(cm, x, y)\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight)\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3)\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3\n }\n var target\n for (;;) {\n target = coordsChar(cm, x, y)\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5\n }\n return target\n}", "function findPosV(cm, pos, dir, unit) {\n\t\t var doc = cm.doc, x = pos.left, y;\n\t\t if (unit == \"page\") {\n\t\t var pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight);\n\t\t var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n\t\t y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n\t\t } else if (unit == \"line\") {\n\t\t y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n\t\t }\n\t\t var target;\n\t\t for (;;) {\n\t\t target = coordsChar(cm, x, y);\n\t\t if (!target.outside) { break }\n\t\t if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n\t\t y += dir * 5;\n\t\t }\n\t\t return target\n\t\t }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n for (;;) {\n var target = coordsChar(cm, x, y);\n if (!target.outside) break;\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }\n y += dir * 5;\n }\n return target;\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n for (;;) {\n var target = coordsChar(cm, x, y);\n if (!target.outside) break;\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }\n y += dir * 5;\n }\n return target;\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n for (;;) {\n var target = coordsChar(cm, x, y);\n if (!target.outside) break;\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }\n y += dir * 5;\n }\n return target;\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n for (;;) {\n var target = coordsChar(cm, x, y);\n if (!target.outside) break;\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }\n y += dir * 5;\n }\n return target;\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n for (;;) {\n var target = coordsChar(cm, x, y);\n if (!target.outside) break;\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }\n y += dir * 5;\n }\n return target;\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n for (;;) {\n var target = coordsChar(cm, x, y);\n if (!target.outside) break;\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }\n y += dir * 5;\n }\n return target;\n }", "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n for (;;) {\n var target = coordsChar(cm, x, y);\n if (!target.outside) break;\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }\n y += dir * 5;\n }\n return target;\n }", "function findPosV(cm, pos, dir, unit) {\r\n var doc = cm.doc, x = pos.left, y;\r\n if (unit == \"page\") {\r\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\r\n y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));\r\n } else if (unit == \"line\") {\r\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\r\n }\r\n for (;;) {\r\n var target = coordsChar(cm, x, y);\r\n if (!target.outside) break;\r\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }\r\n y += dir * 5;\r\n }\r\n return target;\r\n }", "function findPosV(cm, pos, dir, unit) {\n\t var doc = cm.doc, x = pos.left, y;\n\t if (unit == \"page\") {\n\t var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n\t var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n\t y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\t } else if (unit == \"line\") {\n\t y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n\t }\n\t for (;;) {\n\t var target = coordsChar(cm, x, y);\n\t if (!target.outside) break;\n\t if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }\n\t y += dir * 5;\n\t }\n\t return target;\n\t }", "function findPosV(cm, pos, dir, unit) {\n\t\t var doc = cm.doc, x = pos.left, y;\n\t\t if (unit == \"page\") {\n\t\t var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n\t\t y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));\n\t\t } else if (unit == \"line\") {\n\t\t y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n\t\t }\n\t\t for (;;) {\n\t\t var target = coordsChar(cm, x, y);\n\t\t if (!target.outside) break;\n\t\t if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }\n\t\t y += dir * 5;\n\t\t }\n\t\t return target;\n\t\t }", "function findPosV(cm, pos, dir, unit) {\n\t var doc = cm.doc, x = pos.left, y;\n\t if (unit == \"page\") {\n\t var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n\t y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));\n\t } else if (unit == \"line\") {\n\t y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n\t }\n\t for (;;) {\n\t var target = coordsChar(cm, x, y);\n\t if (!target.outside) break;\n\t if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }\n\t y += dir * 5;\n\t }\n\t return target;\n\t }", "function findPosV(cm, pos, dir, unit) {\n\t var doc = cm.doc, x = pos.left, y;\n\t if (unit == \"page\") {\n\t var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n\t y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));\n\t } else if (unit == \"line\") {\n\t y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n\t }\n\t for (;;) {\n\t var target = coordsChar(cm, x, y);\n\t if (!target.outside) break;\n\t if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }\n\t y += dir * 5;\n\t }\n\t return target;\n\t }", "function _findPosV(cm, pos, dir, unit) {\n var doc = cm.doc,\n x = pos.left,\n y;\n\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n\n var target;\n\n for (;;) {\n target = _coordsChar(cm, x, y);\n\n if (!target.outside) {\n break;\n }\n\n if (dir < 0 ? y <= 0 : y >= doc.height) {\n target.hitSide = true;\n break;\n }\n\n y += dir * 5;\n }\n\n return target;\n } // CONTENTEDITABLE INPUT STYLE", "move(dir){\n this.y += this.speed * dir;\n this.y = constrain(this.y, 0, height - this.h);\n }", "function findPosH(doc, pos, dir, unit, visually) {\n\t\t var oldPos = pos;\n\t\t var origDir = dir;\n\t\t var lineObj = getLine(doc, pos.line);\n\t\t var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n\t\t function findNextLine() {\n\t\t var l = pos.line + lineDir;\n\t\t if (l < doc.first || l >= doc.first + doc.size) { return false }\n\t\t pos = new Pos(l, pos.ch, pos.sticky);\n\t\t return lineObj = getLine(doc, l)\n\t\t }\n\t\t function moveOnce(boundToLine) {\n\t\t var next;\n\t\t if (unit == \"codepoint\") {\n\t\t var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));\n\t\t if (isNaN(ch)) {\n\t\t next = null;\n\t\t } else {\n\t\t var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;\n\t\t next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);\n\t\t }\n\t\t } else if (visually) {\n\t\t next = moveVisually(doc.cm, lineObj, pos, dir);\n\t\t } else {\n\t\t next = moveLogically(lineObj, pos, dir);\n\t\t }\n\t\t if (next == null) {\n\t\t if (!boundToLine && findNextLine())\n\t\t { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n\t\t else\n\t\t { return false }\n\t\t } else {\n\t\t pos = next;\n\t\t }\n\t\t return true\n\t\t }\n\n\t\t if (unit == \"char\" || unit == \"codepoint\") {\n\t\t moveOnce();\n\t\t } else if (unit == \"column\") {\n\t\t moveOnce(true);\n\t\t } else if (unit == \"word\" || unit == \"group\") {\n\t\t var sawType = null, group = unit == \"group\";\n\t\t var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n\t\t for (var first = true;; first = false) {\n\t\t if (dir < 0 && !moveOnce(!first)) { break }\n\t\t var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n\t\t var type = isWordChar(cur, helper) ? \"w\"\n\t\t : group && cur == \"\\n\" ? \"n\"\n\t\t : !group || /\\s/.test(cur) ? null\n\t\t : \"p\";\n\t\t if (group && !first && !type) { type = \"s\"; }\n\t\t if (sawType && sawType != type) {\n\t\t if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n\t\t break\n\t\t }\n\n\t\t if (type) { sawType = type; }\n\t\t if (dir > 0 && !moveOnce(!first)) { break }\n\t\t }\n\t\t }\n\t\t var result = skipAtomic(doc, pos, oldPos, origDir, true);\n\t\t if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n\t\t return result\n\t\t }", "function findPosH(doc, pos, dir, unit, visually) {\n\t\t var line = pos.line, ch = pos.ch, origDir = dir;\n\t\t var lineObj = getLine(doc, line);\n\t\t function findNextLine() {\n\t\t var l = line + dir;\n\t\t if (l < doc.first || l >= doc.first + doc.size) return false\n\t\t line = l;\n\t\t return lineObj = getLine(doc, l);\n\t\t }\n\t\t function moveOnce(boundToLine) {\n\t\t var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n\t\t if (next == null) {\n\t\t if (!boundToLine && findNextLine()) {\n\t\t if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n\t\t else ch = dir < 0 ? lineObj.text.length : 0;\n\t\t } else return false\n\t\t } else ch = next;\n\t\t return true;\n\t\t }\n\t\t\n\t\t if (unit == \"char\") {\n\t\t moveOnce()\n\t\t } else if (unit == \"column\") {\n\t\t moveOnce(true)\n\t\t } else if (unit == \"word\" || unit == \"group\") {\n\t\t var sawType = null, group = unit == \"group\";\n\t\t var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n\t\t for (var first = true;; first = false) {\n\t\t if (dir < 0 && !moveOnce(!first)) break;\n\t\t var cur = lineObj.text.charAt(ch) || \"\\n\";\n\t\t var type = isWordChar(cur, helper) ? \"w\"\n\t\t : group && cur == \"\\n\" ? \"n\"\n\t\t : !group || /\\s/.test(cur) ? null\n\t\t : \"p\";\n\t\t if (group && !first && !type) type = \"s\";\n\t\t if (sawType && sawType != type) {\n\t\t if (dir < 0) {dir = 1; moveOnce();}\n\t\t break;\n\t\t }\n\t\t\n\t\t if (type) sawType = type;\n\t\t if (dir > 0 && !moveOnce(!first)) break;\n\t\t }\n\t\t }\n\t\t var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true);\n\t\t if (!cmp(pos, result)) result.hitSide = true;\n\t\t return result;\n\t\t }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));\n if (isNaN(ch)) {\n next = null;\n } else {\n var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;\n next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);\n }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));\n if (isNaN(ch)) {\n next = null;\n } else {\n var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;\n next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);\n }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));\n if (isNaN(ch)) {\n next = null;\n } else {\n var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;\n next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);\n }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));\n if (isNaN(ch)) {\n next = null;\n } else {\n var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;\n next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);\n }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));\n if (isNaN(ch)) {\n next = null;\n } else {\n var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;\n next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);\n }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (unit > 0 ? 0 : -1));\n if (isNaN(ch)) { next = null; }\n else { next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (ch >= 0xD800 && ch < 0xDC00 ? 2 : 1))),\n -dir); }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir\n var lineObj = getLine(doc, line)\n function findNextLine() {\n var l = line + dir\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n line = l\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true)\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) { ch = (dir < 0 ? lineRight : lineLeft)(lineObj) }\n else { ch = dir < 0 ? lineObj.text.length : 0 }\n } else { return false }\n } else { ch = next }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce()\n } else if (unit == \"column\") {\n moveOnce(true)\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\"\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\")\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(ch) || \"\\n\"\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\"\n if (group && !first && !type) { type = \"s\" }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce()}\n break\n }\n\n if (type) { sawType = type }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true)\n if (!cmp(pos, result)) { result.hitSide = true }\n return result\n}", "function moveVisually(line, start, dir, byUnit) {\n\t\t var bidi = getOrder(line);\n\t\t if (!bidi) return moveLogically(line, start, dir, byUnit);\n\t\t var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n\t\t var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\t\t\n\t\t for (;;) {\n\t\t if (target > part.from && target < part.to) return target;\n\t\t if (target == part.from || target == part.to) {\n\t\t if (getBidiPartAt(bidi, target) == pos) return target;\n\t\t part = bidi[pos += dir];\n\t\t return (dir > 0) == part.level % 2 ? part.to : part.from;\n\t\t } else {\n\t\t part = bidi[pos += dir];\n\t\t if (!part) return null;\n\t\t if ((dir > 0) == part.level % 2)\n\t\t target = moveInLine(line, part.to, -1, byUnit);\n\t\t else\n\t\t target = moveInLine(line, part.from, 1, byUnit);\n\t\t }\n\t\t }\n\t\t }", "function moveVisually(line, start, dir, byUnit) {\r\n var bidi = getOrder(line);\r\n if (!bidi) return moveLogically(line, start, dir, byUnit);\r\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\r\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\r\n\r\n for (;;) {\r\n if (target > part.from && target < part.to) return target;\r\n if (target == part.from || target == part.to) {\r\n if (getBidiPartAt(bidi, target) == pos) return target;\r\n part = bidi[pos += dir];\r\n return (dir > 0) == part.level % 2 ? part.to : part.from;\r\n } else {\r\n part = bidi[pos += dir];\r\n if (!part) return null;\r\n if ((dir > 0) == part.level % 2)\r\n target = moveInLine(line, part.to, -1, byUnit);\r\n else\r\n target = moveInLine(line, part.from, 1, byUnit);\r\n }\r\n }\r\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return false\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return false\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") {\n moveOnce()\n } else if (unit == \"column\") {\n moveOnce(true)\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true);\n if (!cmp(pos, result)) result.hitSide = true;\n return result;\n }", "move(dir = 1){\n this.x += this.xspeed * dir;\n this.y += this.yspeed * dir;\n }", "function findPosH(doc, pos, dir, unit, visually) {\r\n var oldPos = pos;\r\n var origDir = dir;\r\n var lineObj = getLine(doc, pos.line);\r\n function findNextLine() {\r\n var l = pos.line + dir;\r\n if (l < doc.first || l >= doc.first + doc.size) { return false }\r\n pos = new Pos(l, pos.ch, pos.sticky);\r\n return lineObj = getLine(doc, l)\r\n }\r\n function moveOnce(boundToLine) {\r\n var next;\r\n if (visually) {\r\n next = moveVisually(doc.cm, lineObj, pos, dir);\r\n } else {\r\n next = moveLogically(lineObj, pos, dir);\r\n }\r\n if (next == null) {\r\n if (!boundToLine && findNextLine())\r\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\r\n else\r\n { return false }\r\n } else {\r\n pos = next;\r\n }\r\n return true\r\n }\r\n\r\n if (unit == \"char\") {\r\n moveOnce();\r\n } else if (unit == \"column\") {\r\n moveOnce(true);\r\n } else if (unit == \"word\" || unit == \"group\") {\r\n var sawType = null, group = unit == \"group\";\r\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\r\n for (var first = true;; first = false) {\r\n if (dir < 0 && !moveOnce(!first)) { break }\r\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\r\n var type = isWordChar(cur, helper) ? \"w\"\r\n : group && cur == \"\\n\" ? \"n\"\r\n : !group || /\\s/.test(cur) ? null\r\n : \"p\";\r\n if (group && !first && !type) { type = \"s\"; }\r\n if (sawType && sawType != type) {\r\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\r\n break\r\n }\r\n\r\n if (type) { sawType = type; }\r\n if (dir > 0 && !moveOnce(!first)) { break }\r\n }\r\n }\r\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\r\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\r\n return result\r\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }", "function moveVisually(line, start, dir, byUnit) {\n\t var bidi = getOrder(line);\n\t if (!bidi) return moveLogically(line, start, dir, byUnit);\n\t var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n\t var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n\t for (;;) {\n\t if (target > part.from && target < part.to) return target;\n\t if (target == part.from || target == part.to) {\n\t if (getBidiPartAt(bidi, target) == pos) return target;\n\t part = bidi[pos += dir];\n\t return (dir > 0) == part.level % 2 ? part.to : part.from;\n\t } else {\n\t part = bidi[pos += dir];\n\t if (!part) return null;\n\t if ((dir > 0) == part.level % 2)\n\t target = moveInLine(line, part.to, -1, byUnit);\n\t else\n\t target = moveInLine(line, part.from, 1, byUnit);\n\t }\n\t }\n\t }", "function moveVisually(line, start, dir, byUnit) {\n\t var bidi = getOrder(line);\n\t if (!bidi) return moveLogically(line, start, dir, byUnit);\n\t var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n\t var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n\t for (;;) {\n\t if (target > part.from && target < part.to) return target;\n\t if (target == part.from || target == part.to) {\n\t if (getBidiPartAt(bidi, target) == pos) return target;\n\t part = bidi[pos += dir];\n\t return (dir > 0) == part.level % 2 ? part.to : part.from;\n\t } else {\n\t part = bidi[pos += dir];\n\t if (!part) return null;\n\t if ((dir > 0) == part.level % 2)\n\t target = moveInLine(line, part.to, -1, byUnit);\n\t else\n\t target = moveInLine(line, part.from, 1, byUnit);\n\t }\n\t }\n\t }", "function findPosH(doc, pos, dir, unit, visually) {\r\n var line = pos.line, ch = pos.ch, origDir = dir;\r\n var lineObj = getLine(doc, line);\r\n var possible = true;\r\n function findNextLine() {\r\n var l = line + dir;\r\n if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\r\n line = l;\r\n return lineObj = getLine(doc, l);\r\n }\r\n function moveOnce(boundToLine) {\r\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\r\n if (next == null) {\r\n if (!boundToLine && findNextLine()) {\r\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\r\n else ch = dir < 0 ? lineObj.text.length : 0;\r\n } else return (possible = false);\r\n } else ch = next;\r\n return true;\r\n }\r\n\r\n if (unit == \"char\") moveOnce();\r\n else if (unit == \"column\") moveOnce(true);\r\n else if (unit == \"word\" || unit == \"group\") {\r\n var sawType = null, group = unit == \"group\";\r\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\r\n for (var first = true;; first = false) {\r\n if (dir < 0 && !moveOnce(!first)) break;\r\n var cur = lineObj.text.charAt(ch) || \"\\n\";\r\n var type = isWordChar(cur, helper) ? \"w\"\r\n : group && cur == \"\\n\" ? \"n\"\r\n : !group || /\\s/.test(cur) ? null\r\n : \"p\";\r\n if (group && !first && !type) type = \"s\";\r\n if (sawType && sawType != type) {\r\n if (dir < 0) {dir = 1; moveOnce();}\r\n break;\r\n }\r\n\r\n if (type) sawType = type;\r\n if (dir > 0 && !moveOnce(!first)) break;\r\n }\r\n }\r\n var result = skipAtomic(doc, Pos(line, ch), origDir, true);\r\n if (!possible) result.hitSide = true;\r\n return result;\r\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var moveOneUnit = byUnit ? function(pos, dir) {\n do pos += dir;\n while (pos > 0 && isExtendingChar.test(line.text.charAt(pos)));\n return pos;\n } : function(pos, dir) { return pos + dir; };\n var linedir = bidi[0].level;\n for (var i = 0; i < bidi.length; ++i) {\n var part = bidi[i], sticky = part.level % 2 == linedir;\n if ((part.from < start && part.to > start) ||\n (sticky && (part.from == start || part.to == start))) break;\n }\n var target = moveOneUnit(start, part.level % 2 ? -dir : dir);\n\n while (target != null) {\n if (part.level % 2 == linedir) {\n if (target < part.from || target > part.to) {\n part = bidi[i += dir];\n target = part && (dir > 0 == part.level % 2 ? moveOneUnit(part.to, -1) : moveOneUnit(part.from, 1));\n } else break;\n } else {\n if (target == bidiLeft(part)) {\n part = bidi[--i];\n target = part && bidiRight(part);\n } else if (target == bidiRight(part)) {\n part = bidi[++i];\n target = part && bidiLeft(part);\n } else break;\n }\n }\n\n return target < 0 || target > line.text.length ? null : target;\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var moveOneUnit = byUnit ? function(pos, dir) {\n do pos += dir;\n while (pos > 0 && isExtendingChar.test(line.text.charAt(pos)));\n return pos;\n } : function(pos, dir) { return pos + dir; };\n var linedir = bidi[0].level;\n for (var i = 0; i < bidi.length; ++i) {\n var part = bidi[i], sticky = part.level % 2 == linedir;\n if ((part.from < start && part.to > start) ||\n (sticky && (part.from == start || part.to == start))) break;\n }\n var target = moveOneUnit(start, part.level % 2 ? -dir : dir);\n\n while (target != null) {\n if (part.level % 2 == linedir) {\n if (target < part.from || target > part.to) {\n part = bidi[i += dir];\n target = part && (dir > 0 == part.level % 2 ? moveOneUnit(part.to, -1) : moveOneUnit(part.from, 1));\n } else break;\n } else {\n if (target == bidiLeft(part)) {\n part = bidi[--i];\n target = part && bidiRight(part);\n } else if (target == bidiRight(part)) {\n part = bidi[++i];\n target = part && bidiLeft(part);\n } else break;\n }\n }\n\n return target < 0 || target > line.text.length ? null : target;\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var moveOneUnit = byUnit ? function(pos, dir) {\n do pos += dir;\n while (pos > 0 && isExtendingChar.test(line.text.charAt(pos)));\n return pos;\n } : function(pos, dir) { return pos + dir; };\n var linedir = bidi[0].level;\n for (var i = 0; i < bidi.length; ++i) {\n var part = bidi[i], sticky = part.level % 2 == linedir;\n if ((part.from < start && part.to > start) ||\n (sticky && (part.from == start || part.to == start))) break;\n }\n var target = moveOneUnit(start, part.level % 2 ? -dir : dir);\n\n while (target != null) {\n if (part.level % 2 == linedir) {\n if (target < part.from || target > part.to) {\n part = bidi[i += dir];\n target = part && (dir > 0 == part.level % 2 ? moveOneUnit(part.to, -1) : moveOneUnit(part.from, 1));\n } else break;\n } else {\n if (target == bidiLeft(part)) {\n part = bidi[--i];\n target = part && bidiRight(part);\n } else if (target == bidiRight(part)) {\n part = bidi[++i];\n target = part && bidiLeft(part);\n } else break;\n }\n }\n\n return target < 0 || target > line.text.length ? null : target;\n }", "function moveVisually(line, start, dir, byUnit) {\n\t var bidi = getOrder(line);\n\t if (!bidi) return moveLogically(line, start, dir, byUnit);\n\t var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n\t var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\t\n\t for (;;) {\n\t if (target > part.from && target < part.to) return target;\n\t if (target == part.from || target == part.to) {\n\t if (getBidiPartAt(bidi, target) == pos) return target;\n\t part = bidi[pos += dir];\n\t return (dir > 0) == part.level % 2 ? part.to : part.from;\n\t } else {\n\t part = bidi[pos += dir];\n\t if (!part) return null;\n\t if ((dir > 0) == part.level % 2)\n\t target = moveInLine(line, part.to, -1, byUnit);\n\t else\n\t target = moveInLine(line, part.from, 1, byUnit);\n\t }\n\t }\n\t }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n var possible = true;\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return (possible = false);\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), origDir, true);\n if (!possible) result.hitSide = true;\n return result;\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n var possible = true;\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return (possible = false);\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), origDir, true);\n if (!possible) result.hitSide = true;\n return result;\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n var possible = true;\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return (possible = false);\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), origDir, true);\n if (!possible) result.hitSide = true;\n return result;\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n var possible = true;\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return (possible = false);\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), origDir, true);\n if (!possible) result.hitSide = true;\n return result;\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n var possible = true;\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return (possible = false);\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), origDir, true);\n if (!possible) result.hitSide = true;\n return result;\n }", "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n var possible = true;\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return (possible = false);\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") moveOnce();\n else if (unit == \"column\") moveOnce(true);\n else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), origDir, true);\n if (!possible) result.hitSide = true;\n return result;\n }", "function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line)\n if (!bidi) { return moveLogically(line, start, dir, byUnit) }\n var pos = getBidiPartAt(bidi, start), part = bidi[pos]\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit)\n\n for (;;) {\n if (target > part.from && target < part.to) { return target }\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) { return target }\n part = bidi[pos += dir]\n return (dir > 0) == part.level % 2 ? part.to : part.from\n } else {\n part = bidi[pos += dir]\n if (!part) { return null }\n if ((dir > 0) == part.level % 2)\n { target = moveInLine(line, part.to, -1, byUnit) }\n else\n { target = moveInLine(line, part.from, 1, byUnit) }\n }\n }\n}", "function findPosH(doc, pos, dir, unit, visually) {\n\t var line = pos.line, ch = pos.ch, origDir = dir;\n\t var lineObj = getLine(doc, line);\n\t function findNextLine() {\n\t var l = line + dir;\n\t if (l < doc.first || l >= doc.first + doc.size) return false\n\t line = l;\n\t return lineObj = getLine(doc, l);\n\t }\n\t function moveOnce(boundToLine) {\n\t var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n\t if (next == null) {\n\t if (!boundToLine && findNextLine()) {\n\t if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n\t else ch = dir < 0 ? lineObj.text.length : 0;\n\t } else return false\n\t } else ch = next;\n\t return true;\n\t }\n\t\n\t if (unit == \"char\") {\n\t moveOnce()\n\t } else if (unit == \"column\") {\n\t moveOnce(true)\n\t } else if (unit == \"word\" || unit == \"group\") {\n\t var sawType = null, group = unit == \"group\";\n\t var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n\t for (var first = true;; first = false) {\n\t if (dir < 0 && !moveOnce(!first)) break;\n\t var cur = lineObj.text.charAt(ch) || \"\\n\";\n\t var type = isWordChar(cur, helper) ? \"w\"\n\t : group && cur == \"\\n\" ? \"n\"\n\t : !group || /\\s/.test(cur) ? null\n\t : \"p\";\n\t if (group && !first && !type) type = \"s\";\n\t if (sawType && sawType != type) {\n\t if (dir < 0) {dir = 1; moveOnce();}\n\t break;\n\t }\n\t\n\t if (type) sawType = type;\n\t if (dir > 0 && !moveOnce(!first)) break;\n\t }\n\t }\n\t var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true);\n\t if (!cmp(pos, result)) result.hitSide = true;\n\t return result;\n\t }", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}", "function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}" ]
[ "0.69151056", "0.69151056", "0.6821693", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.68065315", "0.68065315", "0.67795277", "0.67302203", "0.67302203", "0.67302203", "0.67302203", "0.67302203", "0.67302203", "0.67302203", "0.67164505", "0.6700995", "0.6643348", "0.66038597", "0.66038597", "0.645812", "0.6232971", "0.5738895", "0.5732456", "0.569551", "0.569551", "0.569551", "0.569551", "0.569551", "0.56613064", "0.5652798", "0.56351817", "0.56209457", "0.5615584", "0.5615584", "0.5615584", "0.5615584", "0.5615584", "0.5615584", "0.5615584", "0.5615584", "0.5615584", "0.5615584", "0.5615584", "0.5583896", "0.5569996", "0.5561711", "0.55567807", "0.55567807", "0.55567807", "0.55567807", "0.55567807", "0.55567807", "0.55567807", "0.55567807", "0.55567807", "0.5554895", "0.5554895", "0.5551053", "0.5546133", "0.5546133", "0.5546133", "0.55460775", "0.5538627", "0.5538627", "0.5538627", "0.5538627", "0.5538627", "0.5538627", "0.5535571", "0.5535519", "0.5525486", "0.5525486", "0.5525486", "0.5525486", "0.5525486", "0.5525486" ]
0.6870279
11
Selectall will be greyed out if there's nothing to select, so this adds a zerowidth space so that we can later check whether it got selected.
function prepareSelectAllHack() { if (te.selectionStart != null) { var selected = cm.somethingSelected(); var extval = "\u200b" + (selected ? te.value : ""); te.value = "\u21da"; // Used to catch context-menu undo te.value = extval; input.prevInput = selected ? "" : "\u200b"; te.selectionStart = 1; te.selectionEnd = extval.length; // Re-set this, in case some other handler touched the // selection in the meantime. display.selForContextMenu = cm.doc.sel; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectAll()\r\n\t\t{\r\n\t\t\tthis.focus();\r\n\t\t\tthis.select();\r\n\t\t}", "function show_select_all(){\r\n var th = getPatternResult(PATTERN['select_all']).snapshotItem(0);\r\n if (th == null) \r\n return;\r\n th.innerHTML = '<input type=\"checkbox\"/>';\r\n th.setAttribute('title', 'Select All');\r\n th.firstChild.setAttribute('onclick', '');//apparently Opera does not add event listeners unless there is already an onclick attribute\r\n th.firstChild.addEventListener('click', function(){\r\n var checkboxes = getPatternResult(PATTERN['all_checkboxes']);\r\n for (var i = 0; i < checkboxes.snapshotLength; i++) \r\n checkboxes.snapshotItem(i).checked = this.checked;\r\n }, true);\r\n}", "function prepareSelectAllHack() {\n if (display.input.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\n display.prevInput = selected ? \"\" : \"\\u200b\";\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (display.input.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\n display.prevInput = selected ? \"\" : \"\\u200b\";\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (display.input.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\n display.prevInput = selected ? \"\" : \"\\u200b\";\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (display.input.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\n display.prevInput = selected ? \"\" : \"\\u200b\";\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (display.input.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\n display.prevInput = selected ? \"\" : \"\\u200b\";\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\r\n if (display.input.selectionStart != null) {\r\n var selected = cm.somethingSelected();\r\n var extval = display.input.value = \"\\u200b\" + (selected ? display.input.value : \"\");\r\n display.prevInput = selected ? \"\" : \"\\u200b\";\r\n display.input.selectionStart = 1; display.input.selectionEnd = extval.length;\r\n // Re-set this, in case some other handler touched the\r\n // selection in the meantime.\r\n display.selForContextMenu = cm.doc.sel;\r\n }\r\n }", "selectAll() {\n this._setAllOptionsSelected(true);\n }", "function prepareSelectAllHack() {\n\t\t if (te.selectionStart != null) {\n\t\t var selected = cm.somethingSelected();\n\t\t var extval = \"\\u200b\" + (selected ? te.value : \"\");\n\t\t te.value = \"\\u21da\"; // Used to catch context-menu undo\n\t\t te.value = extval;\n\t\t input.prevInput = selected ? \"\" : \"\\u200b\";\n\t\t te.selectionStart = 1; te.selectionEnd = extval.length;\n\t\t // Re-set this, in case some other handler touched the\n\t\t // selection in the meantime.\n\t\t display.selForContextMenu = cm.doc.sel;\n\t\t }\n\t\t }", "function prepareSelectAllHack() {\n\t if (te.selectionStart != null) {\n\t var selected = cm.somethingSelected();\n\t var extval = \"\\u200b\" + (selected ? te.value : \"\");\n\t te.value = \"\\u21da\"; // Used to catch context-menu undo\n\t te.value = extval;\n\t input.prevInput = selected ? \"\" : \"\\u200b\";\n\t te.selectionStart = 1; te.selectionEnd = extval.length;\n\t // Re-set this, in case some other handler touched the\n\t // selection in the meantime.\n\t display.selForContextMenu = cm.doc.sel;\n\t }\n\t }", "function prepareSelectAllHack() {\n\t if (te.selectionStart != null) {\n\t var selected = cm.somethingSelected();\n\t var extval = \"\\u200b\" + (selected ? te.value : \"\");\n\t te.value = \"\\u21da\"; // Used to catch context-menu undo\n\t te.value = extval;\n\t input.prevInput = selected ? \"\" : \"\\u200b\";\n\t te.selectionStart = 1; te.selectionEnd = extval.length;\n\t // Re-set this, in case some other handler touched the\n\t // selection in the meantime.\n\t display.selForContextMenu = cm.doc.sel;\n\t }\n\t }", "function prepareSelectAllHack() {\n\t if (te.selectionStart != null) {\n\t var selected = cm.somethingSelected();\n\t var extval = \"\\u200b\" + (selected ? te.value : \"\");\n\t te.value = \"\\u21da\"; // Used to catch context-menu undo\n\t te.value = extval;\n\t input.prevInput = selected ? \"\" : \"\\u200b\";\n\t te.selectionStart = 1; te.selectionEnd = extval.length;\n\t // Re-set this, in case some other handler touched the\n\t // selection in the meantime.\n\t display.selForContextMenu = cm.doc.sel;\n\t }\n\t }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected()\n var extval = \"\\u200b\" + (selected ? te.value : \"\")\n te.value = \"\\u21da\" // Used to catch context-menu undo\n te.value = extval\n input.prevInput = selected ? \"\" : \"\\u200b\"\n te.selectionStart = 1; te.selectionEnd = extval.length\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected()\n var extval = \"\\u200b\" + (selected ? te.value : \"\")\n te.value = \"\\u21da\" // Used to catch context-menu undo\n te.value = extval\n input.prevInput = selected ? \"\" : \"\\u200b\"\n te.selectionStart = 1; te.selectionEnd = extval.length\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function selectAll($textbox) {\n var textElem = $textbox[0];\n if (textElem.setSelectionRange) {\n var length = $textbox.val().length;\n textElem.setSelectionRange(0, length);\n } else if (textElem.createTextRange) {\n var range = textElem.createTextRange();\n range.execCommand(\"SelectAll\");\n range.select();\n }\n }", "function prepareSelectAllHack() {\n\t\t if (te.selectionStart != null) {\n\t\t var selected = cm.somethingSelected();\n\t\t var extval = \"\\u200b\" + (selected ? te.value : \"\");\n\t\t te.value = \"\\u21da\"; // Used to catch context-menu undo\n\t\t te.value = extval;\n\t\t input.prevInput = selected ? \"\" : \"\\u200b\";\n\t\t te.selectionStart = 1; te.selectionEnd = extval.length;\n\t\t // Re-set this, in case some other handler touched the\n\t\t // selection in the meantime.\n\t\t display.selForContextMenu = cm.doc.sel;\n\t\t }\n\t\t }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\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}", "function js_select_all(formobj)\n{\n\texclude = new Array();\n\texclude[0] = 'selectall';\n\tjs_toggle_all(formobj, 'select-one', '', exclude, formobj.selectall.selectedIndex);\n}", "unSelectAll () { this.toggSelAll(false); }", "function prepareSelectAllHack() {\r\n if (te.selectionStart != null) {\r\n var selected = cm.somethingSelected();\r\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\r\n te.value = \"\\u21da\"; // Used to catch context-menu undo\r\n te.value = extval;\r\n input.prevInput = selected ? \"\" : \"\\u200b\";\r\n te.selectionStart = 1; te.selectionEnd = extval.length;\r\n // Re-set this, in case some other handler touched the\r\n // selection in the meantime.\r\n display.selForContextMenu = cm.doc.sel;\r\n }\r\n }", "function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200B\" + (selected ? te.value : \"\");\n te.value = \"\\u21DA\"; // Used to catch context-menu undo\n\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200B\";\n te.selectionStart = 1;\n te.selectionEnd = extval.length; // Re-set this, in case some other handler touched the\n // selection in the meantime.\n\n display.selForContextMenu = cm.doc.sel;\n }\n }", "selectAll () { this.toggSelAll(true); }", "function updateSelectAllButtonState(){\r\n\t\t\r\n\t\tvar objButton = g_objPanel.find(\".uc-button-select-all\");\r\n\t\t\r\n\t\tvar numItems = getNumItems();\r\n\t\t\r\n\t\tif(numItems == 0){\r\n\t\t\tobjButton.addClass(\"button-disabled\");\r\n\t\t\t\r\n\t\t\tobjButton.html(objButton.data(\"textselect\"));\r\n\t\t\treturn(false);\r\n\t\t}\r\n\t\t\r\n\t\tobjButton.removeClass(\"button-disabled\");\r\n\t\t\r\n\t\tvar numSelected = getNumSelectedItems();\r\n\t\tif(numSelected != numItems){\r\n\t\t\tobjButton.html(objButton.data(\"textselect\"));\r\n\t\t}else{\r\n\t\t\tobjButton.html(objButton.data(\"textunselect\"));\r\n\t\t}\r\n\t\t\r\n\t}", "selectAll() {\n this._model.isSelectAllActive = true;\n this.refresh();\n this._onSelectionChange.fire();\n }", "selectAll() {\n if (this.selectionMode === 'multiple') {\n this.state.setSelectedKeys('all');\n }\n }", "toggleSelectAll() {\n if (this.isSelectAll) {\n this.clearSelection();\n } else {\n this.selectAll();\n }\n }", "function selectAll(id){\n let sel, range;\n let el = document.getElementById(id); //get element id\n if (window.getSelection && document.createRange) { //Browser compatibility\n sel = window.getSelection();\n if(sel.toString() == ''){ //no text selection\n window.setTimeout(function(){\n range = document.createRange(); //range object\n range.selectNodeContents(el); //sets Range\n sel.removeAllRanges(); //remove all ranges from selection\n sel.addRange(range);//add Range to a Selection.\n },1);\n }\n }else if (document.selection) { //older ie\n sel = document.selection.createRange();\n if(sel.text == ''){ //no text selection\n range = document.body.createTextRange();//Creates TextRange object\n range.moveToElementText(el);//sets Range\n range.select(); //make selection.\n }\n }\n }", "selectAll() {\n return this._setAllOptionsSelected(true);\n }", "selectAll() {\n this.selection.selectAll();\n }", "function selectAllItems() {\n if (items.length === 0) return;\n\n selectedAll = !selectedAll;\n this.innerHTML = selectedAll ? 'Unselect All' : 'Select All';\n\n items.map(item => item.done = selectedAll);\n insertItemsToList(items, itemsList);\n\n}", "function selectAll(area) {\n var textarea = this.textarea;\n textarea.select();\n\n // Chrome support\n textarea.mouseup(function() {\n // Prevent further mouseup intervention\n textarea.unbind(\"mouseup\");\n return false;\n });\n }", "selectAll() {\n var _a;\n (_a = this._selectionService) === null || _a === void 0 ? void 0 : _a.selectAll();\n }", "function selectUnselectAll(){\r\n\t\tvar objUnselectedItems = getObjUnselectedItems();\r\n\t\tif(objUnselectedItems.length != 0)\r\n\t\t\tselectAllItems();\r\n\t\telse\r\n\t\t\tunselectAllItems();\r\n\t\t\r\n\t}", "_updateSelectAllState(dataSourceLength) {\r\n const that = this,\r\n selectedIdsLength = that._selectedIds.length,\r\n selectAllCheckboxTd = that.$.tableContainer.querySelector('.smart-table-select-all');\r\n\r\n if (dataSourceLength === undefined) {\r\n dataSourceLength = that.dataSource.length;\r\n }\r\n\r\n if (selectedIdsLength === 0) {\r\n selectAllCheckboxTd.classList.remove('selected', 'indeterminate');\r\n }\r\n else if (selectedIdsLength === dataSourceLength) {\r\n selectAllCheckboxTd.classList.remove('indeterminate');\r\n selectAllCheckboxTd.classList.add('selected');\r\n }\r\n else {\r\n selectAllCheckboxTd.classList.remove('selected');\r\n selectAllCheckboxTd.classList.add('indeterminate');\r\n }\r\n }", "selectAll() {\n if (this.settings.mode === 'single') return;\n this.activeItems = this.controlChildren();\n\n if (this.activeItems.length) {\n addClasses(this.activeItems, 'active');\n this.hideInput();\n this.close();\n }\n\n this.focus();\n }", "function selectAll() {\n\t\t\teditor.shortcuts.add('meta+a', null, 'SelectAll');\n\t\t}", "function selectAll() {\n\t\t\teditor.shortcuts.add('meta+a', null, 'SelectAll');\n\t\t}", "function selectAll() {\n\t\t\teditor.shortcuts.add('meta+a', null, 'SelectAll');\n\t\t}", "function initSelectAllButton() {\n window.bindsSelectAllButton = document.querySelector('.binds-select-all-button');\n bindsSelectAllButton.addEventListener('click', () => {\n const shouldSelect = bindsSelectAllButton.innerHTML !== 'Deselect all';\n const events = document.querySelectorAll('.log-binds .event input');\n Array.prototype.forEach.call(events, function(event) {\n if (event.checked && !shouldSelect || !event.checked && shouldSelect) {\n event.click();\n }\n });\n bindsSelectAllButton.innerHTML = bindsSelectAllButton.innerHTML === 'Deselect all' ? 'Select all' : 'Deselect all';\n })\n}", "function selectAllPlanes() {\n HighlightedPlane = null;\n\t// if all planes are already selected, deselect them all\n\tif (SelectedAllPlanes) {\n\t\tdeselectAllPlanes();\n\t} else {\n\t\t// If SelectedPlane has something in it, clear out the selected\n\t\tif (SelectedPlane != null) {\n\t\t\tPlanes[SelectedPlane].selected = false;\n\t\t\tPlanes[SelectedPlane].clearLines();\n\t\t\tPlanes[SelectedPlane].updateMarker();\n\t\t\t$(Planes[SelectedPlane].tr).removeClass(\"selected\");\n\t\t}\n\n\t\tSelectedPlane = null;\n\t\tSelectedAllPlanes = true;\n\n\t\tfor(var key in Planes) {\n\t\t\tif (Planes[key].visible && !Planes[key].isFiltered()) {\n\t\t\t\tPlanes[key].selected = true;\n\t\t\t\tPlanes[key].updateLines();\n\t\t\t\tPlanes[key].updateMarker();\n\t\t\t}\n\t\t}\n\t}\n\n\t$('#selectall_checkbox').addClass('settingsCheckboxChecked');\n\n\trefreshSelected();\n\trefreshHighlighted();\n}", "function selectall(obj) {\n\tobj = (typeof obj == \"string\") ? document.getElementById(obj) : obj;\n\tif (obj.tagName.toLowerCase() != \"select\")\n\t\treturn;\n\tfor (var i=0; i<obj.length; i++) {\n\t\tobj[i].selected = true;\n\t}\n}", "function checkSelectAll() {\n if (scope.isEditing && attrs.hasOwnProperty('ggSelectAll')) {\n scope.$applyAsync(function () {\n if (scope.isEditing) {\n input.focus();\n input.setSelectionRange(0, scope.editingValue.length);\n }\n });\n }\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 }", "clearSelection() {\n if (!this.disallowEmptySelection && (this.state.selectedKeys === 'all' || this.state.selectedKeys.size > 0)) {\n this.state.setSelectedKeys(new $cc81f14158b02e1e259a5a46d24f0c$export$Selection());\n }\n }", "_unmarkAll() {\n if (!this.isEmpty()) {\n this._selection.forEach(value => this._unmarkSelected(value));\n }\n }", "function selectAllSent(){\r\n\r\n checkBoxSelection(true, 'divSent');\r\n}", "function updateSelectAllCheckbox () {\n var unselectedRows = $(element).find('.select-row:not(:checked)');\n\n if (unselectedRows.length == 0) {\n selectAllCheckbox.prop('checked', true);\n } else {\n selectAllCheckbox.prop('checked', false)\n }\n }", "onSelectAll (name) {\n const f = this.dimProp.find((d) => d.name === name)\n if (!f) return\n\n // if options not filtered then all select items in dimension\n // else append to current selection items from the filter\n if (f.options.length === f.enums.length) {\n f.selection = Array.from(f.options)\n } else {\n const a = f.options.filter(ov => f.selection.findIndex(sv => sv.value === ov.value) < 0)\n f.selection = f.selection.concat(a)\n f.selection.sort(\n (left, right) => (left.value === right.value) ? 0 : ((left.value < right.value) ? -1 : 1)\n )\n }\n\n f.singleSelection = f.selection.length > 0 ? f.selection[0] : {}\n f.options = f.enums\n\n this.updateSelectOrClearView(name)\n }", "function selectall(){\n \n var elem = document.getElementById(\"SelectButton\");\n if (elem.innerHTML==\"Select all\") {\n for (var i = 0; i < 6; i++) {\n filtersc[i].checked =true;\n }\n elem.innerHTML = \"Deselect all\"}\n\n else {elem.innerHTML = \"Select all\";\n for (var i = 0; i < 6; i++) {\n filtersc[i].checked =false;\n }\n}\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 selectAll(select)\n {\n var elementcount=select.options.length;\n var j=0;\n for(j=0;j<elementcount;++j)\n select.options[j].selected=1; //select this option\n }", "function selectAllTrash(){\r\n\r\n checkBoxSelection(true, 'divTrash');\r\n}", "get selectAllOnFocus() {\n\t\treturn this.nativeElement ? this.nativeElement.selectAllOnFocus : undefined;\n\t}", "function selectAll()\r\n\t\t{\r\n\t\t\t$(\":checkbox:visible:not(:checked)\").prop(\"checked\",true)\r\n\t\t\t\t\t\t .each(function(index, element){lsSetVal(\"hosts\", this.id, true)});\r\n\t\t}", "unSelectAll() {\n\n }", "function SelectAllOptions(theSelect) {\n\n for (var i = 0; i < theSelect.options.length; i++) {\n\n theSelect.options[i].selected = true;\n\n}\n\n}", "function setAllSelected() {\n\tvar selected = document.getElementsByTagName(\"select\");\n\tfor (var i=0; i<selected.length; i++) {\n\t\tsetSelected(selected[i]);\n\t}\n}", "_selectAllClicked(){\n\t\tconst selectAllState = this.state.selectAllFilters;\n\t\tconst newSelectAllState = !selectAllState;\n\t\tconst searchState = this.state.searchEnabled;\n\t\t// const searchValue = this.searchValue;\n\n\t\tif(searchState){\n\t\t\treturn;\n\t\t}\n\n\t\tconst visibleFiltersValues = this.state.filterList.filter((filterItem) => {\n\t\t\tif(newSelectAllState){\n\t\t\t\treturn (filterItem.visible && !filterItem.selected);\n\t\t\t}else{\n\t\t\t\treturn (filterItem.visible && filterItem.selected);\n\t\t\t}\n\t\t}).map((filterItem) => {\n\t\t\treturn filterItem.key;\n\t\t});\n\n\t\tthis._resetData(visibleFiltersValues, newSelectAllState);\t\t\n\t}", "function select_all_boxes(select_class_name, input_class_name){\n\t\t$(select_class_name).click(function(){\n\t\t\tif(this.checked){\n\t\t\t\t$(input_class_name).each(function(){\n\t\t\t\t\tthis.checked = true;\n\t\t\t\t});\t\n\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t$(input_class_name).each(function(){\n\t\t\t\t\t\tthis.checked = false;\n\t\t\t\t\t});\t\n\t\t\t\t}\n\t\t});\n\t}", "function selectAll(target, notCheck){\r\n\t\tvar state = $.data(target, 'datagrid');\r\n\t\tvar opts = state.options;\r\n\t\tvar rows = state.data.rows;\r\n\t\tvar selectedRows = $.data(target, 'datagrid').selectedRows;\r\n\t\t\r\n\t\tif (!notCheck && opts.checkOnSelect){\r\n\t\t\tcheckAll(target, true);\t// don't select rows again\r\n\t\t}\r\n\t\topts.finder.getTr(target, '', 'allbody').addClass('datagrid-row-selected');\r\n\t\tif (opts.idField){\r\n\t\t\tfor(var index=0; index<rows.length; index++){\r\n\t\t\t\taddArrayItem(selectedRows, opts.idField, rows[index]);\r\n\t\t\t}\r\n\t\t}\r\n\t\topts.onSelectAll.call(target, rows);\r\n\t}", "function selectAllItems() {\n selectedItems = []\n Object.keys(allItemNames).forEach(itemName => {\n selectItem(itemName)\n })\n updateSelectedItemComponents()\n}", "toggleSelectAll(event) {\n (!this.allCheckboxesSelected) ? this.selectAll() : this.unselectAll()\n }", "function selectAll(target, notCheck, state) {\n if (!state) state = $.data(target, 'datagrid');\n var opts = state.options;\n var rows = state.data.rows;\n state.selectedRows = [];\n var selectedRows = state.selectedRows;\n\n if (!notCheck && opts.checkOnSelect) {\n checkAll(target, true, state);\t// don't select rows again\n }\n opts.finder.getTr(target, '', 'allbody', undefined, state).not( $(\".cannot-select\") ).addClass('datagrid-row-selected');\n if (opts.idField) {\n var sExists = {};\n for (var index = 0, len = rows.length; index < len; index++) {\n if(opts.finder.getTr(target, index, undefined, undefined, state).hasClass('cannot-select'))continue\n var row = rows[index];\n if (row[opts.idField]) {\n if (!sExists[row[opts.idField]]) {\n selectedRows.push(row);\n sExists[row[opts.idField]] = 1;\n }\n } else {\n selectedRows.push(row);\n }\n }\n }\n opts.onSelectAll.call(target, rows);\n }", "function selectAll(obj){\r\n \r\n var objRight=document.getElementById(obj);\r\n \r\n for (var i=0; i<objRight.childNodes.length; i++)\r\n {\r\n //alert(objRight.childNodes[i].nodeName.toLowerCase());\r\n if (objRight.childNodes[i].nodeName.toLowerCase()==\"option\")\r\n objRight.childNodes[i].selected=true;\r\n }\r\n return false\r\n }", "function selectAll() {\n selectElementText(document.getElementById(\"preview\"));\n}", "function selectAllToggle()\n{\n\t$('button.select-all').click(function(){\n\t\tvar $checkboxes = $(this).closest(\"div.category\").find(\"input:checkbox\");\n\t\tif ( $(this).text() === \"Select All\" ) {\n\t\t\t$checkboxes.prop('checked', true);\n\t\t\t$(this).text('Unselect All');\n\t\t} else {\n\t\t\t$checkboxes.removeAttr('checked');\n\t\t\t$(this).text('Select All');\n\t\t}\n\t})\n}", "function selectAll() {\n $(this).parent().parent().next().find('input').click();\n}", "function selectAll(div) {\r\n var m = document.getElementById(div);\r\n for (var i = 0; i < m.options.length; i++) {\r\n m.options[i].selected = true;\r\n }\r\n}", "function selectAll() {\n var $this = $(this);\n var table = $this.closest(\"table\");\n var checkboxes = table.find(\"tbody\").find(\"input[type='checkbox']\");\n var toCheck = $this.prop(\"checked\");\n\n checkboxes.prop(\"checked\", toCheck).each(function(idx, el) {\n selectedDatas[+el.value] = {isSelected: toCheck, data: $(el).data('originalCespite')};\n });\n }" ]
[ "0.7962586", "0.68508226", "0.6849682", "0.6849682", "0.6849682", "0.6849682", "0.6849682", "0.6836901", "0.6795213", "0.67752296", "0.676283", "0.676283", "0.676283", "0.67515665", "0.67515665", "0.6742831", "0.6742831", "0.67361194", "0.6732308", "0.67188287", "0.67188287", "0.67188287", "0.67188287", "0.67188287", "0.67188287", "0.67188287", "0.67188287", "0.67188287", "0.67188287", "0.67188287", "0.67118895", "0.670269", "0.6693322", "0.6692593", "0.6625626", "0.6602128", "0.6573375", "0.6557311", "0.65277", "0.6517198", "0.64972967", "0.6491874", "0.6438775", "0.6435122", "0.64171827", "0.63906807", "0.63723516", "0.63126326", "0.6286969", "0.6188799", "0.6188799", "0.6188799", "0.6188048", "0.61854917", "0.6173047", "0.6160352", "0.6151952", "0.6151952", "0.6136452", "0.61326796", "0.61244255", "0.61222625", "0.61222464", "0.6112983", "0.61078864", "0.609138", "0.6058949", "0.605139", "0.6027258", "0.6012853", "0.60110337", "0.6009963", "0.6002672", "0.600254", "0.599471", "0.5980133", "0.59772253", "0.596706", "0.59641474", "0.5955868", "0.59556663", "0.5932715", "0.59262574", "0.5913528" ]
0.67083514
47
Function to create the first processor.
function unified() { var attachers = [] var transformers = trough() var namespace = {} var frozen = false var freezeIndex = -1 /* Data management. */ processor.data = data /* Lock. */ processor.freeze = freeze /* Plug-ins. */ processor.attachers = attachers processor.use = use /* API. */ processor.parse = parse processor.stringify = stringify processor.run = run processor.runSync = runSync processor.process = process processor.processSync = processSync /* Expose. */ return processor /* Create a new processor based on the processor * in the current scope. */ function processor() { var destination = unified() var length = attachers.length var index = -1 while (++index < length) { destination.use.apply(null, attachers[index]) } destination.data(extend(true, {}, namespace)) return destination } /* Freeze: used to signal a processor that has finished * configuration. * * For example, take unified itself. It’s frozen. * Plug-ins should not be added to it. Rather, it should * be extended, by invoking it, before modifying it. * * In essence, always invoke this when exporting a * processor. */ function freeze() { var values var plugin var options var transformer if (frozen) { return processor } while (++freezeIndex < attachers.length) { values = attachers[freezeIndex] plugin = values[0] options = values[1] transformer = null if (options === false) { continue } if (options === true) { values[1] = undefined } transformer = plugin.apply(processor, values.slice(1)) if (typeof transformer === 'function') { transformers.use(transformer) } } frozen = true freezeIndex = Infinity return processor } /* Data management. * Getter / setter for processor-specific informtion. */ function data(key, value) { if (string(key)) { /* Set `key`. */ if (arguments.length === 2) { assertUnfrozen('data', frozen) namespace[key] = value return processor } /* Get `key`. */ return (own.call(namespace, key) && namespace[key]) || null } /* Set space. */ if (key) { assertUnfrozen('data', frozen) namespace = key return processor } /* Get space. */ return namespace } /* Plug-in management. * * Pass it: * * an attacher and options, * * a preset, * * a list of presets, attachers, and arguments (list * of attachers and options). */ function use(value) { var settings assertUnfrozen('use', frozen) if (value === null || value === undefined) { /* Empty */ } else if (typeof value === 'function') { addPlugin.apply(null, arguments) } else if (typeof value === 'object') { if ('length' in value) { addList(value) } else { addPreset(value) } } else { throw new Error('Expected usable value, not `' + value + '`') } if (settings) { namespace.settings = extend(namespace.settings || {}, settings) } return processor function addPreset(result) { addList(result.plugins) if (result.settings) { settings = extend(settings || {}, result.settings) } } function add(value) { if (typeof value === 'function') { addPlugin(value) } else if (typeof value === 'object') { if ('length' in value) { addPlugin.apply(null, value) } else { addPreset(value) } } else { throw new Error('Expected usable value, not `' + value + '`') } } function addList(plugins) { var length var index if (plugins === null || plugins === undefined) { /* Empty */ } else if (typeof plugins === 'object' && 'length' in plugins) { length = plugins.length index = -1 while (++index < length) { add(plugins[index]) } } else { throw new Error('Expected a list of plugins, not `' + plugins + '`') } } function addPlugin(plugin, value) { var entry = find(plugin) if (entry) { if (plain(entry[1]) && plain(value)) { value = extend(entry[1], value) } entry[1] = value } else { attachers.push(slice.call(arguments)) } } } function find(plugin) { var length = attachers.length var index = -1 var entry while (++index < length) { entry = attachers[index] if (entry[0] === plugin) { return entry } } } /* Parse a file (in string or VFile representation) * into a Unist node using the `Parser` on the * processor. */ function parse(doc) { var file = vfile(doc) var Parser freeze() Parser = processor.Parser assertParser('parse', Parser) if (newable(Parser)) { return new Parser(String(file), file).parse() } return Parser(String(file), file) // eslint-disable-line new-cap } /* Run transforms on a Unist node representation of a file * (in string or VFile representation), async. */ function run(node, file, cb) { assertNode(node) freeze() if (!cb && typeof file === 'function') { cb = file file = null } if (!cb) { return new Promise(executor) } executor(null, cb) function executor(resolve, reject) { transformers.run(node, vfile(file), done) function done(err, tree, file) { tree = tree || node if (err) { reject(err) } else if (resolve) { resolve(tree) } else { cb(null, tree, file) } } } } /* Run transforms on a Unist node representation of a file * (in string or VFile representation), sync. */ function runSync(node, file) { var complete = false var result run(node, file, done) assertDone('runSync', 'run', complete) return result function done(err, tree) { complete = true bail(err) result = tree } } /* Stringify a Unist node representation of a file * (in string or VFile representation) into a string * using the `Compiler` on the processor. */ function stringify(node, doc) { var file = vfile(doc) var Compiler freeze() Compiler = processor.Compiler assertCompiler('stringify', Compiler) assertNode(node) if (newable(Compiler)) { return new Compiler(node, file).compile() } return Compiler(node, file) // eslint-disable-line new-cap } /* Parse a file (in string or VFile representation) * into a Unist node using the `Parser` on the processor, * then run transforms on that node, and compile the * resulting node using the `Compiler` on the processor, * and store that result on the VFile. */ function process(doc, cb) { freeze() assertParser('process', processor.Parser) assertCompiler('process', processor.Compiler) if (!cb) { return new Promise(executor) } executor(null, cb) function executor(resolve, reject) { var file = vfile(doc) pipeline.run(processor, {file: file}, done) function done(err) { if (err) { reject(err) } else if (resolve) { resolve(file) } else { cb(null, file) } } } } /* Process the given document (in string or VFile * representation), sync. */ function processSync(doc) { var complete = false var file freeze() assertParser('processSync', processor.Parser) assertCompiler('processSync', processor.Compiler) file = vfile(doc) process(file, done) assertDone('processSync', 'process', complete) return file function done(err) { complete = true bail(err) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function DeviceProcessor() {\n\tvar builder = new processor.Chain();\n\tbuilder.Add(save_flags);\n\tbuilder.Add(strip_syslog_priority);\n\tbuilder.Add(chain1);\n\tbuilder.Add(populate_fields);\n\tbuilder.Add(restore_flags);\n\tvar chain = builder.Build();\n\treturn {\n\t\tprocess: chain.Run,\n\t}\n}", "function DeviceProcessor() {\n\tvar builder = new processor.Chain();\n\tbuilder.Add(save_flags);\n\tbuilder.Add(strip_syslog_priority);\n\tbuilder.Add(chain1);\n\tbuilder.Add(populate_fields);\n\tbuilder.Add(restore_flags);\n\tvar chain = builder.Build();\n\treturn {\n\t\tprocess: chain.Run,\n\t}\n}", "function DeviceProcessor() {\n\tvar builder = new processor.Chain();\n\tbuilder.Add(save_flags);\n\tbuilder.Add(strip_syslog_priority);\n\tbuilder.Add(chain1);\n\tbuilder.Add(populate_fields);\n\tbuilder.Add(restore_flags);\n\tvar chain = builder.Build();\n\treturn {\n\t\tprocess: chain.Run,\n\t}\n}", "function unified() {\n var attachers = []\n var transformers = trough()\n var namespace = {}\n var freezeIndex = -1\n var frozen\n\n // Data management.\n processor.data = data\n\n // Lock.\n processor.freeze = freeze\n\n // Plugins.\n processor.attachers = attachers\n processor.use = use\n\n // API.\n processor.parse = parse\n processor.stringify = stringify\n processor.run = run\n processor.runSync = runSync\n processor.process = process\n processor.processSync = processSync\n\n // Expose.\n return processor\n\n // Create a new processor based on the processor in the current scope.\n function processor() {\n var destination = unified()\n var index = -1\n\n while (++index < attachers.length) {\n destination.use.apply(null, attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }\n\n // Freeze: used to signal a processor that has finished configuration.\n //\n // For example, take unified itself: it’s frozen.\n // Plugins should not be added to it.\n // Rather, it should be extended, by invoking it, before modifying it.\n //\n // In essence, always invoke this when exporting a processor.\n function freeze() {\n var values\n var transformer\n\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n values = attachers[freezeIndex]\n\n if (values[1] === false) {\n continue\n }\n\n if (values[1] === true) {\n values[1] = undefined\n }\n\n transformer = values[0].apply(processor, values.slice(1))\n\n if (typeof transformer === 'function') {\n transformers.use(transformer)\n }\n }\n\n frozen = true\n freezeIndex = Infinity\n\n return processor\n }\n\n // Data management.\n // Getter / setter for processor-specific informtion.\n function data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen)\n namespace[key] = value\n return processor\n }\n\n // Get `key`.\n return (own.call(namespace, key) && namespace[key]) || null\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', frozen)\n namespace = key\n return processor\n }\n\n // Get space.\n return namespace\n }\n\n // Plugin management.\n //\n // Pass it:\n // * an attacher and options,\n // * a preset,\n // * a list of presets, attachers, and arguments (list of attachers and\n // options).\n function use(value) {\n var settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin.apply(null, arguments)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings)\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings)\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n while (++index < plugins.length) {\n add(plugins[index])\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin)\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(true, entry[1], value)\n }\n\n entry[1] = value\n } else {\n attachers.push(slice.call(arguments))\n }\n }\n }\n\n function find(plugin) {\n var index = -1\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n return attachers[index]\n }\n }\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor.\n function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), async.\n function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(error, tree, file) {\n tree = tree || node\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), sync.\n function runSync(node, file) {\n var result\n var complete\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(error, tree) {\n complete = true\n result = tree\n bail(error)\n }\n }\n\n // Stringify a unist node representation of a file (in string or vfile\n // representation) into a string using the `Compiler` on the processor.\n function stringify(node, doc) {\n var file = vfile(doc)\n var Compiler\n\n freeze()\n Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler, 'compile')) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor, then run transforms on that node, and\n // compile the resulting node using the `Compiler` on the processor, and\n // store that result on the vfile.\n function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(error) {\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }\n\n // Process the given document (in string or vfile representation), sync.\n function processSync(doc) {\n var file\n var complete\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(error) {\n complete = true\n bail(error)\n }\n }\n}", "function unified() {\n var attachers = []\n var transformers = trough()\n var namespace = {}\n var freezeIndex = -1\n var frozen\n\n // Data management.\n processor.data = data\n\n // Lock.\n processor.freeze = freeze\n\n // Plugins.\n processor.attachers = attachers\n processor.use = use\n\n // API.\n processor.parse = parse\n processor.stringify = stringify\n processor.run = run\n processor.runSync = runSync\n processor.process = process\n processor.processSync = processSync\n\n // Expose.\n return processor\n\n // Create a new processor based on the processor in the current scope.\n function processor() {\n var destination = unified()\n var index = -1\n\n while (++index < attachers.length) {\n destination.use.apply(null, attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }\n\n // Freeze: used to signal a processor that has finished configuration.\n //\n // For example, take unified itself: it’s frozen.\n // Plugins should not be added to it.\n // Rather, it should be extended, by invoking it, before modifying it.\n //\n // In essence, always invoke this when exporting a processor.\n function freeze() {\n var values\n var transformer\n\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n values = attachers[freezeIndex]\n\n if (values[1] === false) {\n continue\n }\n\n if (values[1] === true) {\n values[1] = undefined\n }\n\n transformer = values[0].apply(processor, values.slice(1))\n\n if (typeof transformer === 'function') {\n transformers.use(transformer)\n }\n }\n\n frozen = true\n freezeIndex = Infinity\n\n return processor\n }\n\n // Data management.\n // Getter / setter for processor-specific informtion.\n function data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen)\n namespace[key] = value\n return processor\n }\n\n // Get `key`.\n return (own.call(namespace, key) && namespace[key]) || null\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', frozen)\n namespace = key\n return processor\n }\n\n // Get space.\n return namespace\n }\n\n // Plugin management.\n //\n // Pass it:\n // * an attacher and options,\n // * a preset,\n // * a list of presets, attachers, and arguments (list of attachers and\n // options).\n function use(value) {\n var settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin.apply(null, arguments)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings)\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings)\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n while (++index < plugins.length) {\n add(plugins[index])\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin)\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(true, entry[1], value)\n }\n\n entry[1] = value\n } else {\n attachers.push(slice.call(arguments))\n }\n }\n }\n\n function find(plugin) {\n var index = -1\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n return attachers[index]\n }\n }\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor.\n function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), async.\n function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(error, tree, file) {\n tree = tree || node\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), sync.\n function runSync(node, file) {\n var result\n var complete\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(error, tree) {\n complete = true\n result = tree\n bail(error)\n }\n }\n\n // Stringify a unist node representation of a file (in string or vfile\n // representation) into a string using the `Compiler` on the processor.\n function stringify(node, doc) {\n var file = vfile(doc)\n var Compiler\n\n freeze()\n Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler, 'compile')) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor, then run transforms on that node, and\n // compile the resulting node using the `Compiler` on the processor, and\n // store that result on the vfile.\n function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(error) {\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }\n\n // Process the given document (in string or vfile representation), sync.\n function processSync(doc) {\n var file\n var complete\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(error) {\n complete = true\n bail(error)\n }\n }\n}", "function unified() {\n var attachers = []\n var transformers = trough()\n var namespace = {}\n var frozen = false\n var freezeIndex = -1\n\n // Data management.\n processor.data = data\n\n // Lock.\n processor.freeze = freeze\n\n // Plugins.\n processor.attachers = attachers\n processor.use = use\n\n // API.\n processor.parse = parse\n processor.stringify = stringify\n processor.run = run\n processor.runSync = runSync\n processor.process = process\n processor.processSync = processSync\n\n // Expose.\n return processor\n\n // Create a new processor based on the processor in the current scope.\n function processor() {\n var destination = unified()\n var length = attachers.length\n var index = -1\n\n while (++index < length) {\n destination.use.apply(null, attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }\n\n // Freeze: used to signal a processor that has finished configuration.\n //\n // For example, take unified itself: it’s frozen.\n // Plugins should not be added to it.\n // Rather, it should be extended, by invoking it, before modifying it.\n //\n // In essence, always invoke this when exporting a processor.\n function freeze() {\n var values\n var plugin\n var options\n var transformer\n\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n values = attachers[freezeIndex]\n plugin = values[0]\n options = values[1]\n transformer = null\n\n if (options === false) {\n continue\n }\n\n if (options === true) {\n values[1] = undefined\n }\n\n transformer = plugin.apply(processor, values.slice(1))\n\n if (typeof transformer === 'function') {\n transformers.use(transformer)\n }\n }\n\n frozen = true\n freezeIndex = Infinity\n\n return processor\n }\n\n // Data management.\n // Getter / setter for processor-specific informtion.\n function data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen)\n\n namespace[key] = value\n\n return processor\n }\n\n // Get `key`.\n return (own.call(namespace, key) && namespace[key]) || null\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', frozen)\n namespace = key\n return processor\n }\n\n // Get space.\n return namespace\n }\n\n // Plugin management.\n //\n // Pass it:\n // * an attacher and options,\n // * a preset,\n // * a list of presets, attachers, and arguments (list of attachers and\n // options).\n function use(value) {\n var settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin.apply(null, arguments)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings)\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings)\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var length\n var index\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n length = plugins.length\n index = -1\n\n while (++index < length) {\n add(plugins[index])\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin)\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(entry[1], value)\n }\n\n entry[1] = value\n } else {\n attachers.push(slice.call(arguments))\n }\n }\n }\n\n function find(plugin) {\n var length = attachers.length\n var index = -1\n var entry\n\n while (++index < length) {\n entry = attachers[index]\n\n if (entry[0] === plugin) {\n return entry\n }\n }\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor.\n function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), async.\n function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), sync.\n function runSync(node, file) {\n var complete = false\n var result\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(err, tree) {\n complete = true\n bail(err)\n result = tree\n }\n }\n\n // Stringify a unist node representation of a file (in string or vfile\n // representation) into a string using the `Compiler` on the processor.\n function stringify(node, doc) {\n var file = vfile(doc)\n var Compiler\n\n freeze()\n Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler, 'compile')) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor, then run transforms on that node, and\n // compile the resulting node using the `Compiler` on the processor, and\n // store that result on the vfile.\n function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }\n\n // Process the given document (in string or vfile representation), sync.\n function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }\n}", "function unified$1() {\n var attachers = [];\n var transformers = trough();\n var namespace = {};\n var freezeIndex = -1;\n var frozen;\n\n // Data management.\n processor.data = data;\n\n // Lock.\n processor.freeze = freeze;\n\n // Plugins.\n processor.attachers = attachers;\n processor.use = use;\n\n // API.\n processor.parse = parse;\n processor.stringify = stringify;\n processor.run = run;\n processor.runSync = runSync;\n processor.process = process;\n processor.processSync = processSync;\n\n // Expose.\n return processor\n\n // Create a new processor based on the processor in the current scope.\n function processor() {\n var destination = unified$1();\n var index = -1;\n\n while (++index < attachers.length) {\n destination.use.apply(null, attachers[index]);\n }\n\n destination.data(extend$1(true, {}, namespace));\n\n return destination\n }\n\n // Freeze: used to signal a processor that has finished configuration.\n //\n // For example, take unified itself: it’s frozen.\n // Plugins should not be added to it.\n // Rather, it should be extended, by invoking it, before modifying it.\n //\n // In essence, always invoke this when exporting a processor.\n function freeze() {\n var values;\n var transformer;\n\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n values = attachers[freezeIndex];\n\n if (values[1] === false) {\n continue\n }\n\n if (values[1] === true) {\n values[1] = undefined;\n }\n\n transformer = values[0].apply(processor, values.slice(1));\n\n if (typeof transformer === 'function') {\n transformers.use(transformer);\n }\n }\n\n frozen = true;\n freezeIndex = Infinity;\n\n return processor\n }\n\n // Data management.\n // Getter / setter for processor-specific informtion.\n function data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen);\n namespace[key] = value;\n return processor\n }\n\n // Get `key`.\n return (own$b.call(namespace, key) && namespace[key]) || null\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', frozen);\n namespace = key;\n return processor\n }\n\n // Get space.\n return namespace\n }\n\n // Plugin management.\n //\n // Pass it:\n // * an attacher and options,\n // * a preset,\n // * a list of presets, attachers, and arguments (list of attachers and\n // options).\n function use(value) {\n var settings;\n\n assertUnfrozen('use', frozen);\n\n if (value === null || value === undefined) ; else if (typeof value === 'function') {\n addPlugin.apply(null, arguments);\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value);\n } else {\n addPreset(value);\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend$1(namespace.settings || {}, settings);\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins);\n\n if (result.settings) {\n settings = extend$1(settings || {}, result.settings);\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value);\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value);\n } else {\n addPreset(value);\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var index = -1;\n\n if (plugins === null || plugins === undefined) ; else if (typeof plugins === 'object' && 'length' in plugins) {\n while (++index < plugins.length) {\n add(plugins[index]);\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin);\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend$1(true, entry[1], value);\n }\n\n entry[1] = value;\n } else {\n attachers.push(slice$1.call(arguments));\n }\n }\n }\n\n function find(plugin) {\n var index = -1;\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n return attachers[index]\n }\n }\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor.\n function parse(doc) {\n var file = vfile(doc);\n var Parser;\n\n freeze();\n Parser = processor.Parser;\n assertParser('parse', Parser);\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), async.\n function run(node, file, cb) {\n assertNode(node);\n freeze();\n\n if (!cb && typeof file === 'function') {\n cb = file;\n file = null;\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done);\n\n function done(error, tree, file) {\n tree = tree || node;\n if (error) {\n reject(error);\n } else if (resolve) {\n resolve(tree);\n } else {\n cb(null, tree, file);\n }\n }\n }\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), sync.\n function runSync(node, file) {\n var result;\n var complete;\n\n run(node, file, done);\n\n assertDone('runSync', 'run', complete);\n\n return result\n\n function done(error, tree) {\n complete = true;\n result = tree;\n bail(error);\n }\n }\n\n // Stringify a unist node representation of a file (in string or vfile\n // representation) into a string using the `Compiler` on the processor.\n function stringify(node, doc) {\n var file = vfile(doc);\n var Compiler;\n\n freeze();\n Compiler = processor.Compiler;\n assertCompiler('stringify', Compiler);\n assertNode(node);\n\n if (newable(Compiler, 'compile')) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor, then run transforms on that node, and\n // compile the resulting node using the `Compiler` on the processor, and\n // store that result on the vfile.\n function process(doc, cb) {\n freeze();\n assertParser('process', processor.Parser);\n assertCompiler('process', processor.Compiler);\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n var file = vfile(doc);\n\n pipeline.run(processor, {file: file}, done);\n\n function done(error) {\n if (error) {\n reject(error);\n } else if (resolve) {\n resolve(file);\n } else {\n cb(null, file);\n }\n }\n }\n }\n\n // Process the given document (in string or vfile representation), sync.\n function processSync(doc) {\n var file;\n var complete;\n\n freeze();\n assertParser('processSync', processor.Parser);\n assertCompiler('processSync', processor.Compiler);\n file = vfile(doc);\n\n process(file, done);\n\n assertDone('processSync', 'process', complete);\n\n return file\n\n function done(error) {\n complete = true;\n bail(error);\n }\n }\n}", "function unified() {\n var attachers = [];\n var transformers = trough();\n var namespace = {};\n var frozen = false;\n var freezeIndex = -1;\n\n /* Data management. */\n processor.data = data;\n\n /* Lock. */\n processor.freeze = freeze;\n\n /* Plug-ins. */\n processor.attachers = attachers;\n processor.use = use;\n\n /* API. */\n processor.parse = parse;\n processor.stringify = stringify;\n processor.run = run;\n processor.runSync = runSync;\n processor.process = process;\n processor.processSync = processSync;\n\n /* Expose. */\n return processor;\n\n /* Create a new processor based on the processor\n * in the current scope. */\n function processor() {\n var destination = unified();\n var length = attachers.length;\n var index = -1;\n\n while (++index < length) {\n destination.use.apply(null, attachers[index]);\n }\n\n destination.data(extend(true, {}, namespace));\n\n return destination;\n }\n\n /* Freeze: used to signal a processor that has finished\n * configuration.\n *\n * For example, take unified itself. It’s frozen.\n * Plug-ins should not be added to it. Rather, it should\n * be extended, by invoking it, before modifying it.\n *\n * In essence, always invoke this when exporting a\n * processor. */\n function freeze() {\n var values;\n var plugin;\n var options;\n var transformer;\n\n if (frozen) {\n return processor;\n }\n\n while (++freezeIndex < attachers.length) {\n values = attachers[freezeIndex];\n plugin = values[0];\n options = values[1];\n transformer = null;\n\n if (options === false) {\n continue;\n }\n\n if (options === true) {\n values[1] = undefined;\n }\n\n transformer = plugin.apply(processor, values.slice(1));\n\n if (func(transformer)) {\n transformers.use(transformer);\n }\n }\n\n frozen = true;\n freezeIndex = Infinity;\n\n return processor;\n }\n\n /* Data management.\n * Getter / setter for processor-specific informtion. */\n function data(key, value) {\n if (string(key)) {\n /* Set `key`. */\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen);\n\n namespace[key] = value;\n\n return processor;\n }\n\n /* Get `key`. */\n return (own.call(namespace, key) && namespace[key]) || null;\n }\n\n /* Set space. */\n if (key) {\n assertUnfrozen('data', frozen);\n namespace = key;\n return processor;\n }\n\n /* Get space. */\n return namespace;\n }\n\n /* Plug-in management.\n *\n * Pass it:\n * * an attacher and options,\n * * a preset,\n * * a list of presets, attachers, and arguments (list\n * of attachers and options). */\n function use(value) {\n var settings;\n\n assertUnfrozen('use', frozen);\n\n if (value === null || value === undefined) {\n /* Empty */\n } else if (func(value)) {\n addPlugin.apply(null, arguments);\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value);\n } else {\n addPreset(value);\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`');\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings);\n }\n\n return processor;\n\n function addPreset(result) {\n addList(result.plugins);\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings);\n }\n }\n\n function add(value) {\n if (func(value)) {\n addPlugin(value);\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value);\n } else {\n addPreset(value);\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`');\n }\n }\n\n function addList(plugins) {\n var length;\n var index;\n\n if (plugins === null || plugins === undefined) {\n /* Empty */\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n length = plugins.length;\n index = -1;\n\n while (++index < length) {\n add(plugins[index]);\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`');\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin);\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(entry[1], value);\n }\n\n entry[1] = value;\n } else {\n attachers.push(slice.call(arguments));\n }\n }\n }\n\n function find(plugin) {\n var length = attachers.length;\n var index = -1;\n var entry;\n\n while (++index < length) {\n entry = attachers[index];\n\n if (entry[0] === plugin) {\n return entry;\n }\n }\n }\n\n /* Parse a file (in string or VFile representation)\n * into a Unist node using the `Parser` on the\n * processor. */\n function parse(doc) {\n var file = vfile(doc);\n var Parser;\n\n freeze();\n Parser = processor.Parser;\n assertParser('parse', Parser);\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse();\n }\n\n return Parser(String(file), file); // eslint-disable-line new-cap\n }\n\n /* Run transforms on a Unist node representation of a file\n * (in string or VFile representation), async. */\n function run(node, file, cb) {\n assertNode(node);\n freeze();\n\n if (!cb && func(file)) {\n cb = file;\n file = null;\n }\n\n if (!cb) {\n return new Promise(executor);\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done);\n\n function done(err, tree, file) {\n tree = tree || node;\n if (err) {\n reject(err);\n } else if (resolve) {\n resolve(tree);\n } else {\n cb(null, tree, file);\n }\n }\n }\n }\n\n /* Run transforms on a Unist node representation of a file\n * (in string or VFile representation), sync. */\n function runSync(node, file) {\n var complete = false;\n var result;\n\n run(node, file, done);\n\n assertDone('runSync', 'run', complete);\n\n return result;\n\n function done(err, tree) {\n complete = true;\n bail(err);\n result = tree;\n }\n }\n\n /* Stringify a Unist node representation of a file\n * (in string or VFile representation) into a string\n * using the `Compiler` on the processor. */\n function stringify(node, doc) {\n var file = vfile(doc);\n var Compiler;\n\n freeze();\n Compiler = processor.Compiler;\n assertCompiler('stringify', Compiler);\n assertNode(node);\n\n if (newable(Compiler)) {\n return new Compiler(node, file).compile();\n }\n\n return Compiler(node, file); // eslint-disable-line new-cap\n }\n\n /* Parse a file (in string or VFile representation)\n * into a Unist node using the `Parser` on the processor,\n * then run transforms on that node, and compile the\n * resulting node using the `Compiler` on the processor,\n * and store that result on the VFile. */\n function process(doc, cb) {\n freeze();\n assertParser('process', processor.Parser);\n assertCompiler('process', processor.Compiler);\n\n if (!cb) {\n return new Promise(executor);\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n var file = vfile(doc);\n\n pipeline.run(processor, {file: file}, done);\n\n function done(err) {\n if (err) {\n reject(err);\n } else if (resolve) {\n resolve(file);\n } else {\n cb(null, file);\n }\n }\n }\n }\n\n /* Process the given document (in string or VFile\n * representation), sync. */\n function processSync(doc) {\n var complete = false;\n var file;\n\n freeze();\n assertParser('processSync', processor.Parser);\n assertCompiler('processSync', processor.Compiler);\n file = vfile(doc);\n\n process(file, done);\n\n assertDone('processSync', 'process', complete);\n\n return file;\n\n function done(err) {\n complete = true;\n bail(err);\n }\n }\n}", "createProducer (structureType, tile) {\n var sType = this.checkStructureType(structureType)\n\n var producer = sType.type === 'refinery'\n ? this.createRefiner(sType.buysFrom, sType.multiplier, sType.reach, tile)\n : this.createPrimaryProducer(sType, tile)\n\n return new AllDecorator({producer: producer, tile: tile})\n }", "register(processType) { this.register_(processType) }", "onCreatedPreProcessor(preprocessor) {}", "__init3() {this._numProcessing = 0;}", "__init3() {this._numProcessing = 0;}", "__init3() {this._numProcessing = 0;}", "createFirstPage(architect) {\n let pageEllipsis = this.createPageEllipsis(architect);\n this.createPageNumber(architect, {\n condition: this.getShowNumbers && this.addFirstPage,\n current: this.isFirstPage\n });\n architect.addChild(\n pageEllipsis,\n this.getShowNumbers && this.addFirstPage\n );\n }", "function CreateStreamProcessorCommand(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 Proc() {}", "peek() {\n // console.log(\"This is the peek\", this.processes[0]);\n if (this.processes[0] !== undefined) {\n\n return this.processes[0];\n };\n\n return this.processes[0];\n }", "function startProcessingHandler(noTimer) {\n\tlet processor = child.spawn(\"node\", [\"processor.js\"], {});\n\tprocessor.stdout.on('data', (data) => {\n\t\tconsole.log(`Processor: ${data}`);\n\t});\n\n\tprocessor.stderr.on('data', (data) => {\n\t\tconsole.error(`Processor: ${data}`);\n\t});\n\n\tprocessor.on('close', (code) => {\n\t\tconsole.log(`Processor exited: ${code}`);\n\t\tif (code === 255 || code === -1) {\n\t\t\t// Start Processing again in 5 minutes.\n\t\t\tconsole.log(\"Processor Exited with failed to download, restarting download in 5 minutes.\")\n\t\t\tsetTimeout(() => {startProcessingHandler(true); }, 5*60*1000);\n\t\t}\n\t});\n\n\tif (noTimer === true) {\n\t\treturn;\n\t}\n\t// Figure out the next timestamp to run the next processing run\n\tlet tomorrow = new Date();\n\ttomorrow.setMinutes(60);\n\ttomorrow.setSeconds(0);\n\tif (tomorrow.getHours() > 3) {\n\t\t// Next Day\n\t\ttomorrow.setHours(24);\n\t\ttomorrow.setHours(3);\n\t} else {\n\t\t// Today\n\t\ttomorrow.setHours(3);\n\t}\n\tlet nextTimeStamp = (tomorrow.getTime()-Date.now());\n\tconsole.log(\"Setting next Processing Run for\", nextTimeStamp/1000);\n\n\tsetTimeout(startProcessingHandler, nextTimeStamp);\n}", "function Process(){}", "function ProcessController() {}", "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 }", "parse(parser) {\n this._processor = this._process(parser);\n this._processor.next();\n }", "function Processor(proc, host){\n var processes = proc || [], locked = 0, i = 0,\n\n /* Functional methods to manipulate DataBus processing workflow */\n fns = {\n /* Continue processing with @data */\n $continue: function(data){\n return self.tick(data);\n },\n /* Break processing */\n $break: function(){\n return self.tick({}, 1);\n },\n /* Locks DataBus evaluation */\n $lock: function(){\n return locked = 1;\n },\n /* Unlocks DataBus evaluation */\n $unlock: function(){\n return locked = 0;\n },\n $update: function(){\n host.update();\n },\n /* Returns current DataBus */\n $host: function(){\n return host;\n }\n };\n \n var self = {\n /* Add process if @p exists or return all processes of this Processor */\n process : function(p){\n return Utils.is.exist(p) ? processes.push(p) : processes;\n },\n\n /* Start processing */\n start : function(event, context, fin){\n self.ctx = context;\n self.fin = fin; \n \n i = locked ? 0 : i;\n \n if(i==processes.length){\n i = 0;\n return fin(event);\n }\n\n this.tick(event);\n },\n\n /* Ticking processor to the next process */\n tick : function(event, breaked){ \n if(breaked){\n return i = 0;\n }\n \n if(i==processes.length){\n i = 0;\n return self.fin(event);\n }\n\n i++; \n processes[i-1].apply(self.ctx, [event, fns]);\n \n }\n }\n return self;\n }", "compute (name /*, ...processors */) {\n let processors = toArray(arguments, 1)\n\n return pipeline(this.lookup(name)(), processors, this.state)\n }", "function\trunProcessing() {\n initProcessing();\n}", "static defaultStart (component) {\n store.commit('START_PROCESS', 'vk')\n component.loading = true\n component.result = []\n }", "firstRun() { }", "function startProcessInstances() {\n getProcessDefinitionsAndThen(startProcessInstancesFromDefinitions);\n}", "process() {}", "process() {}", "function ProcessPackageOne(){\r this.name = \"ProcessPackageOne\";\r this.xpath = \"//device[@type = 'VCO']/package[1]\";\t\r this.apply = function(myElement, myRuleProcessor){\r with(myElement){\r __skipChildren(myRuleProcessor);\r var myNewElement = myContainerElement.xmlElements.item(-1).xmlElements.add(app.documents.item(0).xmlTags.item(\"Column\"));\r myElement.move(LocationOptions.atBeginning, myContainerElement.xmlElements.item(-1).xmlElements.item(-1));\r }\r return true;\r }\t\t\r}", "produce() {}", "function processorIDRegister() // ./common/cpu.js:290\n{ // ./common/cpu.js:291\n\t// all fields are read only by software // ./common/cpu.js:292\n\tthis.R = 0; // bits 31:24 // ./common/cpu.js:293\n\tthis.companyID = 1; // bits 23:16 // ./common/cpu.js:294\n\tthis.processorID = 128; // bits 15:8, (128 for 4kc) // ./common/cpu.js:295\n\tthis.revision = 11; // bits 7:0, latest version according to manual // ./common/cpu.js:296\n // ./common/cpu.js:297\n\tthis.asUInt32 = function() // ./common/cpu.js:298\n\t{ // ./common/cpu.js:299\n\t\treturn ((this.R << 24) + (this.companyID << 16) + (this.processorID << 8) + this.revision); // ./common/cpu.js:300\n\t} // ./common/cpu.js:301\n // ./common/cpu.js:302\n\tthis.putUInt32 = function(value) // ./common/cpu.js:303\n\t{ // ./common/cpu.js:304\n\t\treturn; // ./common/cpu.js:305\n\t} // ./common/cpu.js:306\n} // ./common/cpu.js:307", "function start_pipeline(){\n var commands = [\n ['xsltproc', [meta_xslt, '-'] ],\n ['xsltproc', ['-', tmpfile] ]\n ];\n logger.log(tmpfile);\n var transform = create_pipeline( commands, response );\n transform.on( 'finish', clean_tmp_file);\n\n request.pipe( transform );\n }", "async start() {\n\t\tawait this.#preprocessor.execQueue();\n\t\tawait this.#pageGen.generatePages();\n\n\t\tthis.#emitter.emit('end');\n\t}", "function startProcessor(i, renderedRowsToProcess) {\n // Get the processor at 'i'\n var processor = self.rowsProcessors[i].processor;\n\n // Call the processor, passing in the rows to process and the current columns\n // (note: it's wrapped in $q.when() in case the processor does not return a promise)\n return $q.when( processor.call(self, renderedRowsToProcess, self.columns) )\n .then(function handleProcessedRows(processedRows) {\n // Check for errors\n if (!processedRows) {\n throw \"Processor at index \" + i + \" did not return a set of renderable rows\";\n }\n\n if (!angular.isArray(processedRows)) {\n throw \"Processor at index \" + i + \" did not return an array\";\n }\n\n // Processor is done, increment the counter\n i++;\n\n // If we're not done with the processors, call the next one\n if (i <= self.rowsProcessors.length - 1) {\n return startProcessor(i, processedRows);\n }\n // We're done! Resolve the 'finished' promise\n else {\n finished.resolve(processedRows);\n }\n });\n }", "function CommandProcessor(controller) {\n this.controller = controller;\n}", "processInit() {\n // if worker not use require it may not have setExecuteFn\n if (this.service.setExecuteFn) {\n this.service.setExecuteFn(this.proxyUpcomingExecute)\n }\n // HACK simplify states\n this.state = WORKERS_STATES.ready\n return this\n }", "createProcesses() {\n Object.keys(this.workers).forEach(type => {\n const env = {\n 'type': type,\n 'verbose': config.verbose,\n };\n this.workers[type] = this.fork(type, env);\n });\n }", "init() {\n //Maintain a Hash Map of all the running processes\n this.processMap = {}\n\n Utilities.initializeLineReader(\n (line) => {\n this.toggleProcess(line)\n },() => {\n const processes = Object.keys(this.processMap)\n if(processes.length === 0) {\n console.log('0')\n return\n }\n processes.map((pid) => {\n console.log(pid)\n })\n }\n )\n }", "function startProcessor(i, renderedColumnsToProcess) {\n // Get the processor at 'i'\n var processor = self.columnsProcessors[i].processor;\n\n // Call the processor, passing in the rows to process and the current columns\n // (note: it's wrapped in $q.when() in case the processor does not return a promise)\n return $q.when( processor.call(self, renderedColumnsToProcess, self.rows) )\n .then(function handleProcessedRows(processedColumns) {\n // Check for errors\n if (!processedColumns) {\n throw \"Processor at index \" + i + \" did not return a set of renderable rows\";\n }\n\n if (!angular.isArray(processedColumns)) {\n throw \"Processor at index \" + i + \" did not return an array\";\n }\n\n // Processor is done, increment the counter\n i++;\n\n // If we're not done with the processors, call the next one\n if (i <= self.columnsProcessors.length - 1) {\n return startProcessor(i, myRenderableColumns);\n }\n // We're done! Resolve the 'finished' promise\n else {\n finished.resolve(myRenderableColumns);\n }\n });\n }", "initCore() {\n this.memory = new Memory(this);\n this.cpu = new CPU(this);\n this.apu = new APU(this);\n this.ppu = new PPU(this);\n\n this.loadCartridge(this.cartridge);\n }", "makeStart() {\n this.type = Node.START;\n this.state = null;\n }", "on_assign_processor() {\n }", "start(){\n let _this = this;\n // run the main sequence every process_frequency seconds\n _this.logger.info('starting work');\n _this.execute = true;\n _this.run();\n }", "_preload() {\n const preloader = new Preloader();\n preloader.run().then(() => {\n this._start();\n });\n }", "init(kernel) {\n logger.log(this.name, \"init\");\n let test = new testProc(\"test\");\n kernel.startProcess(test);\n }", "function constructPipeline() {\n // console.log($rootScope.CSVdelim);\n // var separator = $rootScope.CSVdelim?$rootScope.CSVdelim:'\\\\,';\n var readDatasetFunct = new jsedn.List([\n new jsedn.sym('read-dataset'),\n new jsedn.sym('data-file')\n ]);\n\n pipeline = null;\n\n pipeline = new jsedn.List([\n jsedn.sym('defpipe'),\n jsedn.sym('my-pipe'),\n 'Grafter pipeline for data clean-up and preparation.',\n new jsedn.Vector([new jsedn.sym('data-file')]),\n new jsedn.List([jsedn.sym('->'), readDatasetFunct])\n ]);\n\n pipelineFunctions.map(function (arg) {\n pipeline.val[4].val.push(arg);\n });\n\n //(read-dataset data-file :format :csv)\n pipelineFunctions = new jsedn.List([]);\n return pipeline;\n}", "function setupScriptProcessor() {\n recorderNode = createRecorderScriptProcessor();\n recorderNode.port.postMessage({ sampleRate, });\n recorderNode.port.onmessage = (data) => {\n switch (data) {\n\n case 'startCapturing':\n dispatch(getActions().recordStart());\n break;\n\n default:\n captureAudio({data});\n }\n };\n source.connect(recorderNode);\n recorderNode.connect(getAudioContext().destination);\n}", "function startProcessor(i, renderedRowsToProcess) {\n // Get the processor at 'i'\n var processor = self.rowsProcessors[i];\n\n // Call the processor, passing in the rows to process and the current columns\n // (note: it's wrapped in $q.when() in case the processor does not return a promise)\n return $q.when( processor.call(self, renderedRowsToProcess, self.columns) )\n .then(function handleProcessedRows(processedRows) {\n // Check for errors\n if (!processedRows) {\n throw \"Processor at index \" + i + \" did not return a set of renderable rows\";\n }\n\n if (!angular.isArray(processedRows)) {\n throw \"Processor at index \" + i + \" did not return an array\";\n }\n\n // Processor is done, increment the counter\n i++;\n\n // If we're not done with the processors, call the next one\n if (i <= self.rowsProcessors.length - 1) {\n return startProcessor(i, processedRows);\n }\n // We're done! Resolve the 'finished' promise\n else {\n finished.resolve(processedRows);\n }\n });\n }", "function makeSwiper() {\n _this.calcSlides();\n if (params.loader.slides.length > 0 && _this.slides.length === 0) {\n _this.loadSlides();\n }\n if (params.loop) {\n _this.createLoop();\n }\n _this.init();\n initEvents();\n if (params.pagination) {\n _this.createPagination(true);\n }\n\n if (params.loop || params.initialSlide > 0) {\n _this.swipeTo(params.initialSlide, 0, false);\n }\n else {\n _this.updateActiveSlide(0);\n }\n if (params.autoplay) {\n _this.startAutoplay();\n }\n /**\n * Set center slide index.\n *\n * @author Tomaz Lovrec <[email protected]>\n */\n _this.centerIndex = _this.activeIndex;\n\n // Callbacks\n if (params.onSwiperCreated) _this.fireCallback(params.onSwiperCreated, _this);\n _this.callPlugins('onSwiperCreated');\n }", "initialize() {\n this._forkProcess();\n }", "function makeComputer(maker, Processor, Ram, HardDisc) {\n return {\n\t\tmaker : maker,\n\t\tProcessor : Processor,\n\t\tRam : Ram,\n\t\tHardDisc : HardDisc\n\t};\n}", "function makeSwiper() {\n _this.calcSlides();\n if (params.loader.slides.length > 0 && _this.slides.length === 0) {\n _this.loadSlides();\n }\n if (params.loop) {\n _this.createLoop();\n }\n _this.init();\n initEvents();\n if (params.pagination) {\n _this.createPagination(true);\n }\n\n if (params.loop || params.initialSlide > 0) {\n _this.swipeTo(params.initialSlide, 0, false);\n }\n else {\n _this.updateActiveSlide(0);\n }\n if (params.autoplay) {\n _this.startAutoplay();\n }\n /**\n * Set center slide index.\n *\n * @author Tomaz Lovrec <[email protected]>\n */\n _this.centerIndex = _this.activeIndex;\n\n // Callbacks\n if (params.onSwiperCreated) _this.fireCallback(params.onSwiperCreated, _this);\n _this.callPlugins('onSwiperCreated');\n }", "function startProcessor(i, renderedColumnsToProcess) {\n // Get the processor at 'i'\n var processor = self.columnsProcessors[i];\n\n // Call the processor, passing in the rows to process and the current columns\n // (note: it's wrapped in $q.when() in case the processor does not return a promise)\n return $q.when( processor.call(self, renderedColumnsToProcess, self.rows) )\n .then(function handleProcessedRows(processedColumns) {\n // Check for errors\n if (!processedColumns) {\n throw \"Processor at index \" + i + \" did not return a set of renderable rows\";\n }\n\n if (!angular.isArray(processedColumns)) {\n throw \"Processor at index \" + i + \" did not return an array\";\n }\n\n // Processor is done, increment the counter\n i++;\n\n // If we're not done with the processors, call the next one\n if (i <= self.columnsProcessors.length - 1) {\n return startProcessor(i, myRenderableColumns);\n }\n // We're done! Resolve the 'finished' promise\n else {\n finished.resolve(myRenderableColumns);\n }\n });\n }", "function build_processor_config(el){\n\n var select \t\t\t= $(el),\n templ\t\t\t= $('#' + select.val() + '-tmpl').length ? $('#' + select.val() + '-tmpl').html() : '',\n parent\t\t\t= select.closest('.caldera-editor-processor-config-wrapper'),\n target\t\t\t= parent.find('.caldera-config-processor-setup'),\n template \t\t= Handlebars.compile(templ),\n config\t\t\t= parent.find('.processor_config_string').val(),\n current_type\t= select.data('type');\n\n // Be sure to load the processors preset when switching back to the initial processor type.\n if(config.length && current_type === select.val() ){\n config = JSON.parse(config);\n }else{\n // default config\n config = processor_defaults[select.val() + '_cfg'];\n }\n\n // build template\n if(!config){\n config = {};\n }\n\n config._id = parent.prop('id');\n config._name = 'config[processors][' + parent.prop('id') + '][config]';\n\n\n\n\n template = $('<div>').html( template( config ) );\n\n // send to target\n target.html( template.html() );\n\n // check for init function\n if( typeof window[select.val() + '_init'] === 'function' ){\n window[select.val() + '_init'](parent.prop('id'), target);\n }\n\n // check if conditions are allowed\n if(parent.find('.no-conditions').length){\n // conditions are not supported - remove them\n parent.find('.toggle_option_tab').remove();\n }\n\n\n rebuild_field_binding();\n baldrickTriggers();\n\n // initialise baldrick triggers\n $('.wp-baldrick').baldrick({\n request : cfAdminAJAX,\n method : 'POST',\n before\t\t: function(el){\n\n var tr = $(el);\n\n if( tr.data('addNode') && !tr.data('request') ){\n tr.data('request', 'cf_get_default_setting');\n }\n }\n });\n\n }", "function processor() {\n var resource = resourceArray.pop();\n // console.log(\"Assessing demand \", resource);\n\n if(typeof(resource) === 'undefined') {\n console.log('All demands met');\n next();\n } else {\n var predicate = authorisationTypes[resource];\n\n if(!predicate) {\n throw \"Undefined resource demand: \"+resource;\n }\n\n predicate(req, res, processor);\n }\n }", "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 init(templateProcessors, templates, defaultOpts, helpers, basePath) {\n function processTemplate(templateName, templateVariables, opts) {\n if (templates.has(templateName)) {\n const templateObject = templates.get(templateName);\n for (const [processorName, processor] of templateProcessors.entries()) {\n const extIndex = processor.extensions.indexOf(templateObject.ext);\n if (extIndex !== -1) {\n const mergedOptions = Object.assign(\n { filenameWithPath: `${basePath}/${defaultOpts.common.path}/${templateName}${templateObject.ext}` },\n defaultOpts.common,\n defaultOpts[processorName],\n opts\n );\n return processor.process(templateName, templateObject.template, mergedOptions, templateVariables, helpers);\n }\n }\n throw new Error(`No template processor found for extension: ${templateObject.ext}.`);\n } else {\n throw Error(`Template: \"${templateName}\" does not exist`);\n }\n }\n\n // Offer direct access to individual processors\n for (const [name, fn] of templateProcessors.entries()) {\n processTemplate[name] = fn.process;\n }\n\n return processTemplate;\n}", "start () {\n return testPF(this.m, this.p0, this.q, this.r)\n }", "function InlineWorkerFactory(){\n\t}", "async generateOne() {\n return await this.dagObj.generateOne();\n }", "function Waiter(processor) {\n let completed = 0;\n let size = 0;\n\n this.execute = function(input) {\n return new Promise((resolve) => {\n size = input.length;\n\n if (size === 0) {\n resolve()\n return;\n }\n\n for (let x = 0; x < size; x++) {\n processor(input[x], completion);\n }\n\n function completion() {\n completed += 1;\n\n if (completed === size) {\n resolve()\n }\n }\n });\n };\n}", "function createNextTask() {\n if (taskId >= ctx.instance.renderers.length) {\n done();\n return;\n }\n\n var task = {\n consumerId: ctx.instance.consumerId,\n batchId: ctx.instance.batchId,\n renderer: ctx.instance.renderers[taskId],\n message: ctx.instance.message\n };\n taskId++;\n\n PreviewTask.create(task, function(err, obj) {\n if (err) {\n console.log('Failed to create new task', task, err);\n // Is there a better way to report this failure?\n done();\n }\n else {\n createNextTask();\n }\n });\n }", "function startQueueProcessor() {\n\n if ( typeof( processInfo ) === 'undefined' ) processInfo = 'Process ' + processFromStatus + ' to ' + processToStatus\n if ( typeof( pollInterval ) === 'undefined' ) pollInterval = 2000\n\n log.i( '' );\n log.i( '----- DLINK JDE PDF Queue Processor Started - ' + processInfo ); \n log.i( '' ); \n log.i( 'JDE Environment : ' + jdeEnv );\n log.i( 'JDE Database : ' + jdeEnvDb );\n log.i( '' ); \n log.i( 'Polling Interval : ' + pollInterval);\n log.i( '' ); \n log.i( 'Pick up Queued PDF files at status ' + processFromStatus + ' - process then - move to status ' + processToStatus ); \n log.i( '' );\n\n // Handle process exit from DOCKER STOP, system interrupts, uncaughtexceptions or CTRL-C \n ondeath( endMonitorProcess );\n\n // First need to establish an oracle DB connection pool to work with\n establishPool();\n\n}", "static register(type) {\n if(OS.kernel) OS.kernel.register(type);\n else processTypes.push(type);\n }", "createContinuousProducer (turnipYield) {\n return new ContinuousProducer({\n turnipYield: turnipYield\n })\n }", "process (filepath) {\n\t\tlet {\n\t\t\tchassis,\n\t\t\tgenerateNamespacedSelector,\n\t\t\tisNamespaced,\n\t\t\tnamespaceSelectors,\n\t\t\tprocessImports,\n\t\t\tprocessNesting,\n\t\t\tprocessAtRules,\n\t\t\tprocessMixins,\n\t\t\tprocessNot,\n\t\t\tprocessFunctions,\n\t\t\tstoreAtRules,\n\t\t\ttypographyEngineIsInitialized\n\t\t} = this\n\n\t\tlet {\n\t\t\tatRules,\n\t\t\tpost,\n\t\t\tsettings,\n\t\t\tutils\n\t\t} = chassis\n\n\t\tlet tasks = new NGN.Tasks()\n\t\tlet sourceMap\n\n\t\ttasks.add('Processing Imports', next => {\n\t\t\tif (typographyEngineIsInitialized) {\n\t\t\t\tthis.tree.walkAtRules('import', atRule => {\n\t\t\t\t\tchassis.imports.push(atRule.params)\n\t\t\t\t\tatRule.remove()\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tprocessImports()\n\t\t\tprocessNesting()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Mixins', next => {\n\t\t\tprocessMixins()\n\t\t\tprocessNot()\n\t\t\tprocessNesting()\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Functions', next => {\n\t\t\tprocessFunctions()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Namespacing Selectors', next => {\n\t\t\tnamespaceSelectors()\n\t\t\tnext()\n\t\t})\n\n\t\tif (typographyEngineIsInitialized) {\n\t\t\ttasks.add('Initializing Typography Engine', next => {\n\t\t\t\tthis.tree = this.core.css.append(this.tree)\n\t\t\t\tnext()\n\t\t\t})\n\t\t}\n\n\t\ttasks.add('Running Post-Processing Routines', next => {\n\t\t\tthis.tree.walkAtRules('chassis-post', atRule => {\n\t\t\t\tlet data = Object.assign({\n\t\t\t\t\troot: this.tree,\n\t\t\t\t\tatRule\n\t\t\t\t}, atRules.getProperties(atRule))\n\n\t\t\t\tpost.process(data)\n\t\t\t})\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing CSS4 Syntax', next => {\n\t\t\tenv.process(this.tree, {from: filepath}, settings.envCfg).then(processed => {\n\t\t\t\tthis.tree = processed.root\n\t\t\t\tnext()\n\t\t\t}, err => console.error(err))\n\t\t})\n\n\t\t// tasks.add('Merging matching adjacent rules...', next => {\n\t\t// \toutput = mergeAdjacentRules.process(output.toString())\n\t\t// \tnext()\n\t\t// })\n\n\t\ttasks.add('Beautifying Output', next => {\n\t\t\tremoveComments.process(this.tree).then(result => {\n\t\t\t\tperfectionist.process(result.css).then(result => {\n\t\t\t\t\tthis.tree = result.root\n\n\t\t\t\t\t// Remove empty rulesets\n\t\t\t\t\tthis.tree.walkRules(rule => {\n\t\t\t\t\t\tif (rule.nodes.length === 0) {\n\t\t\t\t\t\t\trule.remove()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\n\t\t\t\t\tnext()\n\t\t\t\t}, () => {\n\t\t\t\t\tthis.emit('processing.error', new Error('Error Beautifying Output'))\n\t\t\t\t})\n\t\t\t}, () => {\n\t\t\t\tthis.emit('processing.error', new Error('Error Removing Comments'))\n\t\t\t})\n\t\t})\n\n\t\tif (settings.minify) {\n\t\t\tlet minified\n\n\t\t\ttasks.add('Minifying Output', next => {\n\t\t\t\tminified = new CleanCss({\n\t\t\t\t\tsourceMap: settings.sourceMap\n\t\t\t\t}).minify(this.tree.toString())\n\n\t\t\t\tthis.tree = minified.styles\n\t\t\t\tnext()\n\t\t\t})\n\n\t\t\tif (settings.sourceMap) {\n\t\t\t\ttasks.add('Generating source map', next => {\n\t\t\t\t\tsourceMap = minified.sourceMap.toString()\n\t\t\t\t\tnext()\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// tasks.on('taskstart', evt => console.log(`${evt.name}...`))\n\t\t// tasks.on('taskcomplete', evt => console.log('Done.'))\n\n\t\ttasks.on('complete', () => this.emit('processing.complete', {\n\t\t\tcss: this.tree.toString(),\n\t\t\tsourceMap\n\t\t}))\n\n\t\tthis.emit('processing')\n\t\ttasks.run(true)\n\t}", "core(name, priority, type, memory) {\n if(!isNaN(name)) throw new OSError('Core processes must be named');\n if(this.exists_(name)) return;\n this.runCore_(name, priority, type, memory, 0);\n }", "create() {\n\t}", "preload () {}", "configureProprocessor(name, options) {\n this.config[name] = Object.assign({}, this.config[name], options)\n return this\n }", "preStart() {\n }", "function startPipeline() {\n // In this way we read one block while we decode and play another.\n if (state.state == STATE.PLAYING) {\n processState();\n }\n processState();\n }", "function construct() { }", "function start() {\n\n gw_job_process.UI();\n gw_job_process.procedure();\n gw_com_module.startPage();\n\n //processRetrieve({});\n\n }", "spawnNewGameObjectAtStart(type) {\n\t\tlet xy = this.getRandomCoordinateAtStart();\n\t\tthis.spawnNewGameObject(type, xy.x, xy.y);\n\t}", "preload() {\n \n }", "start() {\n\t\t\tif (this._running) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._scheduler = new Scheduler();\n\t\t\tthis._running = true;\n\n\t\t\tprocessBuffer.call(this);\n\t\t}", "function create() {\n if (gameState === \"Menu\") {\n menuGroupSetup();\n } else if (gameState === \"Playing\") {\n game.world.removeAll();\n stageGroupSetup();\n entityGroupSetup();\n guiGroupSetup();\n game.sound.setDecodedCallback([monsterLaugh, mainTheme], playIntro);\n } else if (gameState === \"GameOver\") {\n gameOverGroupSetup();\n } else if (gameState === \"Win\") {\n gameWinGroupSetup();\n }\n\n game.input.mouse.capture = true;\n cursors = game.input.keyboard.createCursorKeys();\n }", "function start ()\n{\n if (typeof (webphone_api.plhandler) === 'undefined' || webphone_api.plhandler === null)\n {\n return webphone_api.addtoqueue('Start', [parameters, true]);\n }\n else\n return webphone_api.plhandler.Start(parameters, true);\n}", "create () {}", "create () {}", "createModule(factory) {\n try {\n if (!factory) {\n new Message(faust.getErrorMessage());\n Utilitary.hideFullPageLoading();\n return;\n }\n var module = new ModuleClass(Utilitary.idX++, this.tempModuleX, this.tempModuleY, this.tempModuleName, document.getElementById(\"modules\"), (module) => { this.removeModule(module); }, this.compileFaust);\n module.moduleFaust.setSource(this.tempModuleSourceCode);\n module.createDSP(factory, () => {\n module.patchID = this.tempPatchId;\n if (this.tempParams) {\n for (var i = 0; i < this.tempParams.sliders.length; i++) {\n var slider = this.tempParams.sliders[i];\n module.addInterfaceParam(slider.path, parseFloat(slider.value));\n }\n }\n module.moduleFaust.recallInputsSource = this.arrayRecalScene[0].inputs.source;\n module.moduleFaust.recallOutputsDestination = this.arrayRecalScene[0].outputs.destination;\n this.arrayRecalledModule.push(module);\n module.recallInterfaceParams();\n module.setFaustInterfaceControles();\n module.createFaustInterface();\n module.addInputOutputNodes();\n if (factory.isMidi) {\n module.isMidi = true;\n module.addMidiControlNode();\n }\n this.addModule(module);\n //next module\n this.arrayRecalScene.shift();\n this.launchModuleCreation();\n });\n }\n catch (e) {\n console.log(e);\n new Message(Utilitary.messageRessource.errorCreateModuleRecall);\n //next module\n this.arrayRecalScene.shift();\n this.launchModuleCreation();\n }\n }", "peek() { // gives the process a reference number; only dequeues the process once it's done or have to be moved to the next priority queue \n return this.processes[0]; // 0 index references/points to the process that was recently added \n }", "create() {}", "create() {}", "get_processor_kwargs() {\n return {}\n }", "preload() {\n\n }", "function createCiteproc(citeprocJSONObject, citeprocSys, citeprocStyle){\n\t\tvar defaultCiteprocSys = {\n\t\t retrieveItem: function(id){\n\t\t return citeprocJSONObject.citationItems[id];\n\t\t },\n\t\t retrieveLocale: function(lang){\n\t\t return defaultLocale[lang];\n\t\t }\n\t\t}\n\t\tif (!citeprocSys)\n\t\t\tciteprocSys = defaultCiteprocSys;\n\t\tif (!citeprocStyle)\n\t\t\tciteprocStyle = styleChigcagoAD;\t\t\n\t\treturn new CSL.Engine( citeprocSys, citeprocStyle );\n\t}", "constructor() { \n \n ProcessDefinitionDto.initialize(this);\n }", "assign_processor(processor_id) {\n this.processor_id = processor_id\n\n this._refresh_source_icon()\n\n this.on_assign_processor()\n\n // Now that we have a processor/source, refresh\n this.viewer.refresh_widget(this)\n }", "function ProcessDevice(){\r this.name = \"ProcessDevice\";\r this.xpath = \"//device[@type = 'VCO']\";\t\r this.apply = function(myElement, myRuleProcessor){\r var myNewElement = myContainerElement.xmlElements.add(app.documents.item(0).xmlTags.item(\"Row\"));\r return true;\r }\t\t\r}", "function createProcess(process) {\n return ProcessModel.create(process);\n}", "function preload() {\n // Step 1.1 code goes here\n\n // Step 8.1 code goes here\n}" ]
[ "0.58117294", "0.58117294", "0.58117294", "0.5587444", "0.5587444", "0.55766463", "0.54808366", "0.54090774", "0.53975576", "0.53039163", "0.52645934", "0.51741904", "0.51741904", "0.51741904", "0.51689416", "0.50885534", "0.5075839", "0.5067456", "0.5064785", "0.5058559", "0.5053901", "0.5019625", "0.5001191", "0.49952915", "0.49372825", "0.48942283", "0.488796", "0.48800248", "0.4876763", "0.4843097", "0.4843097", "0.48425052", "0.4837369", "0.48145053", "0.4812016", "0.4811143", "0.47990143", "0.4792245", "0.4780331", "0.47724095", "0.47686878", "0.47489536", "0.47476402", "0.47347802", "0.47075412", "0.47055498", "0.469227", "0.46877295", "0.4655811", "0.46536762", "0.4648828", "0.46427834", "0.46187276", "0.46174374", "0.4607455", "0.4606206", "0.45871246", "0.45792845", "0.45712835", "0.45614713", "0.45383433", "0.45263612", "0.4504276", "0.4496534", "0.4496512", "0.44872186", "0.4485506", "0.44814467", "0.44711316", "0.4461799", "0.44574526", "0.44494745", "0.44448245", "0.4443652", "0.44413728", "0.44388664", "0.44264388", "0.44223914", "0.44195643", "0.4411824", "0.44116992", "0.44116196", "0.44058928", "0.44058928", "0.4404992", "0.4404646", "0.4398955", "0.4398955", "0.43970522", "0.43960455", "0.43930292", "0.43853313", "0.4375669", "0.43753242", "0.43748018", "0.4368041" ]
0.5479166
10
Create a new processor based on the processor in the current scope.
function processor() { var destination = unified() var length = attachers.length var index = -1 while (++index < length) { destination.use.apply(null, attachers[index]) } destination.data(extend(true, {}, namespace)) return destination }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function unified() {\n var attachers = []\n var transformers = trough()\n var namespace = {}\n var freezeIndex = -1\n var frozen\n\n // Data management.\n processor.data = data\n\n // Lock.\n processor.freeze = freeze\n\n // Plugins.\n processor.attachers = attachers\n processor.use = use\n\n // API.\n processor.parse = parse\n processor.stringify = stringify\n processor.run = run\n processor.runSync = runSync\n processor.process = process\n processor.processSync = processSync\n\n // Expose.\n return processor\n\n // Create a new processor based on the processor in the current scope.\n function processor() {\n var destination = unified()\n var index = -1\n\n while (++index < attachers.length) {\n destination.use.apply(null, attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }\n\n // Freeze: used to signal a processor that has finished configuration.\n //\n // For example, take unified itself: it’s frozen.\n // Plugins should not be added to it.\n // Rather, it should be extended, by invoking it, before modifying it.\n //\n // In essence, always invoke this when exporting a processor.\n function freeze() {\n var values\n var transformer\n\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n values = attachers[freezeIndex]\n\n if (values[1] === false) {\n continue\n }\n\n if (values[1] === true) {\n values[1] = undefined\n }\n\n transformer = values[0].apply(processor, values.slice(1))\n\n if (typeof transformer === 'function') {\n transformers.use(transformer)\n }\n }\n\n frozen = true\n freezeIndex = Infinity\n\n return processor\n }\n\n // Data management.\n // Getter / setter for processor-specific informtion.\n function data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen)\n namespace[key] = value\n return processor\n }\n\n // Get `key`.\n return (own.call(namespace, key) && namespace[key]) || null\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', frozen)\n namespace = key\n return processor\n }\n\n // Get space.\n return namespace\n }\n\n // Plugin management.\n //\n // Pass it:\n // * an attacher and options,\n // * a preset,\n // * a list of presets, attachers, and arguments (list of attachers and\n // options).\n function use(value) {\n var settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin.apply(null, arguments)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings)\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings)\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n while (++index < plugins.length) {\n add(plugins[index])\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin)\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(true, entry[1], value)\n }\n\n entry[1] = value\n } else {\n attachers.push(slice.call(arguments))\n }\n }\n }\n\n function find(plugin) {\n var index = -1\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n return attachers[index]\n }\n }\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor.\n function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), async.\n function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(error, tree, file) {\n tree = tree || node\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), sync.\n function runSync(node, file) {\n var result\n var complete\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(error, tree) {\n complete = true\n result = tree\n bail(error)\n }\n }\n\n // Stringify a unist node representation of a file (in string or vfile\n // representation) into a string using the `Compiler` on the processor.\n function stringify(node, doc) {\n var file = vfile(doc)\n var Compiler\n\n freeze()\n Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler, 'compile')) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor, then run transforms on that node, and\n // compile the resulting node using the `Compiler` on the processor, and\n // store that result on the vfile.\n function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(error) {\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }\n\n // Process the given document (in string or vfile representation), sync.\n function processSync(doc) {\n var file\n var complete\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(error) {\n complete = true\n bail(error)\n }\n }\n}", "function unified() {\n var attachers = []\n var transformers = trough()\n var namespace = {}\n var freezeIndex = -1\n var frozen\n\n // Data management.\n processor.data = data\n\n // Lock.\n processor.freeze = freeze\n\n // Plugins.\n processor.attachers = attachers\n processor.use = use\n\n // API.\n processor.parse = parse\n processor.stringify = stringify\n processor.run = run\n processor.runSync = runSync\n processor.process = process\n processor.processSync = processSync\n\n // Expose.\n return processor\n\n // Create a new processor based on the processor in the current scope.\n function processor() {\n var destination = unified()\n var index = -1\n\n while (++index < attachers.length) {\n destination.use.apply(null, attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }\n\n // Freeze: used to signal a processor that has finished configuration.\n //\n // For example, take unified itself: it’s frozen.\n // Plugins should not be added to it.\n // Rather, it should be extended, by invoking it, before modifying it.\n //\n // In essence, always invoke this when exporting a processor.\n function freeze() {\n var values\n var transformer\n\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n values = attachers[freezeIndex]\n\n if (values[1] === false) {\n continue\n }\n\n if (values[1] === true) {\n values[1] = undefined\n }\n\n transformer = values[0].apply(processor, values.slice(1))\n\n if (typeof transformer === 'function') {\n transformers.use(transformer)\n }\n }\n\n frozen = true\n freezeIndex = Infinity\n\n return processor\n }\n\n // Data management.\n // Getter / setter for processor-specific informtion.\n function data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen)\n namespace[key] = value\n return processor\n }\n\n // Get `key`.\n return (own.call(namespace, key) && namespace[key]) || null\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', frozen)\n namespace = key\n return processor\n }\n\n // Get space.\n return namespace\n }\n\n // Plugin management.\n //\n // Pass it:\n // * an attacher and options,\n // * a preset,\n // * a list of presets, attachers, and arguments (list of attachers and\n // options).\n function use(value) {\n var settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin.apply(null, arguments)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings)\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings)\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n while (++index < plugins.length) {\n add(plugins[index])\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin)\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(true, entry[1], value)\n }\n\n entry[1] = value\n } else {\n attachers.push(slice.call(arguments))\n }\n }\n }\n\n function find(plugin) {\n var index = -1\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n return attachers[index]\n }\n }\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor.\n function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), async.\n function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(error, tree, file) {\n tree = tree || node\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), sync.\n function runSync(node, file) {\n var result\n var complete\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(error, tree) {\n complete = true\n result = tree\n bail(error)\n }\n }\n\n // Stringify a unist node representation of a file (in string or vfile\n // representation) into a string using the `Compiler` on the processor.\n function stringify(node, doc) {\n var file = vfile(doc)\n var Compiler\n\n freeze()\n Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler, 'compile')) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor, then run transforms on that node, and\n // compile the resulting node using the `Compiler` on the processor, and\n // store that result on the vfile.\n function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(error) {\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }\n\n // Process the given document (in string or vfile representation), sync.\n function processSync(doc) {\n var file\n var complete\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(error) {\n complete = true\n bail(error)\n }\n }\n}", "function unified() {\n var attachers = []\n var transformers = trough()\n var namespace = {}\n var frozen = false\n var freezeIndex = -1\n\n // Data management.\n processor.data = data\n\n // Lock.\n processor.freeze = freeze\n\n // Plugins.\n processor.attachers = attachers\n processor.use = use\n\n // API.\n processor.parse = parse\n processor.stringify = stringify\n processor.run = run\n processor.runSync = runSync\n processor.process = process\n processor.processSync = processSync\n\n // Expose.\n return processor\n\n // Create a new processor based on the processor in the current scope.\n function processor() {\n var destination = unified()\n var length = attachers.length\n var index = -1\n\n while (++index < length) {\n destination.use.apply(null, attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }\n\n // Freeze: used to signal a processor that has finished configuration.\n //\n // For example, take unified itself: it’s frozen.\n // Plugins should not be added to it.\n // Rather, it should be extended, by invoking it, before modifying it.\n //\n // In essence, always invoke this when exporting a processor.\n function freeze() {\n var values\n var plugin\n var options\n var transformer\n\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n values = attachers[freezeIndex]\n plugin = values[0]\n options = values[1]\n transformer = null\n\n if (options === false) {\n continue\n }\n\n if (options === true) {\n values[1] = undefined\n }\n\n transformer = plugin.apply(processor, values.slice(1))\n\n if (typeof transformer === 'function') {\n transformers.use(transformer)\n }\n }\n\n frozen = true\n freezeIndex = Infinity\n\n return processor\n }\n\n // Data management.\n // Getter / setter for processor-specific informtion.\n function data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen)\n\n namespace[key] = value\n\n return processor\n }\n\n // Get `key`.\n return (own.call(namespace, key) && namespace[key]) || null\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', frozen)\n namespace = key\n return processor\n }\n\n // Get space.\n return namespace\n }\n\n // Plugin management.\n //\n // Pass it:\n // * an attacher and options,\n // * a preset,\n // * a list of presets, attachers, and arguments (list of attachers and\n // options).\n function use(value) {\n var settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin.apply(null, arguments)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings)\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings)\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var length\n var index\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n length = plugins.length\n index = -1\n\n while (++index < length) {\n add(plugins[index])\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin)\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(entry[1], value)\n }\n\n entry[1] = value\n } else {\n attachers.push(slice.call(arguments))\n }\n }\n }\n\n function find(plugin) {\n var length = attachers.length\n var index = -1\n var entry\n\n while (++index < length) {\n entry = attachers[index]\n\n if (entry[0] === plugin) {\n return entry\n }\n }\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor.\n function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), async.\n function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), sync.\n function runSync(node, file) {\n var complete = false\n var result\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(err, tree) {\n complete = true\n bail(err)\n result = tree\n }\n }\n\n // Stringify a unist node representation of a file (in string or vfile\n // representation) into a string using the `Compiler` on the processor.\n function stringify(node, doc) {\n var file = vfile(doc)\n var Compiler\n\n freeze()\n Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler, 'compile')) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor, then run transforms on that node, and\n // compile the resulting node using the `Compiler` on the processor, and\n // store that result on the vfile.\n function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }\n\n // Process the given document (in string or vfile representation), sync.\n function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }\n}", "function unified() {\n var attachers = []\n var transformers = trough()\n var namespace = {}\n var frozen = false\n var freezeIndex = -1\n\n /* Data management. */\n processor.data = data\n\n /* Lock. */\n processor.freeze = freeze\n\n /* Plug-ins. */\n processor.attachers = attachers\n processor.use = use\n\n /* API. */\n processor.parse = parse\n processor.stringify = stringify\n processor.run = run\n processor.runSync = runSync\n processor.process = process\n processor.processSync = processSync\n\n /* Expose. */\n return processor\n\n /* Create a new processor based on the processor\n * in the current scope. */\n function processor() {\n var destination = unified()\n var length = attachers.length\n var index = -1\n\n while (++index < length) {\n destination.use.apply(null, attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }\n\n /* Freeze: used to signal a processor that has finished\n * configuration.\n *\n * For example, take unified itself. It’s frozen.\n * Plug-ins should not be added to it. Rather, it should\n * be extended, by invoking it, before modifying it.\n *\n * In essence, always invoke this when exporting a\n * processor. */\n function freeze() {\n var values\n var plugin\n var options\n var transformer\n\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n values = attachers[freezeIndex]\n plugin = values[0]\n options = values[1]\n transformer = null\n\n if (options === false) {\n continue\n }\n\n if (options === true) {\n values[1] = undefined\n }\n\n transformer = plugin.apply(processor, values.slice(1))\n\n if (typeof transformer === 'function') {\n transformers.use(transformer)\n }\n }\n\n frozen = true\n freezeIndex = Infinity\n\n return processor\n }\n\n /* Data management.\n * Getter / setter for processor-specific informtion. */\n function data(key, value) {\n if (string(key)) {\n /* Set `key`. */\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen)\n\n namespace[key] = value\n\n return processor\n }\n\n /* Get `key`. */\n return (own.call(namespace, key) && namespace[key]) || null\n }\n\n /* Set space. */\n if (key) {\n assertUnfrozen('data', frozen)\n namespace = key\n return processor\n }\n\n /* Get space. */\n return namespace\n }\n\n /* Plug-in management.\n *\n * Pass it:\n * * an attacher and options,\n * * a preset,\n * * a list of presets, attachers, and arguments (list\n * of attachers and options). */\n function use(value) {\n var settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n /* Empty */\n } else if (typeof value === 'function') {\n addPlugin.apply(null, arguments)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings)\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings)\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var length\n var index\n\n if (plugins === null || plugins === undefined) {\n /* Empty */\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n length = plugins.length\n index = -1\n\n while (++index < length) {\n add(plugins[index])\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin)\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(entry[1], value)\n }\n\n entry[1] = value\n } else {\n attachers.push(slice.call(arguments))\n }\n }\n }\n\n function find(plugin) {\n var length = attachers.length\n var index = -1\n var entry\n\n while (++index < length) {\n entry = attachers[index]\n\n if (entry[0] === plugin) {\n return entry\n }\n }\n }\n\n /* Parse a file (in string or VFile representation)\n * into a Unist node using the `Parser` on the\n * processor. */\n function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n /* Run transforms on a Unist node representation of a file\n * (in string or VFile representation), async. */\n function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }\n\n /* Run transforms on a Unist node representation of a file\n * (in string or VFile representation), sync. */\n function runSync(node, file) {\n var complete = false\n var result\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(err, tree) {\n complete = true\n bail(err)\n result = tree\n }\n }\n\n /* Stringify a Unist node representation of a file\n * (in string or VFile representation) into a string\n * using the `Compiler` on the processor. */\n function stringify(node, doc) {\n var file = vfile(doc)\n var Compiler\n\n freeze()\n Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler)) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n /* Parse a file (in string or VFile representation)\n * into a Unist node using the `Parser` on the processor,\n * then run transforms on that node, and compile the\n * resulting node using the `Compiler` on the processor,\n * and store that result on the VFile. */\n function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }\n\n /* Process the given document (in string or VFile\n * representation), sync. */\n function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }\n}", "function unified() {\n var attachers = []\n var transformers = trough()\n var namespace = {}\n var frozen = false\n var freezeIndex = -1\n\n /* Data management. */\n processor.data = data\n\n /* Lock. */\n processor.freeze = freeze\n\n /* Plug-ins. */\n processor.attachers = attachers\n processor.use = use\n\n /* API. */\n processor.parse = parse\n processor.stringify = stringify\n processor.run = run\n processor.runSync = runSync\n processor.process = process\n processor.processSync = processSync\n\n /* Expose. */\n return processor\n\n /* Create a new processor based on the processor\n * in the current scope. */\n function processor() {\n var destination = unified()\n var length = attachers.length\n var index = -1\n\n while (++index < length) {\n destination.use.apply(null, attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }\n\n /* Freeze: used to signal a processor that has finished\n * configuration.\n *\n * For example, take unified itself. It’s frozen.\n * Plug-ins should not be added to it. Rather, it should\n * be extended, by invoking it, before modifying it.\n *\n * In essence, always invoke this when exporting a\n * processor. */\n function freeze() {\n var values\n var plugin\n var options\n var transformer\n\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n values = attachers[freezeIndex]\n plugin = values[0]\n options = values[1]\n transformer = null\n\n if (options === false) {\n continue\n }\n\n if (options === true) {\n values[1] = undefined\n }\n\n transformer = plugin.apply(processor, values.slice(1))\n\n if (typeof transformer === 'function') {\n transformers.use(transformer)\n }\n }\n\n frozen = true\n freezeIndex = Infinity\n\n return processor\n }\n\n /* Data management.\n * Getter / setter for processor-specific informtion. */\n function data(key, value) {\n if (string(key)) {\n /* Set `key`. */\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen)\n\n namespace[key] = value\n\n return processor\n }\n\n /* Get `key`. */\n return (own.call(namespace, key) && namespace[key]) || null\n }\n\n /* Set space. */\n if (key) {\n assertUnfrozen('data', frozen)\n namespace = key\n return processor\n }\n\n /* Get space. */\n return namespace\n }\n\n /* Plug-in management.\n *\n * Pass it:\n * * an attacher and options,\n * * a preset,\n * * a list of presets, attachers, and arguments (list\n * of attachers and options). */\n function use(value) {\n var settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n /* Empty */\n } else if (typeof value === 'function') {\n addPlugin.apply(null, arguments)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings)\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings)\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var length\n var index\n\n if (plugins === null || plugins === undefined) {\n /* Empty */\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n length = plugins.length\n index = -1\n\n while (++index < length) {\n add(plugins[index])\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin)\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(entry[1], value)\n }\n\n entry[1] = value\n } else {\n attachers.push(slice.call(arguments))\n }\n }\n }\n\n function find(plugin) {\n var length = attachers.length\n var index = -1\n var entry\n\n while (++index < length) {\n entry = attachers[index]\n\n if (entry[0] === plugin) {\n return entry\n }\n }\n }\n\n /* Parse a file (in string or VFile representation)\n * into a Unist node using the `Parser` on the\n * processor. */\n function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n /* Run transforms on a Unist node representation of a file\n * (in string or VFile representation), async. */\n function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }\n\n /* Run transforms on a Unist node representation of a file\n * (in string or VFile representation), sync. */\n function runSync(node, file) {\n var complete = false\n var result\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(err, tree) {\n complete = true\n bail(err)\n result = tree\n }\n }\n\n /* Stringify a Unist node representation of a file\n * (in string or VFile representation) into a string\n * using the `Compiler` on the processor. */\n function stringify(node, doc) {\n var file = vfile(doc)\n var Compiler\n\n freeze()\n Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler)) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n /* Parse a file (in string or VFile representation)\n * into a Unist node using the `Parser` on the processor,\n * then run transforms on that node, and compile the\n * resulting node using the `Compiler` on the processor,\n * and store that result on the VFile. */\n function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }\n\n /* Process the given document (in string or VFile\n * representation), sync. */\n function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }\n}", "function unified() {\n var attachers = []\n var transformers = trough()\n var namespace = {}\n var frozen = false\n var freezeIndex = -1\n\n /* Data management. */\n processor.data = data\n\n /* Lock. */\n processor.freeze = freeze\n\n /* Plug-ins. */\n processor.attachers = attachers\n processor.use = use\n\n /* API. */\n processor.parse = parse\n processor.stringify = stringify\n processor.run = run\n processor.runSync = runSync\n processor.process = process\n processor.processSync = processSync\n\n /* Expose. */\n return processor\n\n /* Create a new processor based on the processor\n * in the current scope. */\n function processor() {\n var destination = unified()\n var length = attachers.length\n var index = -1\n\n while (++index < length) {\n destination.use.apply(null, attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }\n\n /* Freeze: used to signal a processor that has finished\n * configuration.\n *\n * For example, take unified itself. It’s frozen.\n * Plug-ins should not be added to it. Rather, it should\n * be extended, by invoking it, before modifying it.\n *\n * In essence, always invoke this when exporting a\n * processor. */\n function freeze() {\n var values\n var plugin\n var options\n var transformer\n\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n values = attachers[freezeIndex]\n plugin = values[0]\n options = values[1]\n transformer = null\n\n if (options === false) {\n continue\n }\n\n if (options === true) {\n values[1] = undefined\n }\n\n transformer = plugin.apply(processor, values.slice(1))\n\n if (typeof transformer === 'function') {\n transformers.use(transformer)\n }\n }\n\n frozen = true\n freezeIndex = Infinity\n\n return processor\n }\n\n /* Data management.\n * Getter / setter for processor-specific informtion. */\n function data(key, value) {\n if (string(key)) {\n /* Set `key`. */\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen)\n\n namespace[key] = value\n\n return processor\n }\n\n /* Get `key`. */\n return (own.call(namespace, key) && namespace[key]) || null\n }\n\n /* Set space. */\n if (key) {\n assertUnfrozen('data', frozen)\n namespace = key\n return processor\n }\n\n /* Get space. */\n return namespace\n }\n\n /* Plug-in management.\n *\n * Pass it:\n * * an attacher and options,\n * * a preset,\n * * a list of presets, attachers, and arguments (list\n * of attachers and options). */\n function use(value) {\n var settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n /* Empty */\n } else if (typeof value === 'function') {\n addPlugin.apply(null, arguments)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings)\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings)\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var length\n var index\n\n if (plugins === null || plugins === undefined) {\n /* Empty */\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n length = plugins.length\n index = -1\n\n while (++index < length) {\n add(plugins[index])\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin)\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(entry[1], value)\n }\n\n entry[1] = value\n } else {\n attachers.push(slice.call(arguments))\n }\n }\n }\n\n function find(plugin) {\n var length = attachers.length\n var index = -1\n var entry\n\n while (++index < length) {\n entry = attachers[index]\n\n if (entry[0] === plugin) {\n return entry\n }\n }\n }\n\n /* Parse a file (in string or VFile representation)\n * into a Unist node using the `Parser` on the\n * processor. */\n function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n /* Run transforms on a Unist node representation of a file\n * (in string or VFile representation), async. */\n function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }\n\n /* Run transforms on a Unist node representation of a file\n * (in string or VFile representation), sync. */\n function runSync(node, file) {\n var complete = false\n var result\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(err, tree) {\n complete = true\n bail(err)\n result = tree\n }\n }\n\n /* Stringify a Unist node representation of a file\n * (in string or VFile representation) into a string\n * using the `Compiler` on the processor. */\n function stringify(node, doc) {\n var file = vfile(doc)\n var Compiler\n\n freeze()\n Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler)) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n /* Parse a file (in string or VFile representation)\n * into a Unist node using the `Parser` on the processor,\n * then run transforms on that node, and compile the\n * resulting node using the `Compiler` on the processor,\n * and store that result on the VFile. */\n function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }\n\n /* Process the given document (in string or VFile\n * representation), sync. */\n function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }\n}", "function unified() {\n var attachers = []\n var transformers = trough()\n var namespace = {}\n var frozen = false\n var freezeIndex = -1\n\n /* Data management. */\n processor.data = data\n\n /* Lock. */\n processor.freeze = freeze\n\n /* Plug-ins. */\n processor.attachers = attachers\n processor.use = use\n\n /* API. */\n processor.parse = parse\n processor.stringify = stringify\n processor.run = run\n processor.runSync = runSync\n processor.process = process\n processor.processSync = processSync\n\n /* Expose. */\n return processor\n\n /* Create a new processor based on the processor\n * in the current scope. */\n function processor() {\n var destination = unified()\n var length = attachers.length\n var index = -1\n\n while (++index < length) {\n destination.use.apply(null, attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }\n\n /* Freeze: used to signal a processor that has finished\n * configuration.\n *\n * For example, take unified itself. It’s frozen.\n * Plug-ins should not be added to it. Rather, it should\n * be extended, by invoking it, before modifying it.\n *\n * In essence, always invoke this when exporting a\n * processor. */\n function freeze() {\n var values\n var plugin\n var options\n var transformer\n\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n values = attachers[freezeIndex]\n plugin = values[0]\n options = values[1]\n transformer = null\n\n if (options === false) {\n continue\n }\n\n if (options === true) {\n values[1] = undefined\n }\n\n transformer = plugin.apply(processor, values.slice(1))\n\n if (typeof transformer === 'function') {\n transformers.use(transformer)\n }\n }\n\n frozen = true\n freezeIndex = Infinity\n\n return processor\n }\n\n /* Data management.\n * Getter / setter for processor-specific informtion. */\n function data(key, value) {\n if (string(key)) {\n /* Set `key`. */\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen)\n\n namespace[key] = value\n\n return processor\n }\n\n /* Get `key`. */\n return (own.call(namespace, key) && namespace[key]) || null\n }\n\n /* Set space. */\n if (key) {\n assertUnfrozen('data', frozen)\n namespace = key\n return processor\n }\n\n /* Get space. */\n return namespace\n }\n\n /* Plug-in management.\n *\n * Pass it:\n * * an attacher and options,\n * * a preset,\n * * a list of presets, attachers, and arguments (list\n * of attachers and options). */\n function use(value) {\n var settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n /* Empty */\n } else if (typeof value === 'function') {\n addPlugin.apply(null, arguments)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings)\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings)\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var length\n var index\n\n if (plugins === null || plugins === undefined) {\n /* Empty */\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n length = plugins.length\n index = -1\n\n while (++index < length) {\n add(plugins[index])\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin)\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(entry[1], value)\n }\n\n entry[1] = value\n } else {\n attachers.push(slice.call(arguments))\n }\n }\n }\n\n function find(plugin) {\n var length = attachers.length\n var index = -1\n var entry\n\n while (++index < length) {\n entry = attachers[index]\n\n if (entry[0] === plugin) {\n return entry\n }\n }\n }\n\n /* Parse a file (in string or VFile representation)\n * into a Unist node using the `Parser` on the\n * processor. */\n function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n /* Run transforms on a Unist node representation of a file\n * (in string or VFile representation), async. */\n function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }\n\n /* Run transforms on a Unist node representation of a file\n * (in string or VFile representation), sync. */\n function runSync(node, file) {\n var complete = false\n var result\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(err, tree) {\n complete = true\n bail(err)\n result = tree\n }\n }\n\n /* Stringify a Unist node representation of a file\n * (in string or VFile representation) into a string\n * using the `Compiler` on the processor. */\n function stringify(node, doc) {\n var file = vfile(doc)\n var Compiler\n\n freeze()\n Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler)) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n /* Parse a file (in string or VFile representation)\n * into a Unist node using the `Parser` on the processor,\n * then run transforms on that node, and compile the\n * resulting node using the `Compiler` on the processor,\n * and store that result on the VFile. */\n function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }\n\n /* Process the given document (in string or VFile\n * representation), sync. */\n function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }\n}", "function unified() {\n var attachers = []\n var transformers = trough()\n var namespace = {}\n var frozen = false\n var freezeIndex = -1\n\n /* Data management. */\n processor.data = data\n\n /* Lock. */\n processor.freeze = freeze\n\n /* Plug-ins. */\n processor.attachers = attachers\n processor.use = use\n\n /* API. */\n processor.parse = parse\n processor.stringify = stringify\n processor.run = run\n processor.runSync = runSync\n processor.process = process\n processor.processSync = processSync\n\n /* Expose. */\n return processor\n\n /* Create a new processor based on the processor\n * in the current scope. */\n function processor() {\n var destination = unified()\n var length = attachers.length\n var index = -1\n\n while (++index < length) {\n destination.use.apply(null, attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }\n\n /* Freeze: used to signal a processor that has finished\n * configuration.\n *\n * For example, take unified itself. It’s frozen.\n * Plug-ins should not be added to it. Rather, it should\n * be extended, by invoking it, before modifying it.\n *\n * In essence, always invoke this when exporting a\n * processor. */\n function freeze() {\n var values\n var plugin\n var options\n var transformer\n\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n values = attachers[freezeIndex]\n plugin = values[0]\n options = values[1]\n transformer = null\n\n if (options === false) {\n continue\n }\n\n if (options === true) {\n values[1] = undefined\n }\n\n transformer = plugin.apply(processor, values.slice(1))\n\n if (typeof transformer === 'function') {\n transformers.use(transformer)\n }\n }\n\n frozen = true\n freezeIndex = Infinity\n\n return processor\n }\n\n /* Data management.\n * Getter / setter for processor-specific informtion. */\n function data(key, value) {\n if (string(key)) {\n /* Set `key`. */\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen)\n\n namespace[key] = value\n\n return processor\n }\n\n /* Get `key`. */\n return (own.call(namespace, key) && namespace[key]) || null\n }\n\n /* Set space. */\n if (key) {\n assertUnfrozen('data', frozen)\n namespace = key\n return processor\n }\n\n /* Get space. */\n return namespace\n }\n\n /* Plug-in management.\n *\n * Pass it:\n * * an attacher and options,\n * * a preset,\n * * a list of presets, attachers, and arguments (list\n * of attachers and options). */\n function use(value) {\n var settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n /* Empty */\n } else if (typeof value === 'function') {\n addPlugin.apply(null, arguments)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings)\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings)\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var length\n var index\n\n if (plugins === null || plugins === undefined) {\n /* Empty */\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n length = plugins.length\n index = -1\n\n while (++index < length) {\n add(plugins[index])\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin)\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(entry[1], value)\n }\n\n entry[1] = value\n } else {\n attachers.push(slice.call(arguments))\n }\n }\n }\n\n function find(plugin) {\n var length = attachers.length\n var index = -1\n var entry\n\n while (++index < length) {\n entry = attachers[index]\n\n if (entry[0] === plugin) {\n return entry\n }\n }\n }\n\n /* Parse a file (in string or VFile representation)\n * into a Unist node using the `Parser` on the\n * processor. */\n function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n /* Run transforms on a Unist node representation of a file\n * (in string or VFile representation), async. */\n function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }\n\n /* Run transforms on a Unist node representation of a file\n * (in string or VFile representation), sync. */\n function runSync(node, file) {\n var complete = false\n var result\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(err, tree) {\n complete = true\n bail(err)\n result = tree\n }\n }\n\n /* Stringify a Unist node representation of a file\n * (in string or VFile representation) into a string\n * using the `Compiler` on the processor. */\n function stringify(node, doc) {\n var file = vfile(doc)\n var Compiler\n\n freeze()\n Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler)) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n /* Parse a file (in string or VFile representation)\n * into a Unist node using the `Parser` on the processor,\n * then run transforms on that node, and compile the\n * resulting node using the `Compiler` on the processor,\n * and store that result on the VFile. */\n function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }\n\n /* Process the given document (in string or VFile\n * representation), sync. */\n function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }\n}", "function unified$1() {\n var attachers = [];\n var transformers = trough();\n var namespace = {};\n var freezeIndex = -1;\n var frozen;\n\n // Data management.\n processor.data = data;\n\n // Lock.\n processor.freeze = freeze;\n\n // Plugins.\n processor.attachers = attachers;\n processor.use = use;\n\n // API.\n processor.parse = parse;\n processor.stringify = stringify;\n processor.run = run;\n processor.runSync = runSync;\n processor.process = process;\n processor.processSync = processSync;\n\n // Expose.\n return processor\n\n // Create a new processor based on the processor in the current scope.\n function processor() {\n var destination = unified$1();\n var index = -1;\n\n while (++index < attachers.length) {\n destination.use.apply(null, attachers[index]);\n }\n\n destination.data(extend$1(true, {}, namespace));\n\n return destination\n }\n\n // Freeze: used to signal a processor that has finished configuration.\n //\n // For example, take unified itself: it’s frozen.\n // Plugins should not be added to it.\n // Rather, it should be extended, by invoking it, before modifying it.\n //\n // In essence, always invoke this when exporting a processor.\n function freeze() {\n var values;\n var transformer;\n\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n values = attachers[freezeIndex];\n\n if (values[1] === false) {\n continue\n }\n\n if (values[1] === true) {\n values[1] = undefined;\n }\n\n transformer = values[0].apply(processor, values.slice(1));\n\n if (typeof transformer === 'function') {\n transformers.use(transformer);\n }\n }\n\n frozen = true;\n freezeIndex = Infinity;\n\n return processor\n }\n\n // Data management.\n // Getter / setter for processor-specific informtion.\n function data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen);\n namespace[key] = value;\n return processor\n }\n\n // Get `key`.\n return (own$b.call(namespace, key) && namespace[key]) || null\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', frozen);\n namespace = key;\n return processor\n }\n\n // Get space.\n return namespace\n }\n\n // Plugin management.\n //\n // Pass it:\n // * an attacher and options,\n // * a preset,\n // * a list of presets, attachers, and arguments (list of attachers and\n // options).\n function use(value) {\n var settings;\n\n assertUnfrozen('use', frozen);\n\n if (value === null || value === undefined) ; else if (typeof value === 'function') {\n addPlugin.apply(null, arguments);\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value);\n } else {\n addPreset(value);\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend$1(namespace.settings || {}, settings);\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins);\n\n if (result.settings) {\n settings = extend$1(settings || {}, result.settings);\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value);\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value);\n } else {\n addPreset(value);\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var index = -1;\n\n if (plugins === null || plugins === undefined) ; else if (typeof plugins === 'object' && 'length' in plugins) {\n while (++index < plugins.length) {\n add(plugins[index]);\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin);\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend$1(true, entry[1], value);\n }\n\n entry[1] = value;\n } else {\n attachers.push(slice$1.call(arguments));\n }\n }\n }\n\n function find(plugin) {\n var index = -1;\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n return attachers[index]\n }\n }\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor.\n function parse(doc) {\n var file = vfile(doc);\n var Parser;\n\n freeze();\n Parser = processor.Parser;\n assertParser('parse', Parser);\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), async.\n function run(node, file, cb) {\n assertNode(node);\n freeze();\n\n if (!cb && typeof file === 'function') {\n cb = file;\n file = null;\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done);\n\n function done(error, tree, file) {\n tree = tree || node;\n if (error) {\n reject(error);\n } else if (resolve) {\n resolve(tree);\n } else {\n cb(null, tree, file);\n }\n }\n }\n }\n\n // Run transforms on a unist node representation of a file (in string or\n // vfile representation), sync.\n function runSync(node, file) {\n var result;\n var complete;\n\n run(node, file, done);\n\n assertDone('runSync', 'run', complete);\n\n return result\n\n function done(error, tree) {\n complete = true;\n result = tree;\n bail(error);\n }\n }\n\n // Stringify a unist node representation of a file (in string or vfile\n // representation) into a string using the `Compiler` on the processor.\n function stringify(node, doc) {\n var file = vfile(doc);\n var Compiler;\n\n freeze();\n Compiler = processor.Compiler;\n assertCompiler('stringify', Compiler);\n assertNode(node);\n\n if (newable(Compiler, 'compile')) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n // Parse a file (in string or vfile representation) into a unist node using\n // the `Parser` on the processor, then run transforms on that node, and\n // compile the resulting node using the `Compiler` on the processor, and\n // store that result on the vfile.\n function process(doc, cb) {\n freeze();\n assertParser('process', processor.Parser);\n assertCompiler('process', processor.Compiler);\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n var file = vfile(doc);\n\n pipeline.run(processor, {file: file}, done);\n\n function done(error) {\n if (error) {\n reject(error);\n } else if (resolve) {\n resolve(file);\n } else {\n cb(null, file);\n }\n }\n }\n }\n\n // Process the given document (in string or vfile representation), sync.\n function processSync(doc) {\n var file;\n var complete;\n\n freeze();\n assertParser('processSync', processor.Parser);\n assertCompiler('processSync', processor.Compiler);\n file = vfile(doc);\n\n process(file, done);\n\n assertDone('processSync', 'process', complete);\n\n return file\n\n function done(error) {\n complete = true;\n bail(error);\n }\n }\n}", "function unified() {\n var attachers = [];\n var transformers = trough();\n var namespace = {};\n var frozen = false;\n var freezeIndex = -1;\n\n /* Data management. */\n processor.data = data;\n\n /* Lock. */\n processor.freeze = freeze;\n\n /* Plug-ins. */\n processor.attachers = attachers;\n processor.use = use;\n\n /* API. */\n processor.parse = parse;\n processor.stringify = stringify;\n processor.run = run;\n processor.runSync = runSync;\n processor.process = process;\n processor.processSync = processSync;\n\n /* Expose. */\n return processor;\n\n /* Create a new processor based on the processor\n * in the current scope. */\n function processor() {\n var destination = unified();\n var length = attachers.length;\n var index = -1;\n\n while (++index < length) {\n destination.use.apply(null, attachers[index]);\n }\n\n destination.data(extend(true, {}, namespace));\n\n return destination;\n }\n\n /* Freeze: used to signal a processor that has finished\n * configuration.\n *\n * For example, take unified itself. It’s frozen.\n * Plug-ins should not be added to it. Rather, it should\n * be extended, by invoking it, before modifying it.\n *\n * In essence, always invoke this when exporting a\n * processor. */\n function freeze() {\n var values;\n var plugin;\n var options;\n var transformer;\n\n if (frozen) {\n return processor;\n }\n\n while (++freezeIndex < attachers.length) {\n values = attachers[freezeIndex];\n plugin = values[0];\n options = values[1];\n transformer = null;\n\n if (options === false) {\n continue;\n }\n\n if (options === true) {\n values[1] = undefined;\n }\n\n transformer = plugin.apply(processor, values.slice(1));\n\n if (func(transformer)) {\n transformers.use(transformer);\n }\n }\n\n frozen = true;\n freezeIndex = Infinity;\n\n return processor;\n }\n\n /* Data management.\n * Getter / setter for processor-specific informtion. */\n function data(key, value) {\n if (string(key)) {\n /* Set `key`. */\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen);\n\n namespace[key] = value;\n\n return processor;\n }\n\n /* Get `key`. */\n return (own.call(namespace, key) && namespace[key]) || null;\n }\n\n /* Set space. */\n if (key) {\n assertUnfrozen('data', frozen);\n namespace = key;\n return processor;\n }\n\n /* Get space. */\n return namespace;\n }\n\n /* Plug-in management.\n *\n * Pass it:\n * * an attacher and options,\n * * a preset,\n * * a list of presets, attachers, and arguments (list\n * of attachers and options). */\n function use(value) {\n var settings;\n\n assertUnfrozen('use', frozen);\n\n if (value === null || value === undefined) {\n /* Empty */\n } else if (func(value)) {\n addPlugin.apply(null, arguments);\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value);\n } else {\n addPreset(value);\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`');\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings);\n }\n\n return processor;\n\n function addPreset(result) {\n addList(result.plugins);\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings);\n }\n }\n\n function add(value) {\n if (func(value)) {\n addPlugin(value);\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value);\n } else {\n addPreset(value);\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`');\n }\n }\n\n function addList(plugins) {\n var length;\n var index;\n\n if (plugins === null || plugins === undefined) {\n /* Empty */\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n length = plugins.length;\n index = -1;\n\n while (++index < length) {\n add(plugins[index]);\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`');\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin);\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(entry[1], value);\n }\n\n entry[1] = value;\n } else {\n attachers.push(slice.call(arguments));\n }\n }\n }\n\n function find(plugin) {\n var length = attachers.length;\n var index = -1;\n var entry;\n\n while (++index < length) {\n entry = attachers[index];\n\n if (entry[0] === plugin) {\n return entry;\n }\n }\n }\n\n /* Parse a file (in string or VFile representation)\n * into a Unist node using the `Parser` on the\n * processor. */\n function parse(doc) {\n var file = vfile(doc);\n var Parser;\n\n freeze();\n Parser = processor.Parser;\n assertParser('parse', Parser);\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse();\n }\n\n return Parser(String(file), file); // eslint-disable-line new-cap\n }\n\n /* Run transforms on a Unist node representation of a file\n * (in string or VFile representation), async. */\n function run(node, file, cb) {\n assertNode(node);\n freeze();\n\n if (!cb && func(file)) {\n cb = file;\n file = null;\n }\n\n if (!cb) {\n return new Promise(executor);\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done);\n\n function done(err, tree, file) {\n tree = tree || node;\n if (err) {\n reject(err);\n } else if (resolve) {\n resolve(tree);\n } else {\n cb(null, tree, file);\n }\n }\n }\n }\n\n /* Run transforms on a Unist node representation of a file\n * (in string or VFile representation), sync. */\n function runSync(node, file) {\n var complete = false;\n var result;\n\n run(node, file, done);\n\n assertDone('runSync', 'run', complete);\n\n return result;\n\n function done(err, tree) {\n complete = true;\n bail(err);\n result = tree;\n }\n }\n\n /* Stringify a Unist node representation of a file\n * (in string or VFile representation) into a string\n * using the `Compiler` on the processor. */\n function stringify(node, doc) {\n var file = vfile(doc);\n var Compiler;\n\n freeze();\n Compiler = processor.Compiler;\n assertCompiler('stringify', Compiler);\n assertNode(node);\n\n if (newable(Compiler)) {\n return new Compiler(node, file).compile();\n }\n\n return Compiler(node, file); // eslint-disable-line new-cap\n }\n\n /* Parse a file (in string or VFile representation)\n * into a Unist node using the `Parser` on the processor,\n * then run transforms on that node, and compile the\n * resulting node using the `Compiler` on the processor,\n * and store that result on the VFile. */\n function process(doc, cb) {\n freeze();\n assertParser('process', processor.Parser);\n assertCompiler('process', processor.Compiler);\n\n if (!cb) {\n return new Promise(executor);\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n var file = vfile(doc);\n\n pipeline.run(processor, {file: file}, done);\n\n function done(err) {\n if (err) {\n reject(err);\n } else if (resolve) {\n resolve(file);\n } else {\n cb(null, file);\n }\n }\n }\n }\n\n /* Process the given document (in string or VFile\n * representation), sync. */\n function processSync(doc) {\n var complete = false;\n var file;\n\n freeze();\n assertParser('processSync', processor.Parser);\n assertCompiler('processSync', processor.Compiler);\n file = vfile(doc);\n\n process(file, done);\n\n assertDone('processSync', 'process', complete);\n\n return file;\n\n function done(err) {\n complete = true;\n bail(err);\n }\n }\n}", "register(processType) { this.register_(processType) }", "onCreatedPreProcessor(preprocessor) {}", "function CreateStreamProcessorCommand(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 DeviceProcessor() {\n\tvar builder = new processor.Chain();\n\tbuilder.Add(save_flags);\n\tbuilder.Add(strip_syslog_priority);\n\tbuilder.Add(chain1);\n\tbuilder.Add(populate_fields);\n\tbuilder.Add(restore_flags);\n\tvar chain = builder.Build();\n\treturn {\n\t\tprocess: chain.Run,\n\t}\n}", "function DeviceProcessor() {\n\tvar builder = new processor.Chain();\n\tbuilder.Add(save_flags);\n\tbuilder.Add(strip_syslog_priority);\n\tbuilder.Add(chain1);\n\tbuilder.Add(populate_fields);\n\tbuilder.Add(restore_flags);\n\tvar chain = builder.Build();\n\treturn {\n\t\tprocess: chain.Run,\n\t}\n}", "function DeviceProcessor() {\n\tvar builder = new processor.Chain();\n\tbuilder.Add(save_flags);\n\tbuilder.Add(strip_syslog_priority);\n\tbuilder.Add(chain1);\n\tbuilder.Add(populate_fields);\n\tbuilder.Add(restore_flags);\n\tvar chain = builder.Build();\n\treturn {\n\t\tprocess: chain.Run,\n\t}\n}", "on_assign_processor() {\n }", "function CommandProcessor(controller) {\n this.controller = controller;\n}", "configureProprocessor(name, options) {\n this.config[name] = Object.assign({}, this.config[name], options)\n return this\n }", "function ProcessController() {}", "assign_processor(processor_id) {\n this.processor_id = processor_id\n\n this._refresh_source_icon()\n\n this.on_assign_processor()\n\n // Now that we have a processor/source, refresh\n this.viewer.refresh_widget(this)\n }", "function processor() {\n var destination = unified()\n var index = -1\n\n while (++index < attachers.length) {\n destination.use.apply(null, attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }", "function processor() {\n var destination = unified()\n var index = -1\n\n while (++index < attachers.length) {\n destination.use.apply(null, attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }", "function createProcess(process) {\n return ProcessModel.create(process);\n}", "function processor() {\n var destination = unified$1();\n var index = -1;\n\n while (++index < attachers.length) {\n destination.use.apply(null, attachers[index]);\n }\n\n destination.data(extend$1(true, {}, namespace));\n\n return destination\n }", "createProducer (structureType, tile) {\n var sType = this.checkStructureType(structureType)\n\n var producer = sType.type === 'refinery'\n ? this.createRefiner(sType.buysFrom, sType.multiplier, sType.reach, tile)\n : this.createPrimaryProducer(sType, tile)\n\n return new AllDecorator({producer: producer, tile: tile})\n }", "compute (name /*, ...processors */) {\n let processors = toArray(arguments, 1)\n\n return pipeline(this.lookup(name)(), processors, this.state)\n }", "function Processor(proc, host){\n var processes = proc || [], locked = 0, i = 0,\n\n /* Functional methods to manipulate DataBus processing workflow */\n fns = {\n /* Continue processing with @data */\n $continue: function(data){\n return self.tick(data);\n },\n /* Break processing */\n $break: function(){\n return self.tick({}, 1);\n },\n /* Locks DataBus evaluation */\n $lock: function(){\n return locked = 1;\n },\n /* Unlocks DataBus evaluation */\n $unlock: function(){\n return locked = 0;\n },\n $update: function(){\n host.update();\n },\n /* Returns current DataBus */\n $host: function(){\n return host;\n }\n };\n \n var self = {\n /* Add process if @p exists or return all processes of this Processor */\n process : function(p){\n return Utils.is.exist(p) ? processes.push(p) : processes;\n },\n\n /* Start processing */\n start : function(event, context, fin){\n self.ctx = context;\n self.fin = fin; \n \n i = locked ? 0 : i;\n \n if(i==processes.length){\n i = 0;\n return fin(event);\n }\n\n this.tick(event);\n },\n\n /* Ticking processor to the next process */\n tick : function(event, breaked){ \n if(breaked){\n return i = 0;\n }\n \n if(i==processes.length){\n i = 0;\n return self.fin(event);\n }\n\n i++; \n processes[i-1].apply(self.ctx, [event, fns]);\n \n }\n }\n return self;\n }", "function processor() {\n var destination = unified();\n var length = attachers.length;\n var index = -1;\n\n while (++index < length) {\n destination.use.apply(null, attachers[index]);\n }\n\n destination.data(extend(true, {}, namespace));\n\n return destination;\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 Proc() {}", "function handleNewProcess(channel, peerUuid){\n debugProcesses(\"New Process\", peerUuid);\n processes[peerUuid] = new Process(peerUuid);\n}", "setProc(proc) {\nthis._proc = proc;\nreturn this;\n}", "function InlineWorkerFactory(){\n\t}", "getProc(token, proc, procExpression, procIdentifier) {\nif (procExpression === t.LEXEME_SUPER) {\nif (!this._scope.getSuper()) {\nthrow errors.createError(err.NO_SUPER_PROC_FOUND, token, 'No super proc found.');\n}\nreturn this._scope.getSuper();\n}\nif (proc instanceof Proc) {\nreturn proc;\n}\nif ((procIdentifier instanceof Var) && procIdentifier.getAssignedProc()) {\nreturn procIdentifier.getAssignedProc();\n}\nlet program = this._program;\nlet codeUsed = program.getCodeUsed();\nprogram.setCodeUsed(false);\nthis._varExpression.compileExpressionToRegister({\nidentifier: procIdentifier,\nexpression: procExpression,\nreg: $.REG_PTR\n});\nprogram.setCodeUsed(codeUsed);\nreturn this._varExpression.getLastProcField();\n}", "static create(params) {\n return {type: `${this.prefix}${this.name}`, _instance: new this(params)}; //eslint-disable-line\n }", "static register(type) {\n if(OS.kernel) OS.kernel.register(type);\n else processTypes.push(type);\n }", "createProcesses() {\n Object.keys(this.workers).forEach(type => {\n const env = {\n 'type': type,\n 'verbose': config.verbose,\n };\n this.workers[type] = this.fork(type, env);\n });\n }", "useDefaultPostProcessor(){\n this._postProcessor = new UrlProcessor();\n return this;\n }", "function createCiteproc(citeprocJSONObject, citeprocSys, citeprocStyle){\n\t\tvar defaultCiteprocSys = {\n\t\t retrieveItem: function(id){\n\t\t return citeprocJSONObject.citationItems[id];\n\t\t },\n\t\t retrieveLocale: function(lang){\n\t\t return defaultLocale[lang];\n\t\t }\n\t\t}\n\t\tif (!citeprocSys)\n\t\t\tciteprocSys = defaultCiteprocSys;\n\t\tif (!citeprocStyle)\n\t\t\tciteprocStyle = styleChigcagoAD;\t\t\n\t\treturn new CSL.Engine( citeprocSys, citeprocStyle );\n\t}", "newInstance() {\r\n\t\t\t\t\tvar base, ref1;\r\n\t\t\t\t\tbase = ((ref1 = this.variable) != null ? ref1.base : void 0) || this.variable;\r\n\t\t\t\t\tif (base instanceof Call && !base.isNew) {\r\n\t\t\t\t\t\tbase.newInstance();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.isNew = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.needsUpdatedStartLocation = true;\r\n\t\t\t\t\treturn this;\r\n\t\t\t\t}", "parse(parser) {\n this._processor = this._process(parser);\n this._processor.next();\n }", "processInit() {\n // if worker not use require it may not have setExecuteFn\n if (this.service.setExecuteFn) {\n this.service.setExecuteFn(this.proxyUpcomingExecute)\n }\n // HACK simplify states\n this.state = WORKERS_STATES.ready\n return this\n }", "addProcess(process) {\n if (this.processes.has(process.processName)) {\n throw Error('Process with name: ' + process.processName + ' already defined.');\n } else {\n this.processes.set(process.processName, process);\n }\n return process;\n }", "create(props){\n const obj = {type: this.name};\n\n Object.keys(this.props).forEach((prop) => {\n obj[prop] = props[prop];\n\n // If not primitive type\n // if(this.props[prop].rel !== undefined){\n // types[this.props[prop].type].create(props[prop]);\n // }\n // // Create new instance of type and add relationship\n // this.props[prop].create = (obj) => types[prop.type].create(obj);\n //\n // // Fetch existing instance of type and add relationship\n // this.props[prop].link = (obj) => types[prop.type].link(obj);\n // }\n });\n\n return obj;\n }", "constructor() { \n \n ProcessDefinitionDto.initialize(this);\n }", "function makeComputer(maker, Processor, Ram, HardDisc) {\n return {\n\t\tmaker : maker,\n\t\tProcessor : Processor,\n\t\tRam : Ram,\n\t\tHardDisc : HardDisc\n\t};\n}", "function build_processor_config(el){\n\n var select \t\t\t= $(el),\n templ\t\t\t= $('#' + select.val() + '-tmpl').length ? $('#' + select.val() + '-tmpl').html() : '',\n parent\t\t\t= select.closest('.caldera-editor-processor-config-wrapper'),\n target\t\t\t= parent.find('.caldera-config-processor-setup'),\n template \t\t= Handlebars.compile(templ),\n config\t\t\t= parent.find('.processor_config_string').val(),\n current_type\t= select.data('type');\n\n // Be sure to load the processors preset when switching back to the initial processor type.\n if(config.length && current_type === select.val() ){\n config = JSON.parse(config);\n }else{\n // default config\n config = processor_defaults[select.val() + '_cfg'];\n }\n\n // build template\n if(!config){\n config = {};\n }\n\n config._id = parent.prop('id');\n config._name = 'config[processors][' + parent.prop('id') + '][config]';\n\n\n\n\n template = $('<div>').html( template( config ) );\n\n // send to target\n target.html( template.html() );\n\n // check for init function\n if( typeof window[select.val() + '_init'] === 'function' ){\n window[select.val() + '_init'](parent.prop('id'), target);\n }\n\n // check if conditions are allowed\n if(parent.find('.no-conditions').length){\n // conditions are not supported - remove them\n parent.find('.toggle_option_tab').remove();\n }\n\n\n rebuild_field_binding();\n baldrickTriggers();\n\n // initialise baldrick triggers\n $('.wp-baldrick').baldrick({\n request : cfAdminAJAX,\n method : 'POST',\n before\t\t: function(el){\n\n var tr = $(el);\n\n if( tr.data('addNode') && !tr.data('request') ){\n tr.data('request', 'cf_get_default_setting');\n }\n }\n });\n\n }", "static _fromCloudFormation(scope, id, resourceAttributes, options) {\n resourceAttributes = resourceAttributes || {};\n const resourceProperties = options.parser.parseValue(resourceAttributes.Properties);\n const propsResult = CfnPipelinePropsFromCloudFormation(resourceProperties);\n const ret = new CfnPipeline(scope, id, propsResult.value);\n for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) {\n ret.addPropertyOverride(propKey, propVal);\n }\n options.parser.handleAttributes(ret, resourceAttributes, id);\n return ret;\n }", "static _fromCloudFormation(scope, id, resourceAttributes, options) {\n resourceAttributes = resourceAttributes || {};\n const resourceProperties = options.parser.parseValue(resourceAttributes.Properties);\n const propsResult = CfnPipelinePropsFromCloudFormation(resourceProperties);\n const ret = new CfnPipeline(scope, id, propsResult.value);\n for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) {\n ret.addPropertyOverride(propKey, propVal);\n }\n options.parser.handleAttributes(ret, resourceAttributes, id);\n return ret;\n }", "function VMFactory() {}", "function ProcessingTypeViewerFactory(EntityViewer) {\n\n function ProcessingTypeViewer(processingType) {\n var entityViewer = new EntityViewer(processingType, 'Processing Type');\n\n entityViewer.addAttribute('Name', processingType.name);\n entityViewer.addAttribute('Description', processingType.description);\n entityViewer.addAttribute('Enabled', processingType.enabled ? 'Yes' : 'No');\n\n entityViewer.showModal();\n }\n\n return ProcessingTypeViewer;\n }", "createResolver(props) {\n return new resolver_1.Resolver(this, `${props.typeName}${props.fieldName}Resolver`, {\n api: this,\n ...props,\n });\n }", "create (key) {\n if (_cores.has(key)) {\n return _cores.get(key)\n } else {\n _cores.set(key, new Map())\n return _cores.get(key)\n }\n }", "async createNewInstance() {\n const adapters = this.processAdapters();\n const datastores = this.api.config.models.datastores;\n const models = await this.loadModels();\n\n const ormStart = promisify(Waterline.start);\n\n this.waterline = await ormStart({\n adapters,\n datastores,\n models,\n });\n }", "function processorIDRegister() // ./common/cpu.js:290\n{ // ./common/cpu.js:291\n\t// all fields are read only by software // ./common/cpu.js:292\n\tthis.R = 0; // bits 31:24 // ./common/cpu.js:293\n\tthis.companyID = 1; // bits 23:16 // ./common/cpu.js:294\n\tthis.processorID = 128; // bits 15:8, (128 for 4kc) // ./common/cpu.js:295\n\tthis.revision = 11; // bits 7:0, latest version according to manual // ./common/cpu.js:296\n // ./common/cpu.js:297\n\tthis.asUInt32 = function() // ./common/cpu.js:298\n\t{ // ./common/cpu.js:299\n\t\treturn ((this.R << 24) + (this.companyID << 16) + (this.processorID << 8) + this.revision); // ./common/cpu.js:300\n\t} // ./common/cpu.js:301\n // ./common/cpu.js:302\n\tthis.putUInt32 = function(value) // ./common/cpu.js:303\n\t{ // ./common/cpu.js:304\n\t\treturn; // ./common/cpu.js:305\n\t} // ./common/cpu.js:306\n} // ./common/cpu.js:307", "function Process(){}", "process (filepath) {\n\t\tlet {\n\t\t\tchassis,\n\t\t\tgenerateNamespacedSelector,\n\t\t\tisNamespaced,\n\t\t\tnamespaceSelectors,\n\t\t\tprocessImports,\n\t\t\tprocessNesting,\n\t\t\tprocessAtRules,\n\t\t\tprocessMixins,\n\t\t\tprocessNot,\n\t\t\tprocessFunctions,\n\t\t\tstoreAtRules,\n\t\t\ttypographyEngineIsInitialized\n\t\t} = this\n\n\t\tlet {\n\t\t\tatRules,\n\t\t\tpost,\n\t\t\tsettings,\n\t\t\tutils\n\t\t} = chassis\n\n\t\tlet tasks = new NGN.Tasks()\n\t\tlet sourceMap\n\n\t\ttasks.add('Processing Imports', next => {\n\t\t\tif (typographyEngineIsInitialized) {\n\t\t\t\tthis.tree.walkAtRules('import', atRule => {\n\t\t\t\t\tchassis.imports.push(atRule.params)\n\t\t\t\t\tatRule.remove()\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tprocessImports()\n\t\t\tprocessNesting()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Mixins', next => {\n\t\t\tprocessMixins()\n\t\t\tprocessNot()\n\t\t\tprocessNesting()\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Functions', next => {\n\t\t\tprocessFunctions()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Namespacing Selectors', next => {\n\t\t\tnamespaceSelectors()\n\t\t\tnext()\n\t\t})\n\n\t\tif (typographyEngineIsInitialized) {\n\t\t\ttasks.add('Initializing Typography Engine', next => {\n\t\t\t\tthis.tree = this.core.css.append(this.tree)\n\t\t\t\tnext()\n\t\t\t})\n\t\t}\n\n\t\ttasks.add('Running Post-Processing Routines', next => {\n\t\t\tthis.tree.walkAtRules('chassis-post', atRule => {\n\t\t\t\tlet data = Object.assign({\n\t\t\t\t\troot: this.tree,\n\t\t\t\t\tatRule\n\t\t\t\t}, atRules.getProperties(atRule))\n\n\t\t\t\tpost.process(data)\n\t\t\t})\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing CSS4 Syntax', next => {\n\t\t\tenv.process(this.tree, {from: filepath}, settings.envCfg).then(processed => {\n\t\t\t\tthis.tree = processed.root\n\t\t\t\tnext()\n\t\t\t}, err => console.error(err))\n\t\t})\n\n\t\t// tasks.add('Merging matching adjacent rules...', next => {\n\t\t// \toutput = mergeAdjacentRules.process(output.toString())\n\t\t// \tnext()\n\t\t// })\n\n\t\ttasks.add('Beautifying Output', next => {\n\t\t\tremoveComments.process(this.tree).then(result => {\n\t\t\t\tperfectionist.process(result.css).then(result => {\n\t\t\t\t\tthis.tree = result.root\n\n\t\t\t\t\t// Remove empty rulesets\n\t\t\t\t\tthis.tree.walkRules(rule => {\n\t\t\t\t\t\tif (rule.nodes.length === 0) {\n\t\t\t\t\t\t\trule.remove()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\n\t\t\t\t\tnext()\n\t\t\t\t}, () => {\n\t\t\t\t\tthis.emit('processing.error', new Error('Error Beautifying Output'))\n\t\t\t\t})\n\t\t\t}, () => {\n\t\t\t\tthis.emit('processing.error', new Error('Error Removing Comments'))\n\t\t\t})\n\t\t})\n\n\t\tif (settings.minify) {\n\t\t\tlet minified\n\n\t\t\ttasks.add('Minifying Output', next => {\n\t\t\t\tminified = new CleanCss({\n\t\t\t\t\tsourceMap: settings.sourceMap\n\t\t\t\t}).minify(this.tree.toString())\n\n\t\t\t\tthis.tree = minified.styles\n\t\t\t\tnext()\n\t\t\t})\n\n\t\t\tif (settings.sourceMap) {\n\t\t\t\ttasks.add('Generating source map', next => {\n\t\t\t\t\tsourceMap = minified.sourceMap.toString()\n\t\t\t\t\tnext()\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// tasks.on('taskstart', evt => console.log(`${evt.name}...`))\n\t\t// tasks.on('taskcomplete', evt => console.log('Done.'))\n\n\t\ttasks.on('complete', () => this.emit('processing.complete', {\n\t\t\tcss: this.tree.toString(),\n\t\t\tsourceMap\n\t\t}))\n\n\t\tthis.emit('processing')\n\t\ttasks.run(true)\n\t}", "function m(b,a,c){a=void 0===a?{}:a;c=void 0===c?!1:c;\"function\"===typeof a?(q(\"Legacy constructor was used. See README for latest usage.\",r),a={listener:a,l:c,m:!0,h:{}}):a={listener:a.listener||function(){},l:a.listenToPast||!1,m:void 0===a.processNow?!0:a.processNow,h:a.commandProcessors||{}};this.a=b;this.s=a.listener;this.o=a.l;this.g=this.j=!1;this.c={};this.f=[];this.b=a.h;this.i=t(this);a.m&&this.process()}", "createInstance(type, props, rootContainerInstance, hostContext) {\n return createInstance(type, props, rootContainerInstance, hostContext);\n }", "getExtractor(extractorName) {\n try {\n let Extractor = require('./' + extractorName);\n return new Extractor();\n } catch (e) {\n let BaseExtractor = require('./baseExtractor/BaseExtractor');\n return new BaseExtractor();\n }\n }", "instantiateParser() {\n return new this.ParserClass(this.config);\n }", "function setupScriptProcessor() {\n recorderNode = createRecorderScriptProcessor();\n recorderNode.port.postMessage({ sampleRate, });\n recorderNode.port.onmessage = (data) => {\n switch (data) {\n\n case 'startCapturing':\n dispatch(getActions().recordStart());\n break;\n\n default:\n captureAudio({data});\n }\n };\n source.connect(recorderNode);\n recorderNode.connect(getAudioContext().destination);\n}", "createRuntimeCatalogue() {\n\n let _this = this;\n let factory = {\n createHttpRequest: function() {\n return _this.createHttpRequest();\n }\n };\n\n return new RuntimeCatalogueLocal(factory);\n\n }", "function create(c) {\n return new c();\n}", "function create(c) {\n return new c();\n}", "function create(c) {\n return new c();\n}", "function create(c) {\n return new c();\n}", "function getProcessorMap() {\r\n adminFactory.getprocessors().then(function(res) {\r\n console.log(\"processors res.data\", res.data);\r\n $scope.watchtaskfilter = \"none\";\r\n $scope.processors = res.data;\r\n $scope.nop = Object.keys($scope.processors).length;\r\n }, function(res) {\r\n //error\r\n console.log(\"Failed to get proccessors info error:\", res.data.error);\r\n });\r\n }", "function createPlatform(injector) {\n if (_inPlatformCreate) {\n throw new exceptions_1.BaseException('Already creating a platform...');\n }\n if (lang_1.isPresent(_platform) && !_platform.disposed) {\n throw new exceptions_1.BaseException(\"There can be only one platform. Destroy the previous one to create a new one.\");\n }\n lang_1.lockMode();\n _inPlatformCreate = true;\n try {\n _platform = injector.get(PlatformRef);\n } finally {\n _inPlatformCreate = false;\n }\n return _platform;\n}", "static _fromCloudFormation(scope, id, resourceAttributes, options) {\n resourceAttributes = resourceAttributes || {};\n const resourceProperties = options.parser.parseValue(resourceAttributes.Properties);\n const propsResult = CfnPhoneNumberPropsFromCloudFormation(resourceProperties);\n const ret = new CfnPhoneNumber(scope, id, propsResult.value);\n for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) {\n ret.addPropertyOverride(propKey, propVal);\n }\n options.parser.handleAttributes(ret, resourceAttributes, id);\n return ret;\n }", "static create () {}", "function Factory() {\r\n this.createProduct = function(type) {\r\n let product;\r\n if (type === \"Phone\") {\r\n product = new Phone();\r\n } else if (type === \"Smartphone\") {\r\n product = new Smartphone();\r\n } else if (type === \"Tablet\") {\r\n product = new Tablet();\r\n } else if (type === \"Notebook\") {\r\n product = new Notebook();\r\n } else if (type === \"Desktop\") {\r\n product = new Desktop();\r\n }\r\n product.type = type\r\n product.info = function () {\r\n return this.type + \" will be build in \" + this.hours + \" hours.\"\r\n }\r\n return product\r\n }\r\n}", "function createPlatform(injector) {\n if (_platform && !_platform.destroyed && !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {\n throw new Error('There can be only one platform. Destroy the previous one to create a new one.');\n }\n\n publishDefaultGlobalUtils$1();\n _platform = injector.get(PlatformRef);\n var inits = injector.get(PLATFORM_INITIALIZER, null);\n if (inits) inits.forEach(function (init) {\n return init();\n });\n return _platform;\n }", "function createPlatform(injector){if(_platform&&!_platform.destroyed&&!_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS,false)){throw new Error('There can be only one platform. Destroy the previous one to create a new one.');}_platform=injector.get(PlatformRef);var inits=injector.get(PLATFORM_INITIALIZER,null);if(inits)inits.forEach(function(init){return init();});return _platform;}", "[types.PROCESS_INSTANCE_PUSH] (state, {instance, id}) {\n // extract stream\n let {stream, ...rest} = instance\n state.instances[id].push(rest)\n // put stream in volatile so changes don't trigger watchers\n volatile.streams[rest.pid] = stream\n }", "static _fromCloudFormation(scope, id, resourceAttributes, options) {\n resourceAttributes = resourceAttributes || {};\n const resourceProperties = options.parser.parseValue(resourceAttributes.Properties);\n const propsResult = CfnContactFlowModulePropsFromCloudFormation(resourceProperties);\n const ret = new CfnContactFlowModule(scope, id, propsResult.value);\n for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) {\n ret.addPropertyOverride(propKey, propVal);\n }\n options.parser.handleAttributes(ret, resourceAttributes, id);\n return ret;\n }", "create() {\n\t}", "get_processor_kwargs() {\n return {}\n }", "function constructPipeline() {\n // console.log($rootScope.CSVdelim);\n // var separator = $rootScope.CSVdelim?$rootScope.CSVdelim:'\\\\,';\n var readDatasetFunct = new jsedn.List([\n new jsedn.sym('read-dataset'),\n new jsedn.sym('data-file')\n ]);\n\n pipeline = null;\n\n pipeline = new jsedn.List([\n jsedn.sym('defpipe'),\n jsedn.sym('my-pipe'),\n 'Grafter pipeline for data clean-up and preparation.',\n new jsedn.Vector([new jsedn.sym('data-file')]),\n new jsedn.List([jsedn.sym('->'), readDatasetFunct])\n ]);\n\n pipelineFunctions.map(function (arg) {\n pipeline.val[4].val.push(arg);\n });\n\n //(read-dataset data-file :format :csv)\n pipelineFunctions = new jsedn.List([]);\n return pipeline;\n}", "static create(msg) {\n // Use `this` instead of `Frisby` so this does the right thing when\n // composed with mixins.\n return new this(msg)\n }", "static async create() {\n let comp = Reflect.construct(this, arguments);\n // build default required components\n await Promise.all(resolveRequiredComponents(comp)\n .map(c => comp.addComponent(c)));\n return comp;\n }", "function makeSwiper() {\n _this.calcSlides();\n if (params.loader.slides.length > 0 && _this.slides.length === 0) {\n _this.loadSlides();\n }\n if (params.loop) {\n _this.createLoop();\n }\n _this.init();\n initEvents();\n if (params.pagination) {\n _this.createPagination(true);\n }\n\n if (params.loop || params.initialSlide > 0) {\n _this.swipeTo(params.initialSlide, 0, false);\n }\n else {\n _this.updateActiveSlide(0);\n }\n if (params.autoplay) {\n _this.startAutoplay();\n }\n /**\n * Set center slide index.\n *\n * @author Tomaz Lovrec <[email protected]>\n */\n _this.centerIndex = _this.activeIndex;\n\n // Callbacks\n if (params.onSwiperCreated) _this.fireCallback(params.onSwiperCreated, _this);\n _this.callPlugins('onSwiperCreated');\n }", "function ProcessDevice(){\r this.name = \"ProcessDevice\";\r this.xpath = \"//device[@type = 'VCO']\";\t\r this.apply = function(myElement, myRuleProcessor){\r var myNewElement = myContainerElement.xmlElements.add(app.documents.item(0).xmlTags.item(\"Row\"));\r return true;\r }\t\t\r}", "init(kernel) {\n logger.log(this.name, \"init\");\n let test = new testProc(\"test\");\n kernel.startProcess(test);\n }", "function createInjector(defType,parent,additionalProviders){if(parent===void 0){parent=null;}if(additionalProviders===void 0){additionalProviders=null;}parent=parent||getNullInjector();return new R3Injector(defType,additionalProviders,parent);}", "function createPlatform(injector) {\n if (_platform && !_platform.destroyed &&\n !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {\n throw new Error('There can be only one platform. Destroy the previous one to create a new one.');\n }\n _platform = injector.get(PlatformRef);\n var inits = injector.get(PLATFORM_INITIALIZER, null);\n if (inits)\n inits.forEach(function (init) { return init(); });\n return _platform;\n}", "function createPlatform(injector) {\n if (_platform && !_platform.destroyed &&\n !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {\n throw new Error('There can be only one platform. Destroy the previous one to create a new one.');\n }\n _platform = injector.get(PlatformRef);\n var inits = injector.get(PLATFORM_INITIALIZER, null);\n if (inits)\n inits.forEach(function (init) { return init(); });\n return _platform;\n}", "function createPlatform(injector) {\n if (_platform && !_platform.destroyed &&\n !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {\n throw new Error('There can be only one platform. Destroy the previous one to create a new one.');\n }\n _platform = injector.get(PlatformRef);\n var inits = injector.get(PLATFORM_INITIALIZER, null);\n if (inits)\n inits.forEach(function (init) { return init(); });\n return _platform;\n}", "function createPlatform(injector) {\n if (_platform && !_platform.destroyed &&\n !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {\n throw new Error('There can be only one platform. Destroy the previous one to create a new one.');\n }\n _platform = injector.get(PlatformRef);\n var inits = injector.get(PLATFORM_INITIALIZER, null);\n if (inits)\n inits.forEach(function (init) { return init(); });\n return _platform;\n}", "function transpilerFactory(options, injector) {\n if (options.transpilers.length) {\n return injector.injectClass(ChildProcessTranspiler_1.ChildProcessTranspiler);\n }\n else {\n return {\n transpile(files) {\n return Promise.resolve(files);\n },\n dispose() {\n // noop\n },\n };\n }\n}", "function fromProcess(init) {\n if (init === void 0) { init = {}; }\n return function () {\n return parseKnownFiles(init).then(function (profiles) { return resolveProcessCredentials(getMasterProfileName(init), profiles); });\n };\n}", "function instantiateMiddleware (next, middleware) {\n // If the middleware is a nested pipeline, we\n // create a fork in the pipeline.\n if (middleware instanceof Pipeline) {\n return fork(next, middleware)\n }\n\n // First, we assume that the middleware is a function style\n // middleware. If running it as a function throws a [TypeError]\n // it is probably a class style middleware.\n try {\n return middleware(next)\n } catch (e) {\n // If the error isn't a [TypeError], we should rethrow it\n if (!(e instanceof TypeError)) {\n throw e\n }\n\n // At this point, we can assume that the middleware is a\n // class, so we instantiate it.\n return instantiateClassMiddleware(next, middleware)\n }\n}", "function createPlatform(injector) {\n if (_platform && !_platform.destroyed &&\n !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {\n throw new Error('There can be only one platform. Destroy the previous one to create a new one.');\n }\n publishDefaultGlobalUtils$1();\n _platform = injector.get(PlatformRef);\n const inits = injector.get(PLATFORM_INITIALIZER, null);\n if (inits)\n inits.forEach((init) => init());\n return _platform;\n}", "function createPlatform(injector) {\n if (_platform && !_platform.destroyed &&\n !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {\n throw new Error('There can be only one platform. Destroy the previous one to create a new one.');\n }\n publishDefaultGlobalUtils$1();\n _platform = injector.get(PlatformRef);\n const inits = injector.get(PLATFORM_INITIALIZER, null);\n if (inits)\n inits.forEach((init) => init());\n return _platform;\n}" ]
[ "0.6117301", "0.6117301", "0.60486126", "0.5904408", "0.5904408", "0.5904408", "0.5904408", "0.5904408", "0.58828163", "0.5800185", "0.5721235", "0.56447303", "0.5328679", "0.52514666", "0.52514666", "0.52514666", "0.5194525", "0.51114035", "0.51101834", "0.51099145", "0.5081827", "0.50024855", "0.50024855", "0.49716735", "0.4956815", "0.49201465", "0.491992", "0.48840997", "0.48746064", "0.48345613", "0.47531995", "0.47516713", "0.47219577", "0.47208402", "0.47160685", "0.46538782", "0.4629294", "0.46219748", "0.4611517", "0.46008545", "0.45952055", "0.4581441", "0.45651895", "0.45420104", "0.45188734", "0.4503669", "0.44936916", "0.4474103", "0.44710454", "0.44710454", "0.44700417", "0.4457001", "0.44260597", "0.44043374", "0.43998432", "0.4396617", "0.43852097", "0.4380724", "0.43723214", "0.43393198", "0.43314838", "0.43242446", "0.4303566", "0.42670602", "0.4247376", "0.4247376", "0.4247376", "0.4247376", "0.42453915", "0.4243683", "0.42333812", "0.42321095", "0.42294303", "0.4229272", "0.4223107", "0.42135486", "0.42045647", "0.42028788", "0.41877374", "0.41867372", "0.41832525", "0.41799456", "0.41750512", "0.4171652", "0.4167612", "0.41567767", "0.41537157", "0.41537157", "0.41537157", "0.41537157", "0.41498613", "0.4148133", "0.41466206", "0.41429758", "0.41429758" ]
0.48947236
32
Data management. Getter / setter for processorspecific informtion.
function data(key, value) { if (string(key)) { /* Set `key`. */ if (arguments.length === 2) { assertUnfrozen('data', frozen) namespace[key] = value return processor } /* Get `key`. */ return (own.call(namespace, key) && namespace[key]) || null } /* Set space. */ if (key) { assertUnfrozen('data', frozen) namespace = key return processor } /* Get space. */ return namespace }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get data() {\n\t\treturn this.__data;\n\t}", "function processedSFData() {\n\t\tthis.moteid = idMote;\n\t\tthis.sensorType = sensorType;\n\t\tthis.lastTimestamp = lastTimeStamp;\n\t\tthis.lastValue = lastValue;\n\t\tthis.arrayValuesDay = valuesDay;\n\t\tthis.populationDay = populationDay;\n\t\tthis.arrayValuesWeek = valuesWeek;\n\t\tthis.populationWeek = populationWeek;\n\t\tthis.platform = platform;\n\t\tthis.unit = unit;\n\t}", "function processedGFData() {\n\t\tthis.moteid = idMote;\n\t\tthis.sensorType = sensorType;\n\t\tthis.lastTimestamp = lastTimeStamp;\n\t\tthis.lastValue = lastValue;\n\t\tthis.arrayValuesDay = valuesDay;\n\t\tthis.populationDay = populationDay;\n\t\tthis.arrayValuesWeek = valuesWeek;\n\t\tthis.populationWeek = populationWeek;\n\t\tthis.platform = platform;\n\t\tthis.unit= unit;\n\t}", "get data () {return this._data;}", "get Data () {\n return this._data\n }", "get Data() {\n return this._data;\n }", "get data() {\n return this.getData();\n }", "function processedFFData() {\n\t\tthis.moteid = idMote;\n\t\tthis.sensorType = sensorType;\n\t\tthis.lastTimestamp = lastTimeStamp;\n\t\tthis.lastValue = lastValue;\n\t\tthis.arrayValuesDay = valuesDay;\n\t\tthis.populationDay = populationDay;\n\t\tthis.arrayValuesWeek = valuesWeek;\n\t\tthis.populationWeek = populationWeek;\n\t\tthis.platform = platform;\n\t\tthis.unit = unit;\n\t}", "get data() {\n return this._data;\n }", "get data() {\n return this._data;\n }", "get data() {\n return this._data;\n }", "get data() { return this._data.value; }", "SetData() {}", "constructor() {\n this.data = this._loadData();\n }", "prepareData() {\n super.prepareData();\n\n const actorData = this.data;\n const data = actorData.data;\n const flags = actorData.flags;\n\n // Make separate methods for each Actor type (character, npc, etc.) to keep\n // things organized.\n if (actorData.type === 'character') this._prepareCharacterData(actorData);\n if (actorData.type === 'pokemon') this._preparePokemonData(actorData);\n }", "getData () {\n if (data) {\n this.data = data;\n this.emit('change', this.data);\n }\n }", "set(data) {\n this.internalData = data;\n }", "set data(data) {\n // prevent error message - setters invoked in initialization of class\n if (data == null) { return }\n \n // destructuring of data sent from Data class. reassign to Class scope\n let { title, question } = data;\n this.type = title;\n this.question = question;\n\n }", "get data(){\n return this._data;\n }", "getData(){}", "processData() {\n for (const item of this.unprocessedData) {\n this.addToData(buildOrInfer(item));\n }\n this.unprocessedData.clear();\n }", "function getData() {\n return {\n ergReps: ergReps,\n bikeReps: bikeReps,\n repRate: repRate,\n totTime: totTime,\n Distance: Distance\n }\n }", "get data(){\r\n\t\treturn this.__data \r\n\t\t\t?? (this.__data = idb.createStore(this.__db__, this.__store__)) }", "getData() {\n return this.data;\n }", "getData() {\n return this.data;\n }", "prepareData () {\n super.prepareData()\n\n const actorData = this.data\n const data = actorData.data\n const flags = actorData.flags\n\n // Make separate methods for each Actor type (character, npc, etc.) to keep\n // things organized.\n if (actorData.type === 'character' || actorData.type === 'creature') {\n this._prepareCharacterData(actorData)\n }\n }", "setData() {}", "resolveData() {\n return {\n metaTable: this.getMetaTable(),\n plugins: this.getPlugins(),\n rules: this.getRules(),\n transformers: this.transformers,\n };\n }", "_handleData() {\n // Pull out what we need from props\n const {\n _data,\n _dataOptions = {},\n } = this.props;\n\n // Pull out what we need from context\n const {\n settings = {},\n } = this.context;\n\n // Pull the 'getData' method that all modules which need data fetching\n // must implement\n const {\n getData = (() => Promise.resolve({ crap: 5 })),\n } = this.constructor;\n\n /**\n * Check if data was loaded server-side.\n * If not - we fetch the data client-side\n * and update the state\n *\n * We'll also add add the global settings to\n * the request implicitely\n */\n if (!_data) {\n getData(Object.assign({}, { __settings: settings }, _dataOptions))\n .then(_data => this.setState({ ['__data']: _data }))\n .catch(_data => this.setState({ ['__error']: _data }));\n }\n }", "getData() {\n const data = super.getData();\n data.labels = this.item.labels;\n \n // Include CONFIG values\n data.config = CONFIG.SFRPG;\n \n // Item Type, Status, and Details\n data.itemType = data.item.type.titleCase();\n data.itemStatus = this._getItemStatus(data.item);\n data.itemProperties = this._getItemProperties(data.item);\n data.isPhysical = data.item.data.hasOwnProperty(\"quantity\");\n data.hasLevel = data.item.data.hasOwnProperty(\"level\") && data.item.type !== \"spell\";\n data.hasHands = data.item.data.hasOwnProperty(\"hands\");\n data.hasCapacity = data.item.data.hasOwnProperty(\"capacity\");\n\n // Armor specific details\n data.isPowerArmor = data.item.data.hasOwnProperty(\"armor\") && data.item.data.armor.type === 'power';\n \n // Action Details\n data.hasAttackRoll = this.item.hasAttack;\n data.isHealing = data.item.data.actionType === \"heal\";\n \n // Spell-specific data\n if ( data.item.type === \"spell\" ) {\n let save = data.item.data.save;\n if ( this.item.isOwned && (save.type && !save.dc) ) {\n let actor = this.item.actor;\n let abl = actor.data.data.attributes.keyability || \"int\";\n save.dc = 10 + data.item.data.level + actor.data.data.abilities[abl].mod;\n }\n }\n\n data.modifiers = this.item.data.data.modifiers;\n \n return data;\n }", "getData () {\n }", "function initData(){\n o_data = user.original_musics;\n d_data = user.derivative_musics;\n c_data = user.collected_musics;\n}", "getData() {\n return this._data;\n }", "setData(data){\n this.hasSavedValues = false,\n this.publicoAlvoSim= data.publicoAlvoSim,\n this.publicoAlvoNao= data.publicoAlvoNao,\n this.publicoAlvoALVA= data.publicoAlvoNao,\n this.XER= data.XER,\n this.COP= data.COP,\n this.listaPrefixos= data.listaPrefixos,\n this.operacaoNaoVinculada= data.operacaoNaoVinculada,\n this.operacaoVinculada= data.operacaoVinculada,\n this.operacaoVinculadaEmOutroNPJ= data.operacaoVinculadaEmOutroNPJ,\n this.acordoRegPortalSim= data.acordoRegPortalSim,\n this.acordoRegPortalNao= data.acordoRegPortalNao,\n //this.acordoRegPortalDuplicados= data.acordoRegPortalDuplicados,\n this.totaisEstoque = data.totaisEstoque,\n this.totaisFluxo = data.totaisFluxo,\n this.estoqueNumber= data.estoqueNumber,\n this.fluxoNumber= data.fluxoNumber,\n this.duplicadoSimNao = data.duplicadoSimNao,\n this.analisadoSimNao = data.analisadoSimNao\n }", "prepareData() {\n super.prepareData();\n\n const actorData = this.data;\n const data = actorData.data;\n const flags = actorData.flags;\n }", "get() {\n return this.data\n }", "get data() {\n return getIn(privateDataMap.get(this).currentData, this.path);\n }", "get data() {\n return this.combinedData;\n }", "function Data() { }", "data() {\n\n let data = super.data();\n\n if (!data.zoom) {\n data.zoom = larabelt.coords.zoom ? larabelt.coords.zoom : 15;\n }\n\n if (this._location) {\n data._location = this._location;\n }\n\n if (this._geocode) {\n data._geocode = this._geocode;\n }\n\n return data;\n }", "get data() {\n return this[data];\n }", "get data() {return this[VALUE];}", "data () {\n let data = {}\n\n for (let property in this.originalData) {\n data[property] = this[property]\n }\n\n return data\n }", "function ProviderData() { }", "function ProviderData() { }", "prepareData() {\n let img = CONST.DEFAULT_TOKEN;\n switch (this.data.type) {\n case \"character\":\n img = \"/systems/hitos/assets/icons/character.svg\";\n break;\n case \"npc\":\n img = \"/systems/hitos/assets/icons/npc.svg\";\n break;\n case \"organization\":\n img = \"/systems/hitos/assets/icons/organization.svg\";\n break;\n case \"vehicle\":\n img = \"/systems/hitos/assets/icons/vehicle.svg\";\n break;\n }\n if (!this.data.img) this.data.img = img;\n\n super.prepareData();\n const actorData = this.data;\n const data = actorData.data;\n const flags = actorData.flags;\n\n // Make separate methods for each Actor type (character, npc, etc.) to keep\n // things organized.\n if (actorData.type === \"npc\" || actorData.type === \"character\") {\n this._prepareCharacterData();\n this._calculateRD();\n this._calculateDefense();\n }\n }", "get data() {\n return this.getStringAttribute('data');\n }", "function store (){\n\t\tthis.sensor =senType;\n\t\tthis.unit = thisUnit;\n\t\tthis.reading=maxRead;\n\t\tthis.moteId = idMote;\n\t}", "function store (){\n\t\tthis.sensor =senType;\n\t\tthis.unit = thisUnit;\n\t\tthis.reading=maxRead;\n\t\tthis.moteId = idMote;\n\t}", "function store (){\n\t\tthis.sensor =senType;\n\t\tthis.unit = thisUnit;\n\t\tthis.reading=maxRead;\n\t\tthis.moteId = idMote;\n\t}", "set data(data) {\n this.props.variant = data.variant;\n this.props.iconUrl = data.iconUrl;\n this.props.size = data.size || \"MEDIUM\" /* MEDIUM */;\n this.setDisabledProperty(data.disabled || false);\n ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);\n }", "GetData() {}", "set data(d){\n if (d instanceof Data) {\n d = d.data;\n }\n this._data = d || {};\n delete this._id;\n return this._data;\n }", "function ProviderData() {}", "function ProviderData() {}", "function ProviderData() {}", "assign (data) {\n this.reset()\n\n if (data == null) {\n return\n }\n\n if (this.vm.hasOwnProperty(this.options.property) === false) {\n console.warn(`Instance does not have an input property named \"${this.options.property}\"`)\n return\n }\n\n let props = this.vm[this.options.property]\n\n Object.keys(props).forEach(key => {\n if (data.hasOwnProperty(key)) {\n props[key] = data[key]\n }\n })\n }", "getData() {\n \n return {\n \n } \n }", "resetData() {\n\t\t\tthis.initFlags();\n\t\t\tthis.initMetadata();\n\t\t}", "set data(val) {\n this._data = val;\n }", "get userData() {}", "fetchData() {\n this.initLoading();\n let qs = this.setAndGetQuerySetFromSandBox(this.view, this.qs_url);\n this.data.instance = qs.cache = qs.model.getInstance({}, qs);\n this.setLoadingSuccessful();\n this.getParentInstancesForPath();\n }", "fetchData() {\n this.initLoading();\n let qs = this.setAndGetQuerySetFromSandBox(this.view, this.qs_url);\n this.data.instance = qs.cache = qs.model.getInstance({}, qs);\n this.setLoadingSuccessful();\n this.getParentInstancesForPath();\n }", "prepareData() {\n super.prepareData();\n\n // Get the Item's data\n const itemData = this.data;\n const actorData = this.actor ? this.actor.data : {};\n const data = itemData.data;\n\n // console.log(itemData);\n\n if (itemData.type === 'melee weapon') this._prepareMeleeData(itemData, actorData);\n if (itemData.data.mechanika) this._prepareMechanikaData(itemData);\n if (itemData.type === 'mechanika ranged weapon') this._prepareMrwData(itemData, actorData);\n // if (itemData.type === 'grid') this._prepareGrid(itemData, actorData);\n }", "_cleanAndSetData() {\n const propertySearchLocationPath = 'page.attributes.propertySearchLocation';\n const propertySearchLocation = get(this.digitalData, propertySearchLocationPath);\n if (propertySearchLocation === undefined) {\n this._set(propertySearchLocationPath, '');\n }\n\n const propertySearchDateInfoPath = 'page.attributes.propertySearchDateInfo';\n const propertySearchDateInfo = get(this.digitalData, propertySearchDateInfoPath);\n if (propertySearchDateInfo === undefined) {\n this._set(propertySearchDateInfoPath, '00:00:00:00');\n }\n\n const productIDPath = 'product[0].productInfo.productID';\n const productID = get(this.digitalData, productIDPath);\n if (productID === undefined) {\n this._set('product', [{ productInfo: { productId: '' } }]);\n }\n\n window.digitalData = this.digitalData;\n }", "constructor () {\n this.data = {}\n }", "getData() {\n \n}", "function Data()\n{\n //parameters\n this.total = 0;\n this.domestic = 0;\n this.transborder = 0;\n this.other = 0;\n}", "getMpsData()\r\n {\r\n return this.mpsData;\r\n }", "function makeDataFor() {\n\t\t// move the getter function aside\n\t\tdelete Element.prototype.data;\n\t\t// assign a new data ListMap to this object\n\t\tthis.data = new ListMap();\n\t\t// set an attribute on the element so we know to clear its data object later\n\t\tthis.setAttribute(\"data\",\"y\");\n\t\t// restore the getter function\n\t\tElement.prototype.__defineGetter__(\"data\", makeDataFor);\n\t\treturn this.data;\n\t}", "function get_data() {}", "getData() {\n return this._cachedData;\n }", "get data() {\n return {};\n }", "getData() {\n return this.globalData;\n }", "set data(value) {\n this.setData(value);\n }", "get data() {\n return this.combinedData;\n }", "set_data(data) {\n this.wasmInstance.exports.opa_heap_ptr_set(this.baseHeapPtr);\n this.wasmInstance.exports.opa_heap_top_set(this.baseHeapTop);\n this.dataAddr = _loadJSON(this.wasmInstance, this.mem, data);\n this.dataHeapPtr = this.wasmInstance.exports.opa_heap_ptr_get();\n this.dataHeapTop = this.wasmInstance.exports.opa_heap_top_get();\n }", "getData(){\n\t\treturn this;\n\t}", "constructor() {\n super();\n this.data = new Data();\n }", "getData()\n {\n let data = {};\n\n for (let field in this.__.originalData)\n {\n data[field] = this[field];\n }\n\n return data;\n }", "static parse(data) {\r\n const parsedData = super.parse(data)\r\n\r\n parsedData.name = data.name\r\n parsedData.identificationNumber = data.identification_number\r\n parsedData.description = data.description\r\n\r\n parsedData.isService = 'is_service' in data ? data.is_service : data.price === null\r\n parsedData.qty = Number(data.qty)\r\n\r\n const currency = CurrencyRepository.findByKey(data.currency_code)\r\n\r\n parsedData.currency = currency\r\n parsedData.price = Money.create({\r\n amount: data.price,\r\n currency\r\n })\r\n\r\n return parsedData\r\n }", "function processDataFromDocusky() {\n\tparseDocInfo();\n\ttoolSetting();\n}", "get data() {\n return this.state.data;\n }", "function ProviderData(){}", "constructor( data ){\n this._emitter = new EventTarget();\n this._converters = new Map();\n this._dynamicProperties = false;\n this._data = data;\n }", "function consumptionMapData() {\n /* eslint-disable no-undef */\n emit(this.id, { \n litresConsumed: this.litresConsumed, \n kilometersTravelled: this.kilometersTravellled,\n litrosTanque: this.litrosTanque, \n kilometraje: this.kilometraje,\n processed: this.processed \n });\n /* eslint-enable no-undef */\n}", "getData() {\n return {};\n }", "function processComponentData(item)\n\t\t\t{\n\t\t\t\tslot = $(this).attr('data-slot');\n\t\t\t\ttype = $(this).attr('data-type');\n\n\t\t\t\tcomponent_data['id'] = component_id; // if id key is undefined, it will be omitted\n\n\t\t\t\tswitch(type)\n\t\t\t\t{\n\t\t\t\t\tcase 'image':\n\t\t\t\t\t\tcomponent_data[slot] = $(this).attr('src');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'custom':\n\t\t\t\t\t\tcomponent_data[slot] = $(this).attr('data-custom');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'input':\n\t\t\t\t\t\tcomponent_data[slot] = $(this).val();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'array':\n\t\t\t\t\t\twrapper = $(this).attr('data-wrapper');\n\t\t\t\t\t\tsub_data = new Array();\n\t\t\t\t\t\t$(this).find(wrapper).each(function()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tsub_data.push($(this).html());\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcomponent_data[slot] = sub_data;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'style':\n\t\t\t\t\t\tcomponent_data[slot] = $(this).attr('style');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcomponent_data[slot] = CKEDITOR.instances[$(this).attr('id')].getData();\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}", "loadData() {\n let key = this.Key;\n let tmp = [];\n\n if (key === \"department\") {\n getDepartment().done((res) => {\n res.forEach(({ DepartmentId, DepartmentName }) =>\n tmp.push({\n id: DepartmentId,\n label: DepartmentName,\n })\n );\n\n this.Data = tmp;\n });\n } else if (key === \"position\") {\n getPosition().done((res) => {\n res.forEach(({ PositionId, PositionName }) =>\n tmp.push({\n id: PositionId,\n label: PositionName,\n })\n );\n\n this.Data = tmp;\n });\n } else this.Data = formData[key];\n }", "loadData() {\r\n\t\t// load the current tracker type data from localStorage\r\n\t\tlet currentData = localStorage.getItem( this.type );\r\n\r\n\t\t// parse it into an object if it exists\r\n\t\tif ( currentData ) {\r\n\t\t\tthis.data = JSON.parse(currentData);\r\n\t\t} else {\r\n\t\t\tthis.data = {};\r\n\t\t}\r\n\t}", "preprocessData(type) {\n if (type == \"Genomes\")\n this.preprocessGenomes();\n else if (type == \"Paired-end Reads\")\n this.preprocessPairedReads();\n else if (type == \"Single-end Reads\")\n this.preprocessSingleReads();\n else if (type == \"Interleaved Paired-end Reads\")\n this.preprocessSingleReads();\n }", "get data() {\n\t\treturn this._tableData;\n\t}", "_resetData () {\n this.data = {}\n }", "get dataRequirement() {\n\t\treturn this.__dataRequirement;\n\t}", "setData (data) {\n this.processData(data);\n this.trigger('update', data);\n }", "_data(data) {\n this.displayData = data;\n }", "constructor() {\n this.data = {};\n }", "constructor() {\n this.data = {};\n }", "initData(data) {\n this.status = data.status;\n this.id = data.id;\n }", "get data() { return this.item.data; }", "processData(apiData){\n this.setNextPage(apiData.next_page)\n this.setPreviousPage(apiData.previous_page)\n this.setTicketCount(apiData.count)\n }" ]
[ "0.6882254", "0.68435836", "0.6732056", "0.6642908", "0.6597483", "0.65298647", "0.64972115", "0.64913255", "0.64820457", "0.64820457", "0.64820457", "0.6423674", "0.63416713", "0.63211304", "0.63187164", "0.63104314", "0.62410027", "0.6230067", "0.62212604", "0.6212552", "0.6193653", "0.61885536", "0.6179881", "0.6173979", "0.6173979", "0.6161897", "0.61590767", "0.61393917", "0.6133951", "0.61194855", "0.610934", "0.6054223", "0.6053117", "0.60509264", "0.60504615", "0.60437286", "0.6042791", "0.604203", "0.6009461", "0.60061014", "0.60029435", "0.599206", "0.5988345", "0.5965612", "0.5965612", "0.59505886", "0.59376484", "0.59370834", "0.59370834", "0.59370834", "0.5903267", "0.583008", "0.58226895", "0.5809608", "0.5809608", "0.5809608", "0.5808212", "0.58052707", "0.5804587", "0.5796806", "0.5795002", "0.5788253", "0.5788253", "0.57861394", "0.57848436", "0.577036", "0.57650894", "0.5764515", "0.5761571", "0.57615215", "0.5760074", "0.57467127", "0.57286805", "0.57251513", "0.5722101", "0.5712259", "0.56970096", "0.56945163", "0.56893986", "0.5683418", "0.5671829", "0.56695455", "0.56638736", "0.56617594", "0.5661205", "0.56536365", "0.5650195", "0.564807", "0.5646716", "0.5641597", "0.56385124", "0.5632172", "0.5626876", "0.5624064", "0.56082636", "0.5601246", "0.56003904", "0.56003904", "0.55858284", "0.5583434", "0.55814105" ]
0.0
-1
Plugin management. Pass it: an attacher and options, a preset, a list of presets, attachers, and arguments (list of attachers and options).
function use(value) { var settings assertUnfrozen('use', frozen) if (value === null || value === undefined) { /* Empty */ } else if (typeof value === 'function') { addPlugin.apply(null, arguments) } else if (typeof value === 'object') { if ('length' in value) { addList(value) } else { addPreset(value) } } else { throw new Error('Expected usable value, not `' + value + '`') } if (settings) { namespace.settings = extend(namespace.settings || {}, settings) } return processor function addPreset(result) { addList(result.plugins) if (result.settings) { settings = extend(settings || {}, result.settings) } } function add(value) { if (typeof value === 'function') { addPlugin(value) } else if (typeof value === 'object') { if ('length' in value) { addPlugin.apply(null, value) } else { addPreset(value) } } else { throw new Error('Expected usable value, not `' + value + '`') } } function addList(plugins) { var length var index if (plugins === null || plugins === undefined) { /* Empty */ } else if (typeof plugins === 'object' && 'length' in plugins) { length = plugins.length index = -1 while (++index < length) { add(plugins[index]) } } else { throw new Error('Expected a list of plugins, not `' + plugins + '`') } } function addPlugin(plugin, value) { var entry = find(plugin) if (entry) { if (plain(entry[1]) && plain(value)) { value = extend(entry[1], value) } entry[1] = value } else { attachers.push(slice.call(arguments)) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function registerPresets(newPresets) {\n Object.keys(newPresets).forEach(function (name) {\n return registerPreset(name, newPresets[name]);\n });\n } // All the plugins we should bundle", "function handlePlugins$1(inputs, calendar) {\n calendar.addPluginInputs(inputs); // will gracefully handle duplicates\n }", "function init() {\n var _this = this;\n\n this._get('options').plugins.forEach(function (plugin) {\n // check if plugin definition is string or object\n var Plugin = undefined;\n var pluginName = undefined;\n var pluginOptions = {};\n if (typeof plugin === 'string') {\n pluginName = plugin;\n } else if ((typeof plugin === 'undefined' ? 'undefined' : babelHelpers.typeof(plugin)) === 'object') {\n pluginName = plugin.name;\n pluginOptions = plugin.options || {};\n }\n\n Plugin = find(pluginName);\n _this._get('plugins')[plugin] = new Plugin(_this, pluginOptions);\n\n addClass(_this._get('$container'), pluginClass(pluginName));\n });\n }", "function handlePlugins(inputs, calendar) {\n calendar.addPluginInputs(inputs); // will gracefully handle duplicates\n }", "function handlePlugins(inputs, calendar) {\n calendar.addPluginInputs(inputs); // will gracefully handle duplicates\n }", "function handlePlugins(inputs, calendar) {\n calendar.addPluginInputs(inputs); // will gracefully handle duplicates\n }", "_initPlugins() {\n this.plugins.forEach(plugin => {\n if (plugin === 'ubiety-custom-texture' && !this.customTextureModule) {\n this.customTextureModule = new UbietyCustomTexture('ubiety-custom-texture', this, 'umjs-texture-factory');\n }\n else if (plugin === 'ubiety-text-editor' && !this.customTextEditorModule) {\n this.customTextEditorModule = new UbietyCustomTexture('ubiety-text-editor', this, 'umjs-text-image-factory');\n }\n else {\n console.error('Ubiety:: Either a plugin can\\'t be recognised, or it already exists.');\n }\n });\n }", "function Plugin(element, options) {\r\n this.element = element;\r\n this.settings = options;\r\n\r\n this._defaults = defaults;\r\n this._name = pluginName;\r\n this._uploader = null;\r\n this.init();\r\n }", "function handlePlugins(inputs, calendar) {\n calendar.addPluginInputs(inputs); // will gracefully handle duplicates\n}", "initPlugins() {}", "initPlugins() {}", "function Plugin(element, options) {\r\n\r\n\t\tthis.element = element;\r\n\t\tthis.$element = $(this.element);\r\n\t\tthis._name = pluginName;\r\n\t\tthis._defaults = $.fn[pluginName].defaults;\r\n\t\tthis.settings = $.extend(true, {}, this._defaults, options);\r\n\t\tthis.loadDependencies();\r\n\t\t\r\n\t}", "addPlugins(...plugins) {\n InstancePlugin.initPlugins(this, ...plugins);\n }", "function Plugin( element, options )\n {\n \n this.element = element;\n\n this.options = $.extend( {}, defaults, options );\n\n this._defaults = defaults;\n this._name = pluginName;\n\n this.init();\n }", "function Plugin( element, options ) {\n\t\tthis.$element = $(element);\n this.element = element;\n this.options = $.extend( {}, defaults, options) ;\n this._defaults = defaults;\n this._name = pluginName;\n \n this.init();\n }", "function Plugin( element, options ) {\n tabElement = $(element);\n switchElement = $(options.target);\n eventType = options.eventType || \"click\";\n actClassName = options.actClassName;\n callback = options.callback;\n // jQuery has an extend method which merges the contents of two or \n // more objects, storing the result in the first object. The first object\n // is generally empty as we don't want to alter the default options for\n // future instances of the plugin\n me = this;\n me.element = element;\n me.options = $.extend( {}, defaults, options) ;\n \n me._defaults = defaults;\n me._name = pluginName;\n \n me.init();\n }", "function make(useopts) {\n // Default options, overidden by caller supplied options.\n useopts = Object.assign(\n {\n prefix: 'plugin-',\n builtin: '../plugin/',\n module: module.parent,\n errmsgprefix: true,\n system_modules: intern.make_system_modules(),\n merge_defaults: true,\n gubu: true,\n },\n useopts\n )\n\n // Setup error messages, see msgmap function below for text.\n const eraro = Eraro({\n package: 'use-plugin',\n msgmap: msgmap(),\n module: module,\n prefix: useopts.errmsgprefix,\n })\n\n // This is the function that loads plugins.\n // It is returned for use by the framework calling code.\n // Parameters:\n //\n // * _plugin_ : (Object or Function or String); plugin definition\n // * if Object: provide a partial or complete definition with same properties as return value\n // * if Function: assumed to be plugin _init_ function; plugin name taken from function name, if defined\n // * if String: base for _require_ search; assumes module defines an _init_ function\n // * _options_ : (Object, ...); plugin options, if not an object, constructs an object of form {value$:options}\n // * _callback_ : (Function); callback function, possibly to be called by framework after init function completes\n //\n // Returns: A plugin description object is returned, with properties:\n //\n // * _name_ : String; the plugin name, either supplied by calling code, or derived from definition\n // * _init_ : Function; the plugin init function, the resolution of which is the point of this module!\n // * _options_ : Object; plugin options, if supplied\n // * _search_ : Array[{type,name}]; list of require search paths; applied to each module up the parent chain until something is found\n // * _found_ : Object{type,name}; search entry that found something\n // * _requirepath_ : String; the argument to require that found something\n // * _modulepath_ : String; the Node.js API module.id whose require found something\n // * _tag_ : String; the tag value of the plugin name (format: name$tag), if any, allows loading of same plugin multiple times\n // * _err_ : Error; plugin load error, if any\n function use() {\n const args = Norma(\n '{plugin:o|f|s, options:o|s|n|b?, callback:f?}',\n arguments\n )\n return use_plugin_desc(\n build_plugin_desc(args, useopts, eraro),\n useopts,\n eraro\n )\n }\n\n // use.Optioner = Optioner\n // use.Joi = Optioner.Joi\n\n use.use_plugin_desc = function (plugin_desc) {\n return use_plugin_desc(plugin_desc, useopts, eraro)\n }\n\n use.build_plugin_desc = function () {\n const args = Norma(\n '{plugin:o|f|s, options:o|s|n|b?, callback:f?}',\n arguments\n )\n return build_plugin_desc(args, useopts, eraro)\n }\n\n return use\n}", "function Plugin( element, options ) {\n this.element = element;\n this.options = $.extend( {}, defaults, options) ;\n \n this._defaults = defaults;\n this._name = pluginName;\n\n this.init();\n }", "function Plugin( element, options ) {\n this.ele = element; \n this.$ele = $(element); \n this.options = $.extend( {}, defaults, options) ; \n \n this._defaults = defaults; \n this._name = pgn; \n\n this.init(); \n }", "function Plugin($element, $options) \n\t{\n\t\tthis.element \t\t\t\t\t= $element;\n\t\tthis.settings \t\t\t\t\t= $.extend({}, $defaults, $options);\n\t\tthis._defaults \t\t\t\t\t= $defaults;\n\t\tthis._name \t\t\t\t\t\t= $contextplate;\n\n\t\t// Initilize plugin\n\t\tthis.init();\n\t}", "function use(value) {\n var settings;\n\n assertUnfrozen('use', frozen);\n\n if (value === null || value === undefined) ; else if (typeof value === 'function') {\n addPlugin.apply(null, arguments);\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value);\n } else {\n addPreset(value);\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend$1(namespace.settings || {}, settings);\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins);\n\n if (result.settings) {\n settings = extend$1(settings || {}, result.settings);\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value);\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value);\n } else {\n addPreset(value);\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var index = -1;\n\n if (plugins === null || plugins === undefined) ; else if (typeof plugins === 'object' && 'length' in plugins) {\n while (++index < plugins.length) {\n add(plugins[index]);\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin);\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend$1(true, entry[1], value);\n }\n\n entry[1] = value;\n } else {\n attachers.push(slice$1.call(arguments));\n }\n }\n }", "function Plugin ( element, options ) {\n this.element = element;\n\t\t\t this.options = $.extend( {}, defaults, options) ;\n this._defaults = defaults;\n this._name = pluginName;\n this.init();\n }", "function use(value) {\n var settings;\n\n assertUnfrozen('use', frozen);\n\n if (value === null || value === undefined) {\n /* Empty */\n } else if (func(value)) {\n addPlugin.apply(null, arguments);\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value);\n } else {\n addPreset(value);\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`');\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings);\n }\n\n return processor;\n\n function addPreset(result) {\n addList(result.plugins);\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings);\n }\n }\n\n function add(value) {\n if (func(value)) {\n addPlugin(value);\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value);\n } else {\n addPreset(value);\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`');\n }\n }\n\n function addList(plugins) {\n var length;\n var index;\n\n if (plugins === null || plugins === undefined) {\n /* Empty */\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n length = plugins.length;\n index = -1;\n\n while (++index < length) {\n add(plugins[index]);\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`');\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin);\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(entry[1], value);\n }\n\n entry[1] = value;\n } else {\n attachers.push(slice.call(arguments));\n }\n }\n }", "function Plugin(element, options) {\n this.element = element;\n this.rangerin = {};\n this.$element = $(this.element);\n this.options = options;\n this.metadata = this.$element.data('options');\n this.settings = $.extend({}, defaults, this.options, this.metadata);\n this.init();\n }", "function Plugin(element, options) {\n this.element = element;\n this.init();\n }", "function Plugin(element, options) {\n\t\tthis.element = element;\n\t\tthis.options = $.extend({}, defaults, options);\n\t\tthis._defaults = defaults;\n\t\tthis._name = pluginName;\n\n this.init();\n\n\t}", "function pluginInit( patternlab ) {\n\n // Create a helper for cleaner console logging.\n const log = (type, ...messages) => console[type](`${pluginName}:`, ...messages);\n\n // Exit if patterlab not set.\n if ( !patternlab ) {\n\n // Report error.\n log('error', 'patternlab object not provided to plugin-init');\n\n // Exit.\n process.exit(1);\n\n }\n\n // Get default plugin configurations.\n var pluginConfig = getPluginFrontendConfig();\n\n // Get project-specific plugin configurations.\n pluginConfig.tabsToAdd = patternlab.config.plugins[pluginName].options.tabsToAdd;\n\n // Write the plugin JSON to the `public/patternlab-components`.\n writeConfigToOutput(patternlab, pluginConfig);\n\n // Get the output path.\n var pluginConfigPathName = path.resolve(patternlab.config.paths.public.root, 'patternlab-components', 'packages');\n\n // Output configurations as JSON.\n try {\n\n fs.outputFileSync(pluginConfigPathName + '/' + pluginName + '.json', JSON.stringify(pluginConfig, null, 2));\n\n } catch (ex) {\n\n log('trace', 'Error occurred while writing pluginFile configuration');\n log('log', ex);\n\n }\n\n // Initialize patternlab plugins if no other plugins have been registered already.\n if( !patternlab.plugins ) patternlab.plugins = [];\n\n // Add the plugin configurations to the patternlab object.\n patternlab.plugins.push(pluginConfig);\n\n // Find plugin files.\n var pluginFiles = glob.sync(path.join(__dirname, '/dist/**/*'));\n\n // Identity component files.\n var componentFiles = [\n 'markup-templating'\n ];\n\n // Load the plugin.\n if( pluginFiles && pluginFiles.length > 0 ) {\n\n // Get JS snippet.\n let tab_frontend_snippet = fs.readFileSync(path.resolve(__dirname + '/src/snippet.js'), 'utf8');\n\n // Load each plugin file.\n pluginFiles.forEach((pluginFile) => {\n\n // Make sure the file exists.\n if ( fs.existsSync(pluginFile) && fs.statSync(pluginFile).isFile() ) {\n\n // Get file paths.\n let relativePath = path.relative(__dirname, pluginFile).replace('dist', '');\n let writePath = path.join(patternlab.config.paths.public.root, 'patternlab-components', 'pattern-lab', pluginName, relativePath);\n\n // A message to future plugin authors:\n // Depending on your plugin's job, you might need to alter the dist file instead of copying.\n // If you are simply copying `dist` files, you can probably do the below:\n // fs.copySync(pluginFile, writePath);\n\n // In this case, we need to alter the `dist` file to loop through our tabs to load as defined in the `package.json`.\n // We are also being a bit lazy here, since we only expect one file.\n let tabJSFileContents = fs.readFileSync(pluginFile, 'utf8');\n\n // Initialize an empty string of parsed JS snippets.\n let snippetString = '';\n\n // Initialize an empty object for loading languages.\n let prismLanguages = {};\n\n // Initialize an empty array for loading components.\n let prismComponents = [];\n\n // Make sure some tabs should be parsed.\n if( pluginConfig.tabsToAdd && pluginConfig.tabsToAdd.length > 0 ) {\n\n // Parse the JS snippet for each tab.\n pluginConfig.tabsToAdd.forEach((lang) => {\n\n // Parse the snippet.\n let tabSnippetLocal = tab_frontend_snippet.replace(/<<type>>/g, lang).replace(/<<typeUC>>/g, lang.toUpperCase());\n\n // Save the snippet.\n snippetString += tabSnippetLocal + EOL;\n\n // Find the language.\n let tabLanguageLocal = loadPrismLanguage(lang);\n\n // Save the language.\n if( !prismLanguages[lang] && tabLanguageLocal ) prismLanguages[lang] = tabLanguageLocal;\n\n });\n\n // Load each component file.\n componentFiles.forEach((componentFile) => {\n\n // Attempt to load the component file.\n const component = loadPrismComponent(componentFile);\n\n // Generate the output file.\n if( component ) prismComponents.push(component);\n\n });\n\n // Generate the output file.\n tabJSFileContents = tabJSFileContents.replace('/*SNIPPETS*/', snippetString).replace('/*LANGUAGES*/', Object.values(prismLanguages).join(EOL)).replace('/*COMPONENTS*/', prismComponents.join('\\n'));\n\n // Save the output file for use in the browser.\n fs.outputFileSync(writePath, tabJSFileContents);\n\n }\n\n }\n\n });\n\n }\n\n // Setup listeners if not already active. We also enable and set the plugin as initialized.\n if( !patternlab.config.plugins ) patternlab.config.plugins = {};\n\n // Attempt to only register events once.\n if( patternlab.config.plugins[pluginName] !== undefined && patternlab.config.plugins[pluginName].enabled && !patternlab.config.plugins[pluginName].initialized ) {\n\n // Register events.\n registerEvents(patternlab);\n\n // Set the plugin initialized flag to `true` to indicate it is installed and ready.\n patternlab.config.plugins[pluginName].initialized = true;\n\n }\n\n}", "addPlugins(...plugins) {\n InstancePlugin.initPlugins(this, ...plugins);\n }", "function parseAndGivePlugins(pluginMeta, container) {\n\t//Build the buffer animation\n\tbuildLoader = \"\\\n\t\t<div id='loadingSign'>\\\n\t\t\t<img src='http://blogy.co/Library/images/loadSign_white.gif'/>\\\n\t\t</div>\\\n\t\";\n\t$(container).append(buildLoader);\n\n\tpluginName = pluginMeta.split(\"~\")[0];\n\tpluginSlug = pluginMeta.split(\"~\")[1];\n\tpluginAuthor = pluginMeta.split(\"~\")[2];\n\n\tvar requestType;\n\tif (window.XMLHttpRequest) {\n\t\trequestType = new XMLHttpRequest();\n\t} else {\n\t\trequestType = new ActiveXObject(\"Microsoft.XMLHTTP\");\n\t}\n\trequestType.open(\"POST\", \"giveMePlugin.php\", true);\n\trequestType.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\");\n\trequestType.send(\"pluginName=\"+pluginName+\"&pluginSlug=\"+pluginSlug+\"&pluginAuthor=\"+pluginAuthor);\n\n\trequestType.onreadystatechange = function() {\n\t\tif (requestType.readyState == 4 && requestType.status == 200) {\n\t\t\t$(container).children(\"#loadingSign\").remove();\n\t\t\t$(container+\" #\"+pluginSlug).remove();\n\t\t\t$(container).append(requestType.responseText);\n\t\t}\n\t}\n}", "function Plugin( element, options, names) {\n this.element = element;\n \n this.last = null;\n \n options = options || function(){console.log('Test');return {};};\n\n this.options = $.extend( {}, defaults, options) ;\n\n this.names = $.extend( {}, team, names) ;\n \n this._defaults = defaults;\n\n this._name = pluginName;\n \n this.init();\n }", "function use(value) {\n var settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin.apply(null, arguments)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings)\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings)\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var length\n var index\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n length = plugins.length\n index = -1\n\n while (++index < length) {\n add(plugins[index])\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin)\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(entry[1], value)\n }\n\n entry[1] = value\n } else {\n attachers.push(slice.call(arguments))\n }\n }\n }", "function Plugin ( element, options ) {\n this.element = element;\n this.settings = $.extend( {}, defaults, options );\n this._name = pluginName;\n this.init();\n }", "use(pluginFn, options) {\n this.plugins.push({\n fn: pluginFn,\n options,\n });\n return this;\n }", "function use(value) {\n var settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin.apply(null, arguments)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings)\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings)\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n while (++index < plugins.length) {\n add(plugins[index])\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin)\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(true, entry[1], value)\n }\n\n entry[1] = value\n } else {\n attachers.push(slice.call(arguments))\n }\n }\n }", "function use(value) {\n var settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin.apply(null, arguments)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = extend(namespace.settings || {}, settings)\n }\n\n return processor\n\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = extend(settings || {}, result.settings)\n }\n }\n\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if ('length' in value) {\n addPlugin.apply(null, value)\n } else {\n addPreset(value)\n }\n } else {\n throw new Error('Expected usable value, not `' + value + '`')\n }\n }\n\n function addList(plugins) {\n var index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (typeof plugins === 'object' && 'length' in plugins) {\n while (++index < plugins.length) {\n add(plugins[index])\n }\n } else {\n throw new Error('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n function addPlugin(plugin, value) {\n var entry = find(plugin)\n\n if (entry) {\n if (plain(entry[1]) && plain(value)) {\n value = extend(true, entry[1], value)\n }\n\n entry[1] = value\n } else {\n attachers.push(slice.call(arguments))\n }\n }\n }", "function Plugin(element, options) {\r\n this.element = element;\r\n\r\n this.settings = $.extend({}, defaults, options);\r\n this._defaults = defaults;\r\n this._name = pluginName;\r\n\r\n\r\n this.init();\r\n }", "function Plugin (element, options) {\n this.element = element;\n this.settings = $.extend({}, defaults, options);\n this._defaults = defaults;\n this._name = pluginName;\n this.init();\n }", "function Plugin(element, options) {\n this.$element = $(element);\n this.$submit = this.$element.find('button[type=\"submit\"]');\n // jQuery has an extend method that merges the\n // contents of two or more objects, storing the\n // result in the first object. The first object\n // is generally empty because we don't want to alter\n // the default options for future instances of the plugin\n var metadata = this.$element.data();\n this.options = $.extend({}, defaults, options, metadata);\n //\n this._defaults = defaults;\n this._name = pluginName;\n\n //\n this.init();\n }", "function Plugin ( element, options ) {\n\t\t\t\tthis.element = element;\n\t\t\t\tthis.settings = $.extend( {}, defaults, options );\n\t\t\t\tthis._defaults = defaults;\n\t\t\t\tthis._name = pluginName;\n\t\t\t\tthis.init();\n\t\t\t\t\n\n\t\t\t\t\t\t\t\n\t\t}", "function Plugin(element, options) {\r\n this.element = element;\r\n\r\n this.settings = $.extend({}, defaults, options);\r\n this._defaults = defaults;\r\n this._name = pluginName;\r\n this._currentUserId = window.currentUserId;\r\n this._currentCompanyId = window.currentCompanyId;\r\n this._uploadmgrContainer = null;//上传容器\r\n this._contactAttachList = [];//关联合同-上传的合同附件\r\n this._attachList = null;//查询的合同列表\r\n\r\n this._title = '收款';\r\n if(this.settings.doType==1){//付款\r\n this.settings.title = '添加付款计划';\r\n this._title = '付款';\r\n }\r\n\r\n this.init();\r\n }", "function addPreset(name,definition){definition=definition||{};definition.methods=definition.methods||[];definition.options=definition.options||function(){return{};};if(/^cancel|hide|show$/.test(name)){throw new Error(\"Preset '\"+name+\"' in \"+interimFactoryName+\" is reserved!\");}if(definition.methods.indexOf('_options')>-1){throw new Error(\"Method '_options' in \"+interimFactoryName+\" is reserved!\");}providerConfig.presets[name]={methods:definition.methods.concat(EXPOSED_METHODS),optionsFactory:definition.options,argOption:definition.argOption};return provider;}", "function Plugin( element, options ) {\n this.element = element;\n\n this.options = $.extend({ done: function(){} }, defaults, options);\n\n this._defaults = defaults;\n this._name = pluginName;\n\n this.start();\n }", "function Plugin(element, options) {\r\r\n this.element = element;\r\r\n this.options = $.extend({}, defaults, options);\r\r\n this._defaults = defaults;\r\r\n this._name = pluginName;\r\r\n this.init();\r\r\n }", "function Plugin ( element, options ) {\n\t\t\tthis.element = element;\n\t\t\tthis.settings = $.extend( {}, defaults, options );\n\t\t\tthis._defaults = defaults;\n\t\t\tthis._name = pluginName;\n\t\t\tthis.init();\n\t\t}", "function Plugin ( element, options ) {\n\t\t\tthis.element = element;\n\t\t\tthis.settings = $.extend( {}, defaults, options );\n\t\t\tthis._defaults = defaults;\n\t\t\tthis._name = pluginName;\n\t\t\tthis.init();\n\t\t}", "function Plugin ( element, options ) {\n\t\tthis.element = element;\n\t\tthis.settings = $.extend( {}, defaults, options );\n\t\tthis._defaults = defaults;\n\t\tthis._name = pluginName;\n\t\tthis.init();\n\t}", "function Plugin ( element, options ) {\n\t\tthis.element = element;\n\t\tthis.settings = $.extend( {}, defaults, options );\n\t\tthis._defaults = defaults;\n\t\tthis._name = pluginName;\n\t\tthis.init();\n\t}", "function Plugin (element, options) {\n\t\t\tthis.element = element;\n\t\t\tthis.settings = $.extend({}, defaults, options);\n\t\t\tthis._defaults = defaults;\n\t\t\tthis._name = pluginName;\n\t\t\tthis.init();\n\t\t}", "function Plugin(element, options) {\n if (typeof options === \"string\") {\n this.methods[options](this, element, options);\n return;\n }\n\n this.options = $.extend({}, defaults, options);\n this._defaults = defaults;\n this._name = pluginName;\n this.init(element);\n }", "function Plugin ( element, options ) {\r\n\t\t\t\t//Nome do plugin\r\n\t\t\t\tthis._name = pluginName;\r\n\t\t\t\t//Valores padroes de configuraçoes\r\n\t\t\t\tthis._defaults = defaults;\r\n\t\t\t\t//Elemento passado na chamada do plugin pelo seletor JQuery\r\n\t\t\t\tthis.element = element;\r\n\t\t\t\t//Container, objeto externo que envolve o formulario\r\n\t\t\t\tthis._container = $(element).parent();\r\n\r\n\t\t\t\t// jQuery has an extend method which merges the contents of two or\r\n\t\t\t\t// more objects, storing the result in the first object. The first object\r\n\t\t\t\t// is generally empty as we don't want to alter the default options for\r\n\t\t\t\t// future instances of the plugin\r\n\t\t\t\t//pega dois ou mais objetos como argumentos e une seus conteúdos dentro do primeiro objeto.\r\n\t\t\t\tthis.settings = $.extend( {}, defaults, options );\r\n\t\t\t\t//Inicia o plugin\r\n\t\t\t\tthis.init();\r\n\t\t}", "function Plugin ( element, options ) {\n this.element = element;\n this.settings = $.extend( {}, defaults, options );\n this._defaults = defaults;\n\n this._name = pluginName;\n this.init();\n }", "function Plugin( element, options ) {\n this.element = element;\n this.options = $.extend( {}, defaults, options );\n this._defaults = defaults;\n this._name = pluginName;\n this.init();\n }", "function Plugin(element, options) {\n this.element = element;\n this.options = $.extend({}, defaults, options);\n this._defaults = defaults;\n this._name = pluginName;\n\n this.init();\n }", "function Plugin( element, options ) {\n\n //SET OPTIONS\n this.options = $.extend( {}, defaults, options );\n this._defaults = defaults;\n this._name = pluginName;\n\n //REGISTER ELEMENT\n this.$element = $(element);\n\n //INITIALIZE\n this.init();\n }", "function Plugin( element, options ) {\n\t\tthis.element = element;\n\t\tthis.$el = $(element);\n\n\t\tthis.options = $.extend( {}, defaults, options) ;\n\n\t\tthis._defaults = defaults;\n\t\tthis._name = pluginName;\n\n\t\tthis.init();\n\t}", "function Plugin ( element, options ) {\n\t\t\t\tthis.element = element;\n\t\t\t\tthis.settings = $.extend( {}, defaults, options );\n\t\t\t\tthis._defaults = defaults;\n\t\t\t\tthis._name = pluginName;\n\t\t\t\tthis.init();\n\t\t}", "function Plugin ( element, options ) {\n\t\t\t\tthis.element = element;\n\t\t\t\tthis.settings = $.extend( {}, defaults, options );\n\t\t\t\tthis._defaults = defaults;\n\t\t\t\tthis._name = pluginName;\n\t\t\t\tthis.init();\n\t\t}", "function Plugin( element, options ) {\n this.element = element;\n\n // jQuery has an extend method that merges the\n // contents of two or more objects, storing the\n // result in the first object. The first object\n // is generally empty because we don't want to alter\n // the default options for future instances of the plugin\n this.options = $.extend( {}, defaults, options) ;\n\n this._defaults = defaults;\n this._name = pluginName;\n this._filters = {};\n\n this.init();\n }", "_setPlugins() {\n this.config.plugins = {\n // Systems\n global: [\n { key: 'RoomSystem', plugin: Systems.RoomSystem, start: false, mapping: 'rooms' },\n { key: 'CursorSystem', plugin: Systems.CursorSystem, start: false, mapping: 'cursors' }\n ],\n // Managers\n scene: [\n { key: 'UpdateManager', plugin: Managers.UpdateManager, mapping: 'updates' },\n { key: 'LightSourceManager', plugin: Managers.LightSourceManager, mapping: 'lightSources' },\n { key: 'LayerManager', plugin: Managers.LayerManager, mapping: 'layers' }\n ]\n };\n }", "function Plugin ( element, options ) {\n\n\t\tthis.element = element;\n\t\tthis.$elem = $(this.element);\n\n\t\tthis.settings = $.extend( {}, defaults, options );\n\t\tthis._defaults = defaults;\n\t\tthis._name = pluginName;\n\n\t\tthis.init();\n\n\t}", "function Plugin ( element, options ) {\n\t\tthis.element = element;\n\t\t// jQuery has an extend method which merges the contents of two or\n\t\t// more objects, storing the result in the first object. The first object\n\t\t// is generally empty as we don't want to alter the default options for\n\t\t// future instances of the plugin\n\t\tthis.settings = $.extend({}, defaults, options);\n \tthis.settings.sub = $(this.settings.sub);\n \tthis.settings.link = $(this.settings.link);\n\t\tthis._defaults = defaults;\n\t\tthis._name = pluginName;\n\t\tthis.init();\n\t}", "function Plugin( element, options ) {\n this.element = element;\n\n // jQuery has an extend method which merges the contents of two or \n // more objects, storing the result in the first object. The first object\n // is generally empty as we don't want to alter the default options for\n // future instances of the plugin\n this.options = $.extend( {}, defaults, options) ;\n \n this._defaults = defaults;\n this._name = pluginName;\n \n this.init();\n }", "function Plugin ( element, options ) {\n\t\t\t\tthis.element = element;\n\t\t\t\tthis.$element = $(element);\n\t\t\t\tthis.settings = $.extend( {}, defaults, options );\n\t\t\t\tthis._defaults = defaults;\n\t\t\t\tthis._name = pluginName;\n\t\t\t\tthis.init();\n\t\t}", "function Plugin (element, options) {\n this.element = element;\n // jQuery has an extend method which merges the contents of two or\n // more objects, storing the result in the first object. The first object\n // is generally empty as we don't want to alter the default options for\n // future instances of the plugin\n this.options = $.extend({}, defaults, options);\n this._defaults = defaults;\n this._name = pluginName;\n this.init();\n }", "function processOptions(options) {\n\t // Parse preset names\n\t var presets = (options.presets || []).map(function (presetName) {\n\t if (typeof presetName === 'string') {\n\t var preset = availablePresets[presetName];\n\t if (!preset) {\n\t throw new Error('Invalid preset specified in Babel options: \"' + presetName + '\"');\n\t }\n\t return preset;\n\t } else {\n\t // Could be an actual preset module\n\t return presetName;\n\t }\n\t });\n\n\t // Parse plugin names\n\t var plugins = (options.plugins || []).map(function (pluginName) {\n\t if (typeof pluginName === 'string') {\n\t var plugin = availablePlugins[pluginName];\n\t if (!plugin) {\n\t throw new Error('Invalid plugin specified in Babel options: \"' + pluginName + '\"');\n\t }\n\t return plugin;\n\t } else {\n\t // Could be an actual plugin module\n\t return pluginName;\n\t }\n\t });\n\n\t return _extends({}, options, {\n\t presets: presets,\n\t plugins: plugins\n\t });\n\t}", "function processOptions(options) {\n\t // Parse preset names\n\t var presets = (options.presets || []).map(function (presetName) {\n\t if (typeof presetName === 'string') {\n\t var preset = availablePresets[presetName];\n\t if (!preset) {\n\t throw new Error('Invalid preset specified in Babel options: \"' + presetName + '\"');\n\t }\n\t return preset;\n\t } else {\n\t // Could be an actual preset module\n\t return presetName;\n\t }\n\t });\n\n\t // Parse plugin names\n\t var plugins = (options.plugins || []).map(function (pluginName) {\n\t if (typeof pluginName === 'string') {\n\t var plugin = availablePlugins[pluginName];\n\t if (!plugin) {\n\t throw new Error('Invalid plugin specified in Babel options: \"' + pluginName + '\"');\n\t }\n\t return plugin;\n\t } else {\n\t // Could be an actual plugin module\n\t return pluginName;\n\t }\n\t });\n\n\t return _extends({}, options, {\n\t presets: presets,\n\t plugins: plugins\n\t });\n\t}", "function Plugin(element, options) {\n this.element = element;\n this.settings = $.extend({}, defaults, options);\n this._defaults = defaults;\n this._name = pluginName;\n this.init();\n }", "function Plugin(element, options) {\n this.element = element;\n this.settings = $.extend({}, defaults, options);\n this._defaults = defaults;\n this._name = pluginName;\n this.init();\n }", "addPlugin(pluginName, implementation) {\n this.loaderPlugins[pluginName] = implementation;\n }", "function Plugin( element, options ) {\n this.element = element;\n\n this.options = $.extend( {}, defaults, options );\n\n this._defaults = defaults;\n this._name = pluginName;\n\n this.init();\n }", "addPlugin(config, options) {\n this.plugins.push(plugin(config, options, this))\n return this\n }", "function Plugin( element, options ) {\n \n this.element = element;\n\n // jQuery has an extend method that merges the\n // contents of two or more objects, storing the\n // result in the first object. The first object\n // is generally empty because we don't want to alter\n // the default options for future instances of the plugin\n this.options = $.extend( {}, defaults, options) ;\n\n this._defaults = defaults;\n this._name = pluginName;\n\n this.init();\n }", "function Plugin ( element, options ) {\n\t\t\t\tthis.element = element;\n\t\t\t\t// jQuery has an extend method which merges the contents of two or\n\t\t\t\t// more objects, storing the result in the first object. The first object\n\t\t\t\t// is generally empty as we don't want to alter the default options for\n\t\t\t\t// future instances of the plugin\n\t\t\t\tthis.options = $.extend( {}, defaults, options );\n\t\t\t\tthis._defaults = defaults;\n\t\t\t\tthis._name = pluginName;\n\t\t\t\tthis.init();\n\t\t}", "function Plugin(element, options) {\n this.element = element;\n\n this.options = $.extend({}, defaults, options);\n\n this._defaults = defaults;\n this._name = pluginName;\n\n this.init();\n }", "function Plugin( element, options ) {\n\t\tthis.element = $(element);\n\n\t\tthis.options = $.extend( {}, defaults, options) ;\n\n\t\tthis._defaults = defaults;\n\t\tthis._name = pluginName;\n\n\t\tthis.init();\n\t}", "function Plugin(element, options) {\n this.element = element;\n this.$element = $(element);\n this.options = $.extend({}, defaults, options);\n this._defaults = defaults;\n this._name = pluginName;\n this.dataTemple = dataTemple;\n this.init();\n }", "function Plugin(element, options) {\n this.element = element;\n\n this.settings = $.extend({}, defaults, options);\n this._defaults = defaults;\n this._name = pluginName;\n this.init();\n }", "function Plugin(element, options) {\n this.element = element;\n\n this.settings = $.extend({}, defaults, options);\n this._defaults = defaults;\n this._name = pluginName;\n this.init();\n }", "function Plugin( element, options ) {\n this.$element = $(element);\n\n // jQuery has an extend method that merges the \n // contents of two or more objects, storing the \n // result in the first object. The first object \n // is generally empty because we don't want to alter \n // the default options for future instances of the plugin\n this.options = $.extend( {}, defaults, options);\n\n settings = $.extend( {}, defaults, options);\n \n this._defaults = defaults;\n this._name = camera;\n\n this.init();\n }", "function Plugin(element, options) {\r\n this.element = element;\r\n\r\n this.settings = $.extend({}, defaults, options);\r\n this._defaults = defaults;\r\n this._name = pluginName;\r\n this._projectProcess = null;\r\n this.init();\r\n }", "function Plugin(element, options) {\r\n this.element = element;\r\n\r\n this.settings = $.extend({}, defaults, options);\r\n this._defaults = defaults;\r\n this._name = pluginName;\r\n this.init();\r\n }", "function Plugin(element, options) {\r\n this.element = element;\r\n\r\n this.settings = $.extend({}, defaults, options);\r\n this._defaults = defaults;\r\n this._name = pluginName;\r\n this.init();\r\n }", "function Plugin ( element, options ) {\n\t\t\t\tthis.element = element;\n\t\t\t\t// jQuery has an extend method which merges the contents of two or\n\t\t\t\t// more objects, storing the result in the first object. The first object\n\t\t\t\t// is generally empty as we don't want to alter the default options for\n\t\t\t\t// future instances of the plugin\n\t\t\t\tthis.settings = $.extend( {}, defaults, options );\n\t\t\t\tthis._defaults = defaults;\n\t\t\t\tthis._name = pluginName;\n\t\t\t\tthis.init();\n\t\t}", "function Plugin ( element, options ) {\n\t\t\t\tthis.element = element;\n\t\t\t\t// jQuery has an extend method which merges the contents of two or\n\t\t\t\t// more objects, storing the result in the first object. The first object\n\t\t\t\t// is generally empty as we don't want to alter the default options for\n\t\t\t\t// future instances of the plugin\n\t\t\t\tthis.settings = $.extend( {}, defaults, options );\n\t\t\t\tthis._defaults = defaults;\n\t\t\t\tthis._name = pluginName;\n\t\t\t\tthis.init();\n\t\t}", "function Plugin ( element, options ) {\n\t\t\t\tthis.element = element;\n\t\t\t\t// jQuery has an extend method which merges the contents of two or\n\t\t\t\t// more objects, storing the result in the first object. The first object\n\t\t\t\t// is generally empty as we don't want to alter the default options for\n\t\t\t\t// future instances of the plugin\n\t\t\t\tthis.settings = $.extend( {}, defaults, options );\n\t\t\t\tthis._defaults = defaults;\n\t\t\t\tthis._name = pluginName;\n\t\t\t\tthis.init();\n\t\t}", "function Plugin ( element, options ) {\n\t\t\t\tthis.element = element;\n\t\t\t\t// jQuery has an extend method which merges the contents of two or\n\t\t\t\t// more objects, storing the result in the first object. The first object\n\t\t\t\t// is generally empty as we don't want to alter the default options for\n\t\t\t\t// future instances of the plugin\n\t\t\t\tthis.settings = $.extend( {}, defaults, options );\n\t\t\t\tthis._defaults = defaults;\n\t\t\t\tthis._name = pluginName;\n\t\t\t\tthis.init();\n\t\t}", "function Plugin ( element, options ) {\n this.element = element;\n this.settings = $.extend( {}, defaults, options );\n this._defaults = defaults;\n this._name = pluginName; \n this.init(this.settings.first_image, this.settings.first_section);\n }", "addPlugins() {\n const pm = PluginManager.getInstance();\n pm.addPlugin(new ElectronPlugin());\n }", "function Plugin( element, options, callback ) {\r\n $self = this;\r\n $self.element = element;\r\n\r\n $self.options = $.extend( {}, defaults, options) ;\r\n $self._name = pluginName;\r\n $self.callback = callback;\r\n $self.selectedElement = {};\r\n\r\n $self.init();\r\n }", "function Plugin ( element, options ) {\n this.element = element;\n // jQuery has an extend method which merges the contents of two or\n // more objects, storing the result in the first object. The first object\n // is generally empty as we don't want to alter the default options for\n // future instances of the plugin\n this.settings = $.extend( {}, defaults, options );\n this._defaults = defaults;\n this._name = pluginName;\n this.init();\n\n }", "function Plugin( element, options ) {\n this.element = element;\n\n // jQuery has an extend method which merges the contents of two or\n // more objects, storing the result in the first object. The first object\n // is generally empty as we don't want to alter the default options for\n // future instances of the plugin\n this.options = $.extend( {}, defaults, options) ;\n\n this._defaults = defaults;\n this._name = pluginName;\n\n this.init();\n }", "function Plugin(element, options) {\n this.element = $(element);\n this.settings = $.extend({}, defaults, options);\n this._defaults = defaults;\n this._name = pluginName;\n this._init();\n }", "function prePluginInit() {\n // Default options for the plug-in \n // Those can be pre defined or overridden in any of the following:\n // query string parameters in the script reference\n // hash tag parameters in the browser URL box\n // as the options parameter in the plug-in construction call\n // as meta tags in the enhanced element\n window.MI_defaults = {\n optimizeNames: true,\n useLinkTarget: false,\n useLinkTitle: false,\n mi_style: 'default',\n abtest: 'false',\n debug: 'false',\n tabs: ['mentions', 'photos', 'stats'],\n frameElements: ['statsPreview', 'mediaPreview', 'tags', 'shareLinks'],\n ex: [],\n includedSourceIds: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103],\n widgetTextPosition: 'bottom',\n hidden: 'false',\n xOffset: 0,\n yOffset: 0,\n gaugeOrientation: 'left',\n vertical: 'all',\n inqa: false,\n RTL: false,\n lang: \"EN\",\n displayText: false,\n layout: 'inlinepanel',\n columnscount:2,\n allowExternalLinks: 'true',\n displayExternalLinksInline: 'true',\n collapseLines: 'true',\n displayShowMore: 'true',\n loadWhenInvisible: 'false',\n hover: false,\n doClientSide: false,\n template: 'RASTA',\n tabsType: \"TABS\",\n starsType: \"SMALL\",\n animationStyle: \"DEFAULT\",\n logo: \"//d34p6saz4aff9q.cloudfront.net/images/feelterfooter.png\",\n buttonType: \"DEFAULT\",\n lightbox: true\n\n };\n window.tempDictionary = window.tempDictionary ? window.tempDictionary : {\n socialItem: function(data, baseid) {\n var click = data.click;\n var si = data.modsi ? data.modsi : window.tempDictionary[window.MI_defaults.template].socialItem.normalItem.replace(\"@@@metaicon\", data.metaicon).replace(\"@@@cond\", (data.sourceURL == '' || window.MI_defaults.allowExternalLinks == 'false' ? 'style=\"cursor:default;direction:ltr!important;\"' : ' style=\"direction:ltr!important;\" onclick=\"' + click + '\"'))\n var item = window.tempDictionary[window.MI_defaults.template].socialItem.nonTimelineItem.replace(/@@@itemImageURL/g, data.itemImageURL);\n si = si.replace(\"@@@item\", item)\n\n si = si.replace(/@@@itemImageURL/g, data.itemImageURL)\n si = si.replace(/@@@itempublisher/g, (data.itemPublisher.length > 18 ? data.itemPublisher.substring(0, 17) + '...' : data.itemPublisher))\n si = si.replace(/@@@timeago/g, data.timeAgo)\n si = si.replace(/@@@itemDate/g, data.itemDate)\n si = si.replace(/@@@sourceURL/g, data.sourceURL != 'undefined' ? \"\" : data.sourceURL.replace('http://www.youtube.com/', ''))\n si = si.replace(/@@@sourceAvatar/g, item).replace(/@@@itemtext/g, data.moditemText)\n si = si.replace(/@@@itemWidth/g, (typeof data.itemTimeLine != 'undefined' ? '250' : '275') + 'px')\n si = si.replace(/@@@sourceSite/g, (data.source.replace('.com', '').replace('www.', '').replace('.', '').replace('.', '')).trim())\n if (data.regarding) si = si.replace('</th>', '<span style=\"position: inherit;margin-right: 3px;color: #ccc;\">On</span>' + data.regarding.capitalize() + '</th>');\n if (window.MI_defaults.lang != 'EN')\n si += '<div class=\"mi_translate\" onclick=\"window.MI_logUsage(\\'translate_clicked\\',\\'' + baseid + '\\',\\'' + window.MI_defaults.lang + '\\');jQuery.MidasInsight.translate(\\'' + data.ksid + '\\');event.stopPropagation();\" style=\"color: #49b7e6;font-size:12px;height:24px;float:left;\">' + window.langDictionary[window.MI_defaults.lang].translate + '</div>';\n if (data.itemContentImageURL && data.itemContentImageURL.indexOf('/') == -1) data.itemContentImageURL = '';\n if (data.itemContentImageURL && data.itemContentImageURL.indexOf('//') < 0) data.itemContentImageURL = '//' + data.itemContentImageURL;\n if (data.itemContentImageURL && data.itemContentImageURL.indexOf('.') > -1) {\n if (!jQuery.MidasInsight.ObjDictionary[baseid].gallery) jQuery.MidasInsight.ObjDictionary[baseid].gallery = [{\n href: '//d34p6saz4aff9q.cloudfront.net/img/feelter.png'\n }];\n //jQuery.MidasInsight.ObjDictionary[baseid].gallery.push({ href: data.itemContentImageURL, title: data.itemPublisher })\n //data.galleryindex = jQuery.MidasInsight.ObjDictionary[baseid].gallery.length - 1;\n //if (window.MI_defaults.lightbox == true && !(data.source.indexOf(\"facebook\") > -1)) {\n si += window.tempDictionary[window.MI_defaults.template].socialItem.lightboxContentImage.replace(/@@@itemcontentimage/g, data.itemContentImageURL).replace(/@@@ksid/g, data.ksid).replace(/@@@kfid/g, baseid);\n\n //} else {\n // si += window.tempDictionary[window.MI_defaults.template].socialItem.itemContentImage.replace(\"@@@itemcontentimage\", data.itemContentImageURL);\n\n //}\n }\n si += '</td></tr></table>'\n si += '</div>';\n si = si.replace(/@@@click/g, '');\n\n data.modsi = si;\n },\n socialItemneweggItem: function(data, baseid) {\n data.moditemText = data.moditemText.replace(/Pros:/g, '<span style=\"font-weight:bold\">Pros:</span>').replace(/Cons:/g, '<span style=\"font-weight:bold\">Cons:</span>').replace(/Other Thoughts:/g, '<span style=\"font-weight:bold\">Other Thoughts:</span>')\n window.tempDictionary.socialItem(data, baseid);\n },\n socialItemShowInPhotosTab: function(data, baseid) {\n data.click = ' ';\n window.tempDictionary.socialItem(data, baseid);\n },\n socialItemflickrItem: function(data, baseid) {\n window.tempDictionary.socialItemShowInPhotosTab(data, baseid);\n },\n socialIteminstagramItem: function(data, baseid) {\n data.click = ' ';\n data.modsi = window.tempDictionary[window.MI_defaults.template].socialItem.instagramItem.replace(\"@@@metaicon\", data.metaicon).replace(\"@@@cond\", (data.sourceURL == '' || window.MI_defaults.allowExternalLinks == 'false' ? 'style=\"cursor:default;direction:ltr!important;\"' : ' style=\"direction:ltr!important;\" onclick=\"' + data.click + '\"'))\n window.tempDictionary.socialItem(data, baseid);\n },\n socialItempinterestItem: function(data, baseid) {\n window.tempDictionary.socialItemShowInPhotosTab(data, baseid);\n },\n socialItemyoutubeItem: function(data, baseid) {\n //if (!jQuery.MidasInsight.ObjDictionary[baseid].gallery) jQuery.MidasInsight.ObjDictionary[baseid].gallery = [];\n var vurl = data.sourceURL.replace('http://www.youtube.com/', '//www.youtube.com/watch?v=');\n jQuery.MidasInsight.AddtoGallery(baseid, {\n href: vurl,\n title: data.itemPublisher\n });\n //jQuery.MidasInsight.ObjDictionary[baseid].gallery.push({ href: data.sourceURL.replace('http://www.youtube.com/', '//www.youtube.com/watch?v='), title: data.itemPublisher })\n var click = \"window.MI_logUsage('play_video','\" + baseid + \"','youtube'); jQuery.MidasInsight.ShowLightBoxURL('\" + vurl + \"','\" + baseid + \"')\";\n var item = window.tempDictionary[window.MI_defaults.template].socialItem.nonTimelineItem;\n item = item.replace(/@@@itemImageURL/g, data.itemImageURL)\n var si = window.tempDictionary[window.MI_defaults.template].socialItem.lightboxYoutubeItem\n .replace(/@@@youtubeid/g, data.sourceURL.split('/')[data.sourceURL.split('/').length - 1]);\n data.modsi = si.replace(/@@@itemDate/g, data.itemDate)\n .replace(/@@@click/g, click)\n .replace(/@@@itemImageURL/g, data.itemImageURL)\n .replace(/@@@itemPublisher/g, (data.itemPublisher.length > 18 ? data.itemPublisher.substring(0, 17) + '...' : data.itemPublisher))\n .replace(/@@@ksid/g, data.ksid)\n .replace(/@@@timeAgo/g, data.timeAgo)\n .replace(/@@@sourceURL/g, data.sourceURL.replace('http://www.youtube.com/', ''))\n .replace(/@@@sourceAvatar/g, item)\n .replace(/@@@itemText/g, data.moditemText)\n .replace(/@@@itemWidth/g, (typeof data.itemTimeLine != 'undefined' ? '250' : '275') + 'px')\n .replace(/@@@sourceSite/g, (data.source.replace('.com', '').replace('www.', '').replace('.', '').replace('.', '')).trim())\n },\n socialItemvimeoItem: function(data, baseid) {\n //debugger;\n //if (!jQuery.MidasInsight.ObjDictionary[baseid].gallery) jQuery.MidasInsight.ObjDictionary[baseid].gallery = [];\n var vurl = data.sourceURL;\n jQuery.MidasInsight.AddtoGallery(baseid, {\n href: vurl,\n title: data.itemPublisher\n });\n\n //jQuery.MidasInsight.ObjDictionary[baseid].gallery.push({\n // href: data.sourceURL//.replace('vimeo.com/', 'player.vimeo.com/video/')\n // , title: data.itemPublisher\n //})\n var click = \"window.MI_logUsage('play_video','\" + baseid + \"','vimeo'); jQuery.MidasInsight.ShowLightBoxURL('\" + vurl + \"','\" + baseid + \"')\";\n var item = window.tempDictionary[window.MI_defaults.template].socialItem.nonTimelineItem;\n item = item.replace(/@@@itemImageURL/g, data.itemImageURL)\n var si = window.tempDictionary[window.MI_defaults.template].socialItem.lightboxVimeoItem;\n data.modsi = si.replace(/@@@itemDate/g, data.itemDate)\n .replace(/@@@click/g, click)\n .replace(/@@@itemImageURL/g, data.itemImageURL)\n .replace(/@@@itemPublisher/g, (data.itemPublisher.length > 18 ? data.itemPublisher.substring(0, 17) + '...' : data.itemPublisher))\n .replace(/@@@ksid/g, data.ksid)\n .replace(/@@@timeAgo/g, data.timeAgo)\n .replace(/@@@sourceURL/g, data.sourceURL.replace('vimeo.com/', 'player.vimeo.com/video/'))\n .replace(/@@@sourceAvatar/g, item)\n .replace(/@@@itemContentImageURL/g, data.itemContentImageURL)\n .replace(/@@@itemText/g, data.moditemText)\n .replace(/@@@itemWidth/g, (typeof data.itemTimeLine != 'undefined' ? '250' : '275') + 'px')\n .replace(/@@@sourceSite/g, (data.source.replace('.com', '').replace('www.', '').replace('.', '').replace('.', '')).trim())\n\n },\n DEFAULT: {\n panelLayout: {\n header: [\"tabs\"],\n content: [\"stars\", \"photos\", \"tags\", \"mentions\"],\n footer: [\"share\"]\n },\n panel: {\n videoholder: '<div id=\"mi_videoholder_@@@baseid\" class=\"mi_singlevideocontainer mi_closeTopLeft\" onclick=\"jQuery.MidasInsight.MI_GetPhotos(\\'@@@baseid\\',false)\"><div class=\"mi_singlevideo\"></div></div>',\n containerHtml: '<div style=\"padding:5px;\" class=\"mi_panelBackground mikfpanel\" id=\"cpcnt_@@@kfid\" style=\"direction: ltr;@@@layout\"></div>',\n tabs: '<tr><td><div class=\"MI_tabs@@@orientation\" style=\"margin-left:-3px!important;display:inline-block;width:100%;padding-top:10px;\">@@@tabs</div></td></tr>',\n gauge: '<div class=\"mi_gradeselectgradbg\"></div><div class=\"mi_gradeselectmasknerrow' + (window.MI_defaults.RTL == 'true' ? ' mi_gradeselectmasknerrow_right' : '') + '\"></div><div class=\"mi_gradeselecthandlenerrow\"></div><div class=\"mi_gradeselectdigitsnerrow\" ' + (window.MI_defaults.RTL == 'true' ? 'style=\"direction:ltr!important;\"' : 'style=\"direction:ltr;\"') + '><span style=\"font-size: 48px;z-index: 3;color: #92c83e;font-family: \\'Source Sans Pro\\', Alef!important;\"></span><span class=\"mi_gradeselectdigitsnerrow_after\">/ 100</span></div><div class=\"mi_gradeselecttext\"></div>',\n tag: '<span onclick=\"jQuery.MidasInsight.tagClicked(\\'@@@kfid\\',\\'@@@atags\\')\" class=\\'mi_tag_@@@atagsreplace mi_tag\\'>@@@atagscap <span style=\"display:;color:@@@color;-webkit-font-smoothing: antialiased;padding: 0;margin-bottom: 0;margin-left: 0;margin-top: 3px;text-shadow: @@@color 0 0 0.3px,1px 1px 1px white;background-color: transparent;line-height: 10px;nobox-shadow:inset 1px 1px 2px -1px lightslategray;padding: 0px 2px 1px 3px;border-radius: 50%;left: 4px;position: relative;\">&#9733;</span></span>',\n slidercontainer: '<div id=\"mi_previewPhotosContainer_@@@kfid\" style=\"max-width: 465px;cursor:default;-moz-user-select:none;-webkit-user-select:none; -ms-user-select:none; user-select:none;\" unselectable=\"on\" onselectstart=\"return false;\"><table class=\"mi_previewPhotosContainer\" style=\"\" cellspacing=\"0\" onclick=\"jQuery.MidasInsight.MI_GetPhotos(\\'@@@kfid\\',false)\"><tr>',\n photopreview: '<tr ><td id=\"mi_photopreview_@@@kfid\" colspan=\"2\" style=\"width:100%;overflow:hidden;background-color:white;padding:5px 0 !important;border-bottom: 1px solid #DBDBDB !important;\"><div class=\"mi_thumbscontainer\">',\n tabswrapper: {\n header: '<div style=\"width: 152px;margin: 0 auto;background: #fefefe; /* Old browsers */background: -moz-linear-gradient(top, #fefefe 0%, #eeeeee 100%); /* FF3.6+ */background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fefefe), color-stop(100%,#eeeeee)); /* Chrome,Safari4+ */background: -webkit-linear-gradient(top, #fefefe 0%,#eeeeee 100%); /* Chrome10+,Safari5.1+ */background: -o-linear-gradient(top, #fefefe 0%,#eeeeee 100%); /* Opera 11.10+ */background: -ms-linear-gradient(top, #fefefe 0%,#eeeeee 100%); /* IE10+ */background: linear-gradient(to bottom, #fefefe 0%,#eeeeee 100%); /* W3C */filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\\'#fefefe\\', endColorstr=\\'#eeeeee\\',GradientType=0 ); /* IE6-9 */-webkit-border-radius: 15px;-moz-border-radius: 15px;border-radius: 15px;border: 1px solid #cbcbcb;padding: 5px;\">',\n footer: '</div>'\n },\n starspanel: {\n header: '<tr><td><div class=\"mi_hover_starspanel\" style=\"border-bottom: 1px solid #dfdfdf !important;padding-bottom:5px;width:100%;overflow:hidden;border-top:1px solid #dfdfdf;padding-top:5px;background: #f7f7f7; /* Old browsers */background: -moz-linear-gradient(top, #f7f7f7 0%, #ffffff 100%); /* FF3.6+ */background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f7f7f7), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */background: -webkit-linear-gradient(top, #f7f7f7 0%,#ffffff 100%); /* Chrome10+,Safari5.1+ */background: -o-linear-gradient(top, #f7f7f7 0%,#ffffff 100%); /* Opera 11.10+ */background: -ms-linear-gradient(top, #f7f7f7 0%,#ffffff 100%); /* IE10+ */background: linear-gradient(to bottom, #f7f7f7 0%,#ffffff 100%); /* W3C */filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\\'#f7f7f7\\', endColorstr=\\'#ffffff\\',GradientType=0 ); /* IE6-9 */width: 396px;left: 0px;position: relative;\"><table style=\"position:relative\">',\n footer: '</tr></table></div></td></tr>'\n },\n footer: {\n header: '<div class=\"mi_footerwrapper\"><div class=\"mi_footerroot mi_footerroot_@@@kfid\" style=\"background-image: url(//d34p6saz4aff9q.cloudfront.net/images/footer/feelterfooternew.png);background-position: -120px 0px;background-repeat: no-repeat;\"><div class=\"mi_footercontainer\" id=\"mi_footercontainer_@@@kfid\" style=\"height:100%;position:static;\">' +\n '<div class=\"mi_footer\" style=\"height:auto;\"><div onclick=\"jQuery(\\'#cpcnt_@@@kfid\\').find(\\'.MI_tab_selected\\').removeClass(\\'MI_tab_selected\\');jQuery(\\'#mipct_scroll_@@@kfid\\').addClass(\\'mi_blured\\');jQuery(\\'#mipct_tblabout_@@@kfid\\').css(\\'max-height\\',jQuery(\\'#mipct_scroll_@@@kfid\\').height()+1).css(\\'height\\',jQuery(\\'#mipct_scroll_@@@kfid\\').height()+1).css(\\'top\\',jQuery(\\'#mipct_scroll_@@@kfid\\').position().top).fadeIn();\" style=\"z-index: 1;position: absolute;right: 0px;top: 5px;height: 25px;width:57px;background-size: contain;cursor: pointer;background-image: url(\\'@@@logo\\');background-repeat: no-repeat;\"></div></div>',\n share: '<div style=\"width: 100%;float:left;\"><div class=\"mi_footer_prompt\" style=\"margin-bottom:0;\">@@@ask</div>' +\n '<ul class=\"mi_share-buttons\"><li><a onclick=\"window.MI_logUsage(\\'mail\\');\" href=\"mailto:?subject={1}&body={2}: {0}\" target=\"_blank\" title=\"Email\"><img onload=\"this.style.opacity=1;this.style.top=0;\" src=\"//d34p6saz4aff9q.cloudfront.net/images/footer/Email.png\" style=\"opacity:0;\" style=\"opacity:0\"></a></li><li><a onclick=\"window.MI_logUsage(\\'share\\');\" href=\"https://www.facebook.com/sharer/sharer.php?u={0}\" target=\"_blank\"><img onload=\"this.style.opacity=1;this.style.top=0;\" src=\"//d34p6saz4aff9q.cloudfront.net/images/footer/Facebook.png\" style=\"opacity:0;\"></a></li><li><a onclick=\"window.MI_logUsage(\\'share\\');\" href=\"https://twitter.com/intent/tweet?source={0}&text={1}: {0}\" target=\"_blank\" title=\"Tweet\"><img onload=\"this.style.opacity=1;this.style.top=0;\" src=\"//d34p6saz4aff9q.cloudfront.net/images/footer/Twitter.png\" style=\"opacity:0\"></a></li><li style=\"display:none;\"><a onclick=\"window.MI_logUsage(\\'share\\');\" href=\"http://pinterest.com/pin/create/button/?url={0}&description={2}\" target=\"_blank\" title=\"Pin it\"><img onload=\"this.style.opacity=1;this.style.top=0;\" src=\"//d34p6saz4aff9q.cloudfront.net/images/footer/Pinterest.png\"></a></li><li><a onclick=\"window.MI_logUsage(\\'share\\');\" href=\"https://plus.google.com/share?url={0}\" target=\"_blank\" title=\"Share on Google+\"><img onload=\"this.style.opacity=1;this.style.top=0;this.style.top=0;\" src=\"//d34p6saz4aff9q.cloudfront.net/images/footer/Googleplus.png\" style=\"opacity:0;\"></a></li></ul></div>',\n callForActions: '<div id=\"cfa\" style=\"white-space:nowrap;padding-left:0;display:inline-block;\"><div onclick=\"alert(\\'call to add to favorites\\')\" style=\"cursor:pointer;border-radius: 7px;height: 27px;width: 187px;margin:5px;MARGIN-LEFT:0;display: inline-block;text-align: center;box-shadow: inset 0 -9px 37px -10px silver;vertical-align: middle;padding-top: 8px;border: 1px solid rgba(0,0,0,0.2);color: grey;\">Add to favorites</div><div onclick=\"alert(\\'call to book\\')\" style=\"cursor:pointer;border-radius: 7px;height: 27px;width: 187px;margin:5px;display: inline-block;text-align: center;box-shadow: inset 0 -9px 37px -10px rgb(3, 179, 12);vertical-align: middle;padding-top: 8px;border: 1px solid rgba(0,0,0,0.2);color: white;margin-left: 1px;background-color: rgb(161, 218, 101);\">BOOK</div></div>'\n },\n header: {\n header: '<table align=\"left\" class=\"mi_reset mi_greenredtitle\">' +\n '<div class=\"mi_green_close @@@orientation\" onclick=\"jQuery.MidasInsight.hidePanel(\\'@@@kfid\\');\" style=\"z-index:3;\"></div>' +\n '<tr><td class=\"mi_header_caption@@@gaugeOrientation>' +\n '<div class=\"mi_drag_area\" style=\"position: absolute;width: 100%;height: 60px;left:0;z-index: 2\"></div>' +\n '<div class=\"mi_gradselectroot @@@gaugeOrientation\" id=\"mi_gradselectroot_@@@kfid\" data-score=\"@@@grade\" style=\"z-idex:1;\"><div class=\"mi_gradeselect\" id=\"mi_gradeselect_@@@kfid\"></div></div>' +\n '<div class=\"mi_title\" style=\"@@@titleOrientation\">@@@displayText</div>' +\n '<div style=\"@@@optionsrtl\" class=\"mi_subtitle\">@@@count</div></td></tr>'\n /*if (count > 4) {\n p += '<div style=\"' + (options.RTL == 'true' ? '' : '') + '\" class=\"mi_subtitle ' + (options.RTL == 'true' ? 'mi_subtitle_rtl' : '') + '\">' + window.langDictionary[window.MI_defaults.lang].basedon.replace('%d', count);\n p += '</div>';\n */\n // tools tabs\n +\n '<div style=\"clear:both;height:0px;margin-bottom:0px;border-top:0px solid #DBDBDB!important;\"></div>',\n footer: '</table>'\n }\n\n ,\n closebutton: '<div class=\"mi_green_close@@@gaugeOrientation\" onclick=\"jQuery.MidasInsight.hidePanel(\\'@@@kfid\\');\"></div>'\n }\n\n ,\n scrollables: {\n header: '<div style=\"clear:both;height: px;margin-bottom:0px;border-top:1px solid #DBDBDB\"></div><div id=\"mipct_scroll_@@@kfid\" tabindex=\"-1\" style=\"heightdummy:0;outline:none;\" class=\"mi_scroll\">' +\n '<table align=\"left\" id=\"mipct_tbldefault_@@@kfid\" class=\"mi_results mi_scrolledcontent\">',\n footer: '</table></div>'\n },\n socialItem: {\n timelineItem: '<div class=\"mi_timeline\">@@@fullYear<br/>@@@month<br/>@@@date</div>',\n nonTimelineItem: '<img onerror=\"jQuery.MidasInsight.HandleMissingImage(\\'avatar\\',this)\" src=\"@@@itemImageURL\" valign=\"top\" class=\"mi_resultimage\"/>',\n youtubeItem: '<div style=\"position:relative;\"><div class=\\\"MI_SourceIcon MI_@@@sourceSite\\\" mi_data-tooltip=\\\"@@@sourceSite\\\"></div><table align=\"left\" class=\"mi_resultcontainer\" style=\"direction:ltr!important;cursor:default;\"><tr><td rowspan=\"4\" valign=\"top\" style=\"padding-right:15px;padding-left:3px;width: 65px;\"><div style=\"position:relative;height: 100%;display: block;\">' +\n '@@@sourceAvatar' +\n '</div></td><th style=\"vertical-align: middle;\" align=\"left\"><div class=\"mi_resultpublisher\" style=\"color:#838383;\">@@@itemPublisher<span class=\"mi_resulttimeago\" itemDate=\"@@@itemDate\">@@@timeAgo' +\n '</span></div></th></tr><tr><td style=\"padding-right:30px;\"></td></tr>' +\n '<tr><td colspan=\"2\" onclick=\"@@@click\" style=\"cursor: pointer; cursor: hand;\"><div style=\"padding-right:10px;overflow:hidden;position:relative;max-width: 275px;\"><img src=\"https://i.ytimg.com/vi/@@@sourceURL/mqdefault.jpg\" style=\"max-width: @@@itemWidth ;min-width:185px;margin-top: 15px;margin-bottom: 15px;box-shadow: 0px 0 10px 4px #eee;float: right;border-radius: 5px;display:inline;\"/><img src=\"//d34p6saz4aff9q.cloudfront.net/images/playvideow.png\" style=\"position:absolute;cursor: pointer;left: 50%!important;margin-top: 20%;display:inline;margin-left: -30px;\" onclick=\"window.MI_logUsage(\\'play_video\\',\\'@@@baseid\\');@@@click\" onerror=\"this.style.display=\\'none\\';\"/></div>' +\n '</td></tr></table></div>',\n lightboxYoutubeItem: '<div style=\"position:relative;\"><div class=\\\"MI_SourceIcon MI_@@@sourceSite\\\" mi_data-tooltip=\\\"@@@sourceSite\\\"></div><table align=\"left\" class=\"mi_resultcontainer\" style=\"direction:ltr!important;cursor:default;\"><tr><td rowspan=\"4\" valign=\"top\" style=\"padding-right:15px;padding-left:3px;width: 65px;\"><div style=\"position:relative;height: 100%;display: block;\">' +\n '@@@sourceAvatar' +\n '</div></td><th style=\"vertical-align: middle;\" align=\"left\"><div class=\"mi_resultpublisher\" style=\"color:#838383;\">@@@itemPublisher<span class=\"mi_resulttimeago\" itemDate=\"@@@itemDate\">@@@timeAgo' +\n '</span></div></th></tr><tr><td style=\"padding-right:30px;\"></td></tr>' +\n '<tr><td colspan=\"2\" onclick=\"@@@click\" style=\"cursor: pointer; cursor: hand;\"><div style=\"padding-right:10px;overflow:hidden;position:relative;max-width: 275px;\"><div id=\"#mi_image_lightbox_@@@ksid\" onclick=\" jQuery(mi_image_lightbox_@@@ksid).fadeIn();\"><img src=\"https://i.ytimg.com/vi/@@@sourceURL/mqdefault.jpg\" style=\"max-width: @@@itemWidth ;min-width:185px;margin-top: 15px;margin-bottom: 15px;box-shadow: 0px 0 10px 4px #eee;float: right;border-radius: 5px;display:inline;\"/><img src=\"//d34p6saz4aff9q.cloudfront.net/images/playvideow.png\" style=\"position:absolute;cursor: pointer;left: 50%!important;margin-top: 20%;display:inline;margin-left: -30px;\" onclick=\"window.MI_logUsage(\\'play_video\\',\\'@@@baseid\\');@@@click\" onerror=\"this.style.display=\\'none\\';\"/></div><div class=\"mi_lightbox\" id=\"mi_image_lightbox_@@@ksid\" onclick=\"jQuery.MidasInsight.StopYoutubeVideo(jQuery(\\'#mi_image_lightbox_@@@ksid iframe\\')[0]);jQuery(this).fadeOut();\"><iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/@@@youtubeid?enablejsapi=1\" frameborder=\"0\" allowfullscreen></iframe></a></div>' +\n '</td></tr></table></div>',\n lightboxVimeoItem: '<div style=\"position:relative;\"><div class=\\\"MI_SourceIcon MI_@@@sourceSite\\\" mi_data-tooltip=\\\"@@@sourceSite\\\"></div><table align=\"left\" class=\"mi_resultcontainer\" style=\"direction:ltr!important;cursor:default;\"><tr><td rowspan=\"4\" valign=\"top\" style=\"padding-right:15px;padding-left:3px;width: 65px;\"><div style=\"position:relative;height: 100%;display: block;\">' +\n '@@@sourceAvatar' +\n '</div></td><th style=\"vertical-align: middle;\" align=\"left\"><div class=\"mi_resultpublisher\" style=\"color:#838383;\">@@@itemPublisher<span class=\"mi_resulttimeago\" itemDate=\"@@@itemDate\">@@@timeAgo' +\n '</span></div></th></tr><tr><td style=\"padding-right:30px;\"></td></tr>' +\n '<tr><td colspan=\"2\" onclick=\"@@@click\" style=\"cursor: pointer; cursor: hand;\"><div style=\"padding-right:10px;overflow:hidden;position:relative;max-width: 275px;\"><div id=\"#mi_image_lightbox_@@@ksid\" onclick=\" jQuery(mi_image_lightbox_@@@ksid).fadeIn();jQuery(\\'#mi_iframe_lightbox_@@@ksid\\').attr(\\'src\\',jQuery(\\'#mi_iframe_lightbox_@@@ksid\\').attr(\\'data-src\\'));\"><img src=\"@@@itemContentImageURL\" style=\"max-width: @@@itemWidth ;min-width:185px;margin-top: 15px;margin-bottom: 15px;nbox-shadow: 0px 0 10px 4px #eee;float: right!important;border-radius: 2px;display:inline;\"/><img src=\"//d34p6saz4aff9q.cloudfront.net/images/playvideow.png\" style=\"position:absolute;cursor: pointer;left: 50%!important;margin-top: 20%;display:inline;margin-left: -30px;\" nonclick=\"window.MI_logUsage(\\'play_video\\',\\'@@@baseid\\');@@@click\" onerror=\"this.style.display=\\'none\\';\"/></div><div class=\"mi_lightbox\" id=\"mi_image_lightbox_@@@ksid\" onclick=\"jQuery(\\'#mi_iframe_lightbox_@@@ksid\\').attr(\\'src\\',\\'\\');jQuery(this).fadeOut();\"><iframe id=\"mi_iframe_lightbox_@@@ksid\" data-src=\"@@@sourceURL?autoplay=1&title=0&byline=0&portrait=0\" width=\"500\" height=\"281\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></a></div>' +\n '</td></tr></table></div>',\n normalItem: '<div style=\"position:relative;\">@@@metaicon<table align=\"left\" class=\"mi_resultcontainer\" @@@cond onclick=\"@@@click\"><tr><td rowspan=\"4\" valign=\"top\" style=\"padding-right:15px;padding-left:3px;width: 65px;\"><div style=\"position:relative;height: 100%;display:block;\">' +\n '@@@item' +\n '</div></td><th style=\"vertical-align: middle;\" align=\"left\"><div class=\"mi_resultpublisher\" style=\"color:#838383;\">@@@itempublisher<span class=\"mi_resulttimeago\" itemDate=\"@@@itemDate\">@@@timeago' +\n '</span></div></th></tr><tr><td style=\"padding-right:30px;\"><div class=\"mi_resulttext\">@@@itemtext</div>',\n instagramItem: '<div style=\"position:relative;\">@@@metaicon<table align=\"left\" class=\"mi_resultcontainer\" @@@cond onclick=\"@@@click\"><tr><td rowspan=\"4\" valign=\"top\" style=\"padding-right:15px;padding-left:3px;width: 65px;\"><div style=\"position:relative;height: 100%;display:block;\">' +\n '@@@item' +\n '</div></td><th style=\"vertical-align: middle;\" align=\"left\"><div class=\"mi_resultpublisher\" style=\"color:#838383;\">@@@itempublisher<span class=\"mi_resulttimeago\" itemDate=\"@@@itemDate\">@@@timeago' +\n '</span></div></th></tr><tr><td style=\"padding-right:30px;\">'\n\n ,\n itemContentImage: '</td></tr><tr><td colspan=\"2\"><div style=\"padding-right:10px;overflow:hidden;\"><img onload=\"if (!jQuery.MidasInsight.imageIsGood(this)) jQuery.MidasInsight.HandleMissingImage(\\'preview\\',this);\" onerror=\"jQuery.MidasInsight.HandleMissingImage(\\'preview\\',this);\" src=\"@@@itemcontentimage\" style=\"max-width: 275px;margin-top: 0px;margin-bottom: 15px;box-shadow: 0px 0 10px 4px #eee;float: right;border-radius: 5px;\"/></div>',\n lightboxContentImage: '</td></tr><tr><td colspan=\"2\"><div style=\"padding-right:10px;overflow:hidden;\"><div id=\"#mi_image_lightbox_@@@ksid\" onclick=\" jQuery(mi_image_lightbox_@@@ksid).fadeIn();\"><img src=\"@@@itemcontentimage\" style=\"max-width: 275px;margin-top: 0px;margin-bottom: 15px;box-shadow: 0px 0 10px 4px #eee;float: right;border-radius: 5px;\"></div><div class=\"mi_lightbox\" id=\"mi_image_lightbox_@@@ksid\" onclick=\"jQuery(this).fadeOut();\"><img src=\"@@@itemcontentimage\" style=\"box-shadow: 0px 0 10px 4px #eee;border-radius: 5px;\" onload=\"jQuery(this).css(\\'position\\', \\'relative\\').css(\\'top\\',\\'50%\\').css(\\'margin-top\\',((this.height/2)*-1)+ \\'px\\').css(\\'top\\',\\'50%\\',\\'!important\\');\"/></div></div>'\n\n }\n },\n MODERN: {\n panelLayout: {\n header: [\"tabs\", \"stars\"],\n content: [\"tags\", \"mentions\"],\n footer: [\"photos\", \"callForActions\", \"share\"]\n },\n panel: {\n videoholder: '<div id=\"mi_videoholder_@@@baseid\" class=\"mi_singlevideocontainer mi_closeTopLeft\" onclick=\"jQuery.MidasInsight.MI_GetPhotos(\\'@@@baseid\\',false)\" style=\"margin-top: 74px;background-position: 10px 18px;\"><div class=\"mi_singlevideo\"></div></div>',\n containerHtml: '<div style=\"padding:5px;margin-top:25px;border: 1px solid #ccc !important;\" class=\"mi_panelBackground mikfpanel\" id=\"cpcnt_@@@kfid\" style=\"direction: ltr;margin-top: 20px;@@@layout\"></div>',\n tabs: '<tr><td><div class=\"MI_tabs@@@orientation\" style=\"margin-left:-10px !important;position:relative;z-index:30;box-shadow:none;left:0px;padding-top: 0 !important;\">@@@tabs</div></td></tr>',\n gauge: '<div class=\"mi_gradeselectgradbg\"></div><div class=\"mi_gradeselectmasknerrow' + (window.MI_defaults.RTL == 'true' ? ' mi_gradeselectmasknerrow_right' : '') + '\" style=\"background-image:url(\\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHIAAABQCAYAAADFuSFAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA25pVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NTc3MiwgMjAxNC8wMS8xMy0xOTo0NDowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoyODYzNTRkZS04NWY4LTg3NDEtYjNmOS02OGU4NGQzZjVjODkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OTM0QjUyMzEwQ0ZBMTFFNTlCQjg4NzExODFEM0Q0M0QiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OTM0QjUyMzAwQ0ZBMTFFNTlCQjg4NzExODFEM0Q0M0QiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6RDVFOTA3RTFFN0Y4MTFFNDkzNjJGQzdDNUEyRDA1MTYiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6RDVFOTA3RTJFN0Y4MTFFNDkzNjJGQzdDNUEyRDA1MTYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5NfkuaAAAX1klEQVR42uxdCZQdVZm+99by9u7Xr1+n926ykOASgQODS5gJijIGJQxbOM4IIosKKgoHZw7icubMAcHjuI3jCHJkNI4LGcEIKuoIozKj4uAIkTBEliyd3ve313bn++tVvby8vNd53R00CXVPbqrqVdWtW/93v3+5SzWXUrIgHfuJb9u2bUk3UgMIhUIsFosx27aZoigsn8+ztrY21t7ezvbu3csikYj7e7FYdO+JRqNM13U2OzvLUqkUE0Iwx3GYqqruNpPJuFsqo1JBzt3fDMNgiUSCzc/Pu+VS+T09PfT88NDQUE9ra2tnOBweRJn9uGcFbm1HDqOeKo5t7JvIczieQN6POu+ZmZnZj3qMo05Te/bscetNdaE60jvRs6mO1e9M9bAsy30XOucTga4tFAru/ZRzuRwzTdP9vaWlhWWzWfe9qN6opys3kg29G+Xp6Wk2OTnpXr+UpI6NjS3pRno4CZQqSS9NlSchU6KKTkxMuIKnytILUiIhEPhUabqeztG9mqa55UGwFWD9RMKia6iR0D41AgiyG8c9AD4NQZ6M3AehpXC+G2V2IrdhvxW3h5AVnHewtbDNovwZlDeOMkaxP4G6TaKh7YCg96Lek7juOQjZKZVKbv0oVzcoapQEEAHoA0HnKFNDpHehhkCyoPel3+m6ubm5yrtTI6D7/Pvp/ej30dHRSlmLBtKv6KKp7FXQb5W09Y+rz/nZB6U2+/f65/2t39Jpi/KiAHc9Dl+LxnEGGtDa9evXnwChtUE4YtWqVYeUWyMQApNeNATBtSOvIQFS2dTICBwwOguARsGknbjv97j25yjnSVwz4pflM7S6/Ebnaq+r/b1aLtXyWzKQR5OepxfyWyheJo58OgC8CHlDOp0eBIApUkmkCah1L/WlqxNpDa/RxMHSNQB1DcDcDICvx/4E8mOo0w9wzU8IVLr2aPQrjhogCUAiOlrmyVBNmwDehfF4/HQSNIFH6mip2qMZ7UKJ1CJleiYBC/UaB6groSYvhSofg6r8d/z+IPKvAOZsAGQNC4mBSG+Bs/E2qLhzkdvI9r6Y4DWTiPWUyTEDqJ0A9b2w0dfB3v0c7N2GxncvLpt4SQPpMRAEFOdBWO8BcH8Bry5Knp1vK46m5IOaTCY52LkRzslGAHotWPp11PVOvMfMSwpIzwbi3flrYOs+AgA3gYkcAvqTsq/ZRE4JVL6bAegrpqamPgGWXgWG3o53uw8aZua4BbI6FgR4L+vu7r5xxYoVlwNAnQCsDjeOpUSqnzJU7xoAejdAfAfe8xNoqD/8YztEfxQJel4ox0u/H6rzxo6OjkGyOxRvLcO6MgoPORdjUvK845jcKY0rQqhPKuHO79e8m4Nrw6X8c1sY07vVUJetKOT1Ulhi9yE6WZYm9z1pvNufj4+PnwaG3osCbwGYw8cNkB6IrxwcHLwVDNwMEH2vcNFOEXhdcGxzhDvGDqnEfmUWRwt6OHU/UyLTjm0xszDCVTVSBJBmnZqwUu6Ff2Y8qjElJYWgvgKLFwoTl4RCXSkmi+uB9gZVDSepVwgNZNEql94LjTU6OTl5BfKG4eHhj+DUvccskNW9ID09PZfBntwOddpDjgy594sC0LH2AcVfAsAnpZ3dAdB+zsz5WUWNESkPfq7QkBu9EoJxJVSUTC/W0O8rdGxaBTyGeoOstbZtnYufNmpqbD3nSrpxmYcmsvOdnZ1kQ0+Exvl2Npt9NTxesp8TxxSQJBTqi8RLJMDA27q6uq6FPVQWw0KoQUMacy84kv8rVyPf49L+A3AwmYMwRQFTuHIQQLWANQKy0bXl3iNioJjDf7+Buv2NYWbaTDu7FtecpWvJ81U1erLgSnQx6pZ6nMDMG4eGhjZAHu8FmI8fE0CSQAhEbFf29/d/qa+v7xxSpeS2N2PzHLOYl1buF0wJfdopzj4GEGeZBtlJ7p5nJGxkTr0rnLrx8Cy7CFxDXveXiuMsk9Y0MIngWt2Fiq5znAx2TEZYlEEjG2t6dtYr3wO3XJYC75P/2nHsXwPUL0BUvY5T+jtVCV+kqKFWznjT7ASIrx4ZGfk+nL13Qz7bXwxHSBzJwrwO5D8D+7bDJp5DoxPNgCjNgm3O7nnAmn7mIsfIvRnS/jGEPesCV5Gv4gqdOQZz8CO35qGmE0xmfgdtOMtULQyBRZlwplEegLQLLnBkG5lTApmzwAL102z3OinnEOTvxn6CGdYwzhcAjeoBLMvthtQxNRyu5LC/y3Gsq/LF0XPmss99oWTONa0qyaRAHp1g6VZ46e/zG/1RxUjf3pA9ROs7e2BgYCtY2J1Opw8b1Eur5Nj5ifsdI/tVaRs/4lCpZOcOUn0u8+AwWTkmiFGFIfgrvYwZU0yJDjAbIgYNq+pDrFXL7KX7padS3d8Ah/S1B93joDHEWCH7NADtQ1uxXDCFsKBZ5KGKmNNAgPpYsTT1mGUXt9oh82pdS2xRlVBrM6oWskmAnf8EJ6gDzPz4kez4OCKMpPgQLW3L6tWr7zvhhBO6SZ0uWEEaebDMR6A+N8nC9F9DvA9woRvMU3menQSZSoyZc6TmGDemvcrKso2kTNe49pI3o7lrnCO6R/HsI5wkprgXUENQNJ3poTjaAFQyM8sNqUpUAo0C9pLAfHfRmH21ZRa+gvo6zfQOwdyw3t7ej4XD4c9Bg/EjxUx1uWz0QLwAhv1OVLCF+kgXMKKQvTlnZ8a+xLTY33OhFOBKukxh8oCkuevOk3ChCq0S4+F2CNUDrNJAvK1jHkBI2hqTxkrmse1gFG08wkDcaO7HwXxZhVpVZcmDnB+hqC7TbQkVjTpaMgsoFRyzKluqSORnbCnflS+MPBrVU7cgPl29UOhCLCQwIbvrx8bGVNM0byAu/MmA9EGEOj0PLNwKEGMLgkiiLWV/4uQn78DdP60A4gvGMVw2CEV3277U4KyQl0oXEPMqcvYAd8w2bFNchN8CSafxo8n19Clg78lMbQO5wxW20r5gbSwcOUnlPLQLP/436VrO1d+jjEfhxBTBqEle47i5gIKtmhJmJXuCKTzCpGu2HZQnDjhJnNlcinvyxtwvVUX/UDSUuvJwMSfkRbvXjY6OmjBLH1wuMxcNpO+Z0ig5PNM3AcSvoYXFFgovpAlbODf0HRZpoxfMsmq1S4OrYJUbhxt5nFI9Z8PL3ENQWjCWvAdt+gKwYECGUhcAi7BIntbr2j/3bZLYTdZpdQqiFp0pqtvQBpHfpKrUt9tioqzRcGjAFCLyX1Ch3+dc/lC6jK1mc9nxKdnzLKJ1sIjSwTKw1VEnDJDjFfspmf1/2L06W5zcrSmhD4e0RPhwYOJdPwBmGlCzf0type7KpYCqLhZECuipfzQSiZwCdfplBPrJBUG0rXlp5N7nZMa3KvEOvKznhBCAZpEJNY6M8EHRKPwos69aiFJ2oSWczPTkFUzRzxVaf4sbgrBYBaSluge87Fn1h/QeetYqsPIytKp9kssHHdt8yJH2DodZL1RUqVt3h4XQCKbFs+VoiPuW2/G8XE0WzKl/cBzjIU2NfRNe7+qFwCTPHsz+0Nzc3DAA/aw/k+BFB5J0PDzSPlTgqwj0B1tbGztsTnYqB3AuF5GW7QDBY1jZznFyLEyrrD7hBEhybKrjdinTQPgaxJIXAayTeaTjRe5OdG0eWbF+lanXSiV0LcDZZTvF/7ClcTfY+r8H5GC59pI83iJi1rBMMQ1xq+PaXOmGLPBuf1MycpsdWfpOLJw+qSEAYGBXVxeNd96GMGV3JpP5LkUAiwVTXQyNSZ3C84oCvLtSqdSrFgoxnKm9GXP46cuUvvXbK94oriUh8HmEiIUc4wk4MaWcx0JeBtWx07j0vTyUuJgJ/ZWMC/bHT2VQQ2p6LSq31nJyF5aY+JZpTt4Flj7N3GYoXYZKDnupcDZVepZpLM6S6uABx4YrO2fyIxcXrNnvpONr1jV6Gmk5qNkIsLgLIA7T9BLycIk0zeKjNtfrwly76HU7fRQtaBP1WDQC0Z54IWPufOQqnuoFE9UDahKaTOB1ZR7BuRat8hjJmXFiYO3l8GZv5nqs/+gZrEJkKeJdqh7/oCIi1+CHm21p/RsYOu2yD8xUuM7GzKfw4ipri6zCb+qBUEZoT41ln7oUrL6vM/HyVY2eQqMnCNs68vn8lwHeGyYnJ6eImc2O0TYNJIEGAP8KQe0NUKkHzfc8iInT+\\/PWEz++jGvqdq7pHoDCVavcQCihRplNndC+x+\\/21jhnMi18s4ilz3XDkaM0hdV2MsyfN+zMFoD0ebBy2wEbFWaWsNiY8RQL2TEW1XoqHRSqiDwxnH3yPGiX+zvjJ61tVD75HtB6r4Ine8euXbuuBZgmTS1thpUqzcVsZigKAK5G/iLUaYgKr2tDZ8cyxlM/uxye33amhbyQAWqoiHBRg0dJMXNVLwxSC+Loa0S07WbYwXZ2lE3vaJR0JXFmV+y016KFrsqZY3ccUKUaA8hs3hlGaJZnXeFXuA4QkUDl+s6x7NMX495tbZHehmqWzBVYeQUigl/Bft7tTQddvrNDdhH01trb2/+Rut4aOTeymMuZ+56+hkv7u+B52bEhVxr2kKGxiI7eKhbaFJL0iGjyDiXc8nYmjr0ZApqIK2Dk7SEluQle7tthO4fIrgIwt7/sycwDLG/Ns3Z1oNwdyEkNix2zhf2XxtTUfboWWdVI88FsKSDPbTj8z/n5+WebmUGhEp0PZxsB4NUIM95Ko/oN0rSTz7wTCH3PVaOGiZJpC5c8N44mHCrHg9xzaNTQWXB0vswUbQ1T2DGbiG0JvWejI80f4sU+5kh5v3Q7/jRydNg4HKA25QQWVtrgVUbdGFnlkScyxcnLW5WuR1RRf3CWNB5k3QFtSeHIJYZhFA7HSuX888+vrD+ozTRtHi7xIBycrwHIlnoqFXEicyaHbpWZmbulUXSHmCgm5HDNhYiXmQlbyaMJmrSK641zRKrnW6JlRR87ThKYuCKurbikYM3Bi2O/pJhy3hwFgEnWFz4VwLawCCxHRLQzjUdgquSodMQGXaPuPN6wXxasXF0oFKhL8XGSvT/vtl5WG9k7n+ZQpR9B6+imWWN1VWp29kHr+R2fYwQeqYBQsjxmWBmC8vtBHfyTrxeJ9q8zPZJmx1mKa13ihMSGT40Un2QlK/dpv5NACJ1FlRAzHaPSTxxSmGXb1j1gWgmAnVtv8IJkD3upQLXehP2HQKo9C7FS1GMiOTekUsHCNyJf3Uj9ymJ+j5ybfg+PtmR5BA6dhkaBcMON6X0Q3Q5xihPlWTyWuBcgdrDjNIWUBO+NnPpJhek3mk4BMuBljxPWlNo1dRhIZmNrUxD6TdxyHvInFxotgVlbAx/lJlrdRetUGmV1amqqrl3UdT28du3aj5MXVTdEkbJgT4x8WM5N7uehmNcfSr01BXeYqjL6YJZgE/U380Tqq1wLpdlxnjQRVQbjZ3xiqPCELDm5z/gzCfxwzakZ7cLxHWDaXyKf2igkgVa8Gp7sPXA8f9so7BP1VkhRAhO3wFM9s3qt4kEVmBx5SM5NfYOrYYQVzLONpFoR6EcSlczbe/qVvjWf46HoCvYSSWGlVT81dcmnYmrbDaZTFOXBbVZZoeYvxfOC/VnqOHcHExp04SFuD8O0fZSmlDaKKdV6MSPsZhvimOtp4Wddvew4IyjvSpFoc0OMigolF9TvibDhudpOXHQP3ArbuZa9xFJKHxSJ1IpPGoaVgyq9y++rJiBpPm/NsrpfIH8bsr6qXlk0PAhmnlMsFjfRyrBaTNwGUk+tdnV1vRW6+TTqkqvLxpnJzwDMWdg8xkNgJLEPal/OzzA5O8Xk9AQFoIzHWz7ABb+MvUSTJiJqVI/fpKiiq9rDJCD9Rb6UPb/kX4idjZxO4BEFHjQMGPZ/45xXVo6rvs6mH6nQSCQS7u3tvZ4C/3r6WGbnn7NH993LFdIY7lg+o7BDzs0QA2keBEA0mOhbdbbSlr6JvcQTGvKJGteuhJxvqx1JqlaT3lTJh2k5YV2vGFEDmLkZseXpsJWP+iD6S+XFunXrKqtpCUjo481wcE6vy0Z6+MjQN3g+t4cV4cTk8wzBJlgZYUq6iyldfdh2M5HuHlTaO79ItpoFidKtyK+rZVntMa0bYQ2mfdB5mDoN7Hs3LWOnbxLQMnxitvvdgoGBAXeH1q8DUAVq9Tp/7f8hOGbmn7czc3dy6kctj6qSTw0nRy/35HjzMZTewQt5S3JtgN8BECDbO2C2LsXhQutBHgeZvgnZv6PeSSIXzY8C4OtQ5jNULo2akDl040h4qG6fKtIZxMYGI/7Syc1t5fHEftYCorW0gu8tzAErrb0vMGtoN7P3PM/s4X2vYeHoLQF8h4B5JsB8Z3V0UGc6pASQX5Hy4JGFaqcmlUrFoEpp1ZcLrN8PKwzDINSSoG0bTrwdejhWd32GZU5zVf+S6IDqTLYz0Z52mcj1MBOtKSYSADcSZcrAyo9zXW8PoKsLxN8AuJ56H5DwvyCCfVrW/t1GZZAHi+u24JougNkCNiaxn6Rv0NxfKpUUhBscJ05t5Knae3f/j7N/zwTXveEpcoRUjVUGjmFfRTh2ttLde1YAWcP0MsibQPhstdqt+aiFgfPfwnYzOb6HeMLlOVMrcc1DOJz0Q0gOoyl9D4poSjq3TtyYs/e+sFkW8g+7A78EYi6LUGOOSd+WlkphZfWJ25SVq94a4NU4Qc7Pg0WvBXDj1Wq1JtDvA+t+hPMvr1cGmUGaPVAdVVBPwTQxthzNN0iF/ONOJrOJK8qEO1cFLHQnVjvywCRvx3olb2n7KQ+FVgRwLZwAxM3Y3H4YL/YbAPNtTRZpeHMTD9OKiqVHwLgJSZ8iQ7jhwO11xseZMzPNnOlpZo9PkLp9QwBicwmabwvYxGu7RWvYuXUxZR5+ihrNSy3mHnbXJdIDSZVqqmsTWcko52IxBZreEEDUtAc7iLzxICBqvpIFMH8Hn+UPRw5IyfYjJvwZb00yjpBDJFqYNK2ybdQ1F1Qej60X6XRvAFHzXbEAbEOto1PjzY5i+1jTLD/cBc7Y2HPO+BjnIW8eDkIchyvueCPN6ZQIRpV0+wX1PKwgLZjO9oawrKpuumpbKSnoh52UzZi/wzKSp1KPKitX5kRfHxP9A0xGEXYWCmClWc6FfCfU7RuPlRlwR1Gi8cczawP+6gxWfo8i+OUz0jTzcnx8V7VHxamDtrvLa0LSfbqS7ugPcFm0nUwCqBW1Tk71wDOONX8Mc3lAquo+3tGx3VWp7uw4gxk7d5BzU57qCEaKaPQKZUVnS8DHJcWUFyJvpyi8TixJ6WkA/gNsz18ekI5UuR4qL0GiB2k6C53xmvJybn9toOP0cEUJUFlal12nh0GpwSU55NFlq1Z7/76wMzLM3Fnj3iopu5j3VlVhY5i6duK6lOgOHNalJKjRpGVZbWBdboHLos18m0gsrMfZnUxwqzJiZRrMoQFlFCxJtdJXjTl/QwDJktMpAPGURmGIt/8ANvllMVL0Dz6LfODYsplqW+VZAMyd8mhwVTECPJaW6vXq1ElDyPRR+Ohy4siDBiaFqtBX0AMEjjCehzlPc3SUpTOSZoYXS7Kyypi2CD34MfpJzqM4Zet4swcdLm81lg0gZ2dYZaojfeUx1e5NfwzSkUq2bZ+E/HD1XxyonWbTDJCiMSFt5uQzyNlyLuSZzB3SeBx2yDcag7RIz/Vd/jINykv9TEtDetHKKRGJ2O4nxAgtw2Cl3c8wXVOY0urN5HBskwnFCeBYVir5Ix/+4L6/vxiyNNaTqsZEZ0/J7b0Jh5k9jrjUMtw5qw5iSWt+hqmxxEYRTfQF/axLTwCu0qtT7++Y4Li0bI9JWuZ11uhQD7Os8hJyeggApqXkxZ2/Wy8deYu7ejNIS04Aiv7C0MUN/jAMeazvYuUZHMvoENBCrxMtSfq+6GoocxXA6rTFqdPCq9Y9qMRbBgMolp2SAPMe5Pdjn9b1a56mpG/zfAH5ymbCD+79eYPEYS7e6cxM/tYc3hPS+lcZIpHciKbUF2Bw5JLHxl8j7waoDo7fhG2zyxCNZoH0n8YCe3hUpkUCGaQAyCAFQAYpADIAMkgBkEEKgAxSAGQAZABkAGSQAiCDFAAZpADI4xxI+qi593nHIB2jySIg6ftn9B1PEcjj2AXy/wUYACIPOMIobjzuAAAAAElFTkSuQmCC\\');width:100%;background-repeat: no-repeat;background-position: 15px 6px;\"></div><div class=\"mi_gradeselecthandlenerrow\"></div><div class=\"mi_gradeselectdigitsnerrow\" ' + (window.MI_defaults.RTL == 'true' ? 'style=\"direction:ltr!important;\"' : 'style=\"direction:ltr; LEFT: -4PX;TOP: 30PX;\"') + '><span style=\"font-size: 43px;z-index: 3;color: #92c83e;font-family: \\'Source Sans Pro\\', Alef!important;\"></span></div><div class=\"mi_gradeselecttext\" ' + (window.MI_defaults.RTL == 'true' ? 'style=\"top:77px;direction:rtl;color:#b8b8b8;\"' : 'style=\"top:77px;direction:ltr;color:#b8b8b8;\"') + '></div>',\n starspanel: {\n header: '<tr><td><div class=\"mi_hover_starspanel\" style=\"border-bottom: 1px solid #dfdfdf !important;padding-bottom:5px;width:387px;;overflow:hidden;border-top:1px solid #dfdfdf; padding-top: 20px;margin-top: -17px;background: #f7f7f7; /* Old browsers */background: -moz-linear-gradient(top, #f7f7f7 0%, #ffffff 100%); /* FF3.6+ */background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f7f7f7), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */background: -webkit-linear-gradient(top, #f7f7f7 0%,#ffffff 100%); /* Chrome10+,Safari5.1+ */background: -o-linear-gradient(top, #f7f7f7 0%,#ffffff 100%); /* Opera 11.10+ */background: -ms-linear-gradient(top, #f7f7f7 0%,#ffffff 100%); /* IE10+ */background: linear-gradient(to bottom, #f7f7f7 0%,#ffffff 100%); /* W3C */filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\\'#f7f7f7\\', endColorstr=\\'#ffffff\\',GradientType=0 ); /* IE6-9 */width: 396px;left: -5px;position: relative;\"><table style=\"position:relative\">',\n footer: '</tr></table></div></td></tr>'\n },\n tag: '<span onclick=\"jQuery.MidasInsight.tagClicked(\\'@@@kfid\\',\\'@@@atags\\')\" class=\"mi_tag_@@@atagsreplace mi_tag\">@@@atagscap</span>',\n slidercontainer: '<div id=\"mi_previewPhotosContainer_@@@kfid\" style=\"height:65px;cursor:default;-moz-user-select: none; -webkit-user-select: none; -ms-user-select:none; user-select:none;\" unselectable=\"on\" onselectstart=\"return false;\"><table class=\"mi_previewPhotosContainer\" style=\"\" cellspacing=\"0\"><tr>',\n photopreview: '<tr ><td id=\"mi_photopreview_@@@kfid\" onclick=\"jQuery(\\'.mi_thumbscontainer\\').hide();jQuery.MidasInsight.resize(\\'@@@kfid\\');jQuery.MidasInsight.MI_GetPhotos(\\'@@@kfid\\',false);\" colspan=\"2\" style=\"width: 100%;overflow: hidden;background-color:white;\"><div class=\"mi_thumbscontainer\" style=\"margin:0 auto;overflow:hidden;width:386px;padding-top: 3px;border-top: 1px solid rgba(0,0,0,0.2);\">',\n tabswrapper: {\n header: '<div style=\"width: 152px;margin: 0 auto;background: #fefefe; /* Old browsers */background: -moz-linear-gradient(top, #fefefe 0%, #eeeeee 100%); /* FF3.6+ */background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fefefe), color-stop(100%,#eeeeee)); /* Chrome,Safari4+ */background: -webkit-linear-gradient(top, #fefefe 0%,#eeeeee 100%); /* Chrome10+,Safari5.1+ */background: -o-linear-gradient(top, #fefefe 0%,#eeeeee 100%); /* Opera 11.10+ */background: -ms-linear-gradient(top, #fefefe 0%,#eeeeee 100%); /* IE10+ */background: linear-gradient(to bottom, #fefefe 0%,#eeeeee 100%); /* W3C */filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\\'#fefefe\\', endColorstr=\\'#eeeeee\\',GradientType=0 ); /* IE6-9 */-webkit-border-radius: 15px;-moz-border-radius: 15px;border-radius: 15px;border: 1px solid #cbcbcb;padding: 5px;\">',\n footer: '</div>'\n },\n footer: {\n header: '<div class=\"mi_footerwrapper\" style=\"background-color:#fff;\"><div class=\"mi_footerroot\" style=\"top:2px;\"><div class=\"mi_footercontainer\" id=\"mi_footercontainer_@@@kfid\" style=\"height:100%;position:static;\">' +\n '<div class=\"mi_footer\" style=\"background-image:none;height:auto;margin-top:2px;\"><div onclick=\"jQuery(\\'#cpcnt_@@@kfid\\').find(\\'.MI_tab_selected\\').removeClass(\\'MI_tab_selected\\');jQuery(\\'#mipct_scroll_@@@kfid\\').addClass(\\'mi_blured\\');jQuery(\\'#mipct_tblabout_@@@kfid\\').css(\\'max-height\\',jQuery(\\'#mipct_scroll_@@@kfid\\').height()+1).css(\\'height\\',jQuery(\\'#mipct_scroll_@@@kfid\\').height()+1).css(\\'top\\',jQuery(\\'#mipct_scroll_@@@kfid\\').position().top).fadeIn();\" style=\"z-index: 1;position: absolute;right: 0px;top: 5px;height: 25px;width: 65px;cursor: pointer;\"></div>',\n share: '<div class=\"mi_footer_prompt\" style=\"color:#59a3e8;top:auto;border-top:none;position:static;float:left;margin-bottom:0;padding: 7px;\">@@@ask</div>' +\n '<div><ul class=\"mi_share-buttons\" style=\"padding:0;margin: -5px 0 0 0;\"><li><a onclick=\"window.MI_logUsage(\\'mail\\');\" href=\"mailto:?subject={1}&body={2}: {0}\" target=\"_blank\" title=\"Email\" ><div style=\"background-image: url(\\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJgAAAAxCAYAAAAm0WAHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NTc3MiwgMjAxNC8wMS8xMy0xOTo0NDowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjQxOTgzOUY2RjMxMjExRTQ4RDc1QkNENzc1ODE3OTkzIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjQxOTgzOUY3RjMxMjExRTQ4RDc1QkNENzc1ODE3OTkzIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NDE5ODM5RjRGMzEyMTFFNDhENzVCQ0Q3NzU4MTc5OTMiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NDE5ODM5RjVGMzEyMTFFNDhENzVCQ0Q3NzU4MTc5OTMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5SFpoiAAAe+klEQVR42uxdeXBd1Xn/3r5ptWTJki3bsrzbeMcOm9kNCRCghKWEpFkIkFCSIaShpO1MOmkzmTZJZ2hT2gYCTKCUBEiAYQlJiMHYGLzIeMEL3hfJkmWt7+nt9/b3O+9e6erpbZKeRP7gzly9d5d3zvc73/6dc69suq7LJ9sn23htTuvB1q1bh91gs9nUJwUx/Tt3fjeE1I5Pv9Pp9GiaVm232+fgegP2MlzzYI/gei/2E7j+Ea6fSSQScVwPsUmzLeun2ddoNyuN5rFJL/ofhgv0uHE+gHM+fDZgb8K1GuwB/hx7GNfasB9OJpNHcD6Iz5jD4YhiF3wfMjbmZu0/34axKQgb6TfbtY6b0Qb54MZxJe6bjWszsFfikg97HOf7sJ8y+HAauGM43497EtYxs46XFZOF50O2VatW5Raw0WwgshSdVbnd7ktcLtfl+Gzw+Xx+bAGPx1OFcyUgzIl74gASjEQiZ/v7+0PhcDgUi8WOx+PxN/D5Du7pRHPBQphQzI0DBQy1GOhG0H416L0In9WBQMAGDCX4Xg5m+XHdhvtCwNANDB2hUKgPO5XkEATrZXwewPU+MunjsBTo2wcs5aD3PNB7JXDMBP0VwFECPkzCuVIoAZU/ST5Eo9Eu8gF7GONPIVuPzzfQRjuwdheLLptVEkdiwQiGVgrE3+H1ei+cNGlSTXl5eYNpGXIJikXT9J6enqOdnZ1nIHBvg3FP4/Qh/LZvIiwY+p+OcxeB/i9DKeYDQ3lpaWnJSDBAuPq6u7v3dHV1HQGGV4HhDfyuA8zUJsKCUbBwOB0YbgGGSysrK6dWVFQ04rqrUAz87O3tPQ0+dEDgtkL4nkS7u4Dh7Fgt2IgFDJ/U5EUAdCcEal1NTc10AAtkIz4b49M3MKevvb39CIC+ju+PY4D2WYWjmAIG+ivw/XJguB8YzgGGMiiKjBUDLNq+tra2Hfj8FQTtLTCoc7wEjG1BuGcAw19CKW6ora2dDYtVNVYMoDsOPrSAD+vx/RGcasYemxABo0/HoF1fUlLyjbq6usUA5hurlUnvJ4ittbX1g76+vv/AAL6O893FFDC0uRAYvlVWVnbzlClTKoFFiowhCav8ITC8AUEjg45QboopYLRacHlr4f6+CQxroCRVxeYDaE8Cw0cQtJ/DfT6DMWsdjYA5vv/97w8ctLS0ZO0QoKbBvz8ETblv6tSp82C1XByMYmWhJtGwJG4wn8nBCpjqSQC3ly5zLAJmYczlaP9hMOX6+vp6H7RfxgGDHWNTCwwLOGbA0A2hbgEdyUIELB8taHMS4qu7Jk+e/O1p06adxxhrnPhgBwYma6uBoRF82IPvZ3P9FmM6OgEDgFno8IcNDQ13ANgkSDPdpIxHQM522T4sSyX6XIKYoA6JwA701TMGAbOj3RsgUD8BU5ZVV1ebMdi4YYAQ+MCgucBSB5ffDwzH0Gd8LAKGdmswJn8DBb8bit7kYKA3vnwQ8MFHPgDDAgjaDmBoK6qAoSP6+X+bPn365xBAuoplivMNMgcNlsCDvhfAXE8Bg7aNVMhMAYMFUcIFDHMQAGc18eOAwQkLMwPCVg9F6TRKG4nRCBj4MBmM/h6U/CtVVVXVRllo3DFwAx8E4zcLGBaDD1uAob1QAbPnkeI6gPpHaMxnwRjbRDAm3VQjvvDA6twEOh4CPVNMocm0Z8FwMX77I2BoRFvyMWBwQzE/hZj1TsRN5+PYWYhSWHdgKIOQ3gMG3gE+VNANZ8JgU78vwp6BD7DGgjG8CGP5E9Azu9AxyGXBAjCRd8EU3w2XwqKdbaKr/hYNouWkBjFt3jmCWtNsYPgvYFgCrZ9Q4UrD4ASGabFYzA9X02zU/AoSMP4WbulahCYPINutS7dcvMdhZ9nCpoQDCMdMM9tSlRp9aEBPS4atCR7FgXPvo+/+fBYslzZdgCzxHjAmkJ5tfhxCBjoqkWDe29XVtR1Cs6GAtLscv2W2uJrCNRGuPY+79CK5uA6pfysys382Sxj5SgewFnOA4X4IV2O6cFEIYglN3j0UleYTUekMaaKNESN/7oSALZnmlsvn+yXggQXVh/CBGebnwYf3cO6plBgWOFVkAVUPaf1baD7jh4JrM+PJINBhAz1zwKAHsB+CVrfkYg7inbWIG74EzRe4pqJiSHcjYoyylbcmKeY5IzMrAYarYMk2AsNLwJDIhQE0l+M390IwVwK/3YqBVqsjmJRfbw3J+gNhOYPv0bguYw33dcPVbjkakbMQ2C9+qlQJsm4IGQN/CHsF6H8QgrYNGD4ckYChESYn1yFeWeP3+9X8WrYBVma82MJkTt+k6QXSZGY0jAXWIptZi3ueRf96lsp0DTDcj3ClJBcGu0G/lqG/jK7DZinWGsJjM4Ifm6TaG0KLan+wbWIA/SyI3goGvYNT7Xms3gpgvga724qB3cSTurywPSTPbe+TKWVOuf3cEplR5VR0jMWG8fd7W+Pywo6gvLm3X5ZMdcuqmR5JaAMzF8IxhXwsAh9uxvG/gM7wSASsnloDU+jLpr0caFhmSeJPsZ0O23Y6UnFFUhueOoOuir6+vq8jlnkL2tOaScBw36XAcMmkSZNy9kX3wnFzoz/2m0vITOE6dCYmGw9F5MOWuHT1J0GnTaZWOGXldLec1+SVUo9djnclZPPhiFT67bKm0SvlPru1bQ8swHLEk+vAoGezlS44FQcMrHdNS3ftDtC792RcNoOOxmqX3HdpuSyod4vLXoTxR9uL6hNyuCMu+07HZXdLVM5t9AwTfo4t+PA17M9hXPYUJGCsDeHmCyGhMwFuWNxlWq7jZxPyxt6wbD8Wld6INqDBY/f9CBTBrEvne+XCJp/4XDZJ6kOBwe1xEvocMGcZTrVmyNrKYb2+AK23cfonU9zFGOODk1F5ZkufnA3q8hcr/HLlAr/qP5HBk/J8BM7s1V1BefGDfmnvTSrFshtZ10kI1DaMxe8/DMu0SofsAPM7Q0l1/Uwf3Mx5JaJrKYxUEtDPuuI1wPAKmunKEos1IkxZg92ZiQ9toKEHY3/D8oAsbXAb5Ri9KC6kMmCX2TUu2XkyJn1hfRhzSY/b7SaOWijKlTg+gP7jeQUM5o6rB26B+SvJlHGRMc0nYvLohl45BAn3QWUcNsOuFgFbBPvulpjsPhWT/dCev4L/D3iZpg+9D66vFIHyTYhlNkApgmnNzEDMdQnT6kwYyBwqxfPbg7LpYFS8EOLH3ukTN7BdPM+rrGciMZiLOVQgLbg/JP/7fhDfdZlb65KL53plXo0b8V1KwDZ8FFEM2Qu6fW4b3JZDWnuSsr8tBiFOSoV/iBVzAEMTrPB8uM3NVldv0OwChhtwz+SMma9uuHVmdi6Oj54xrBhWMrCLsrgDAqPTS+hDPAUvJSCoVCoxs9Is2TfG2NHT03ML3P3/cdlPXgFDI5Oh/RdwqUom4k73poLK/W1xaLxPPrPYJ1PKnUOC2bEEzgS2A0wiM1/bHZZaxBY3nxtQA2hlAOhzQhHWxePxKq7JspKJ61eBObglkLEfFwZ456moHDyTUBnSjcsC8v7RqDz8Zq/0RjW5ArjK6NKSqcGny9gE4fltc0gF0Z9Z7Jfb15RIbaljICBeOMUl58/yyvr9ETkIxVuDmKWtNyGPbQzKYfSzCwpzyXyfam8gxS0vn9fe3n4NlKQZzIlYvQgwBIDhWk4D5YqVVPyoFTb2KUXRlVuPJwdDkQCUgUqWyaOY/WSLEWHBbKBzBZUae34Bg3AthQtymstV0v0+XeIe+OR6CNW6hT5ZMsOT0qZkMSZZsaOPGmg+0+1H3uqV5uNRuXiORyaDmUO0DDdDwLwwzyz4HbM0w4WClzAItS7ISy8tH4OL7+7XEL845dolfhVj/DsEjH0ebI/L9UsD0gBX5/c5pA+u7l3EOi3dSbkMrvtWCHxdhSNl5XQj6wLtFNZPn+MDQ3xyoisJoY1AQRyI2eJyFP2l0kpricFeBuaQfpdhvK34piJrrMjEh9FsFK6+qC6v7+qXV7C3wlD43HbEiDa5CS523UK/uJ3DY9789TI7a2M6+HAuaN4ixqR+riB/NRfZZTTLGKDWngTciy4h+Iyn3gsqjVyO4JZmN54YfYmP40jLchZa/4e9EcQ5IaVdFDS6GbqbRFpxkYsa4SZXI6Z5yyy84rsXTFuaLfYytxBcZBT0VpU41MCumOGW+68oV5je3BeW945EYaG9ctFsr7LadHulPpucN8sj06ocEosOTW5UbGUwMpFMTY+safSoOKkzZJeZyO50y4S0pXA5Gcwp4wpTy6ICMm4FrJffPM4UJw2Otm5pN4viYoA3HwrLk5uDKuFYWOdW3iIU11Q2qumGsuiD5Qizfd1oONt4AoMXhmkNXP0TOAzms2CLYBlc2dZh0bTGIVQcsAPQ9B/9rkduWxWAW/EiMMTAx0cuZE57ijH7WmPyXHM/3ExUKsDMagSaHAQKbqYNljYAOhdwKoZhg3GaaSOzL8m6lgz88rqYOUKroSwUCBK9qN4p37myTF7bE5ZNsFi/aQ7Lb3b0K4acDWoyY5JDWS7+PhtGWoBU9qvJq3Dx247H5Y41AbhMt7J4GZjDhKQJse8pi4A58H0+VwMXKyuPQiGOdSakP6aDHp98bkUA2DVV5yrxpDLoQes1Mg4y2IdCLGQhOa+A4aZZLEpmnlJRFSrFkE8j9uLl57b3yyNv9ykXcP0yv8ytcSqNKNTUup02FddsOsyMLqSElvELtX/rsZi09CQGNHRYwgE6yRyuozenLMAcLvOxZ8eQKkVUw3KVeu1ytCOhCpR15XYlAHQZn18dkAtmuWXzkZiKNZkxEnOJx64SAdGyazOVpT8m8hqyyfdhBW9Y6pdrMVZOhwyJv0wrDCHiOvkmtPeODK4Zc2Jv4pr6rLMPlqqunsWC8SsTMKfTZrhyZODgNt22B0LlQYJWXWJXcZlpwcw2rH3qup7TgnGs+eyFoeh562BVrNTmnABnDQTW6sqFXqlBbESr89LOsBKyW1b65VNwIy4giyf1nPGWB8AZ17y+h5YiDMuoyXVLfHIrtCsA5m8/HsupTEZJpRq7w1L9ruVxrtiFt/bHNDWw/RDuF0F/NWLpmlK7UaKghXapNJ1aTlynulmWsKm6VkLLPVFNHHTtTZNdKgli9phtLDDWXFlbw3leE4OBpzofHwqJu8KwWIehRPQ8XSFNYSeWw1DkCK7RelWBl1SA0SZpxlgzrHIVkkW6s64tslBgjtdl8z1K+1/6ICx/RAb18J/6YIqTcpUSPjvinMGpB7MJh+ESKUCsKW04GEUbDrlxaYnKTMuhVafOJgsF5pWhK0LKUgV1W04BO92jSU9YlwV1LhVbMbas9LvUJC9pZBhAprAAuwAZ4uJ612CIkMy9/opuPQjBpBtm0TWhYihbNoFkMdtnrI5IGud4cyDnGq8ChIG0H+qOy49/36dcIEszxMdaHecuKfSrEHt+boU/pTijFDCDTpvBi7wWTDdXR2aqvQwRNuzUgnm1Lrl7rUPqEZ88/X6\\/\\/PK9kMrSbljqk8VTXco1mN7BBatFq7D+QFTFN0chSLMnO+VrF5XIKiQLnI5IJvShZl8yL9E1HxFLx2usuc++ckIXpbkeIKfL4ACrgq6mDyvnaSpDTglWphmDTPFOBFaRicH0SqcS3lSJJesaL7al57iWsS8zGB8I+DO4SM2oj3qAzS5G/Qs301oRuypT2AdDn3QXaY2mc61CyTfHmy5g0Uzzdrkmrsx5vGAkRXwSVusP+yJyEqn6ZfM8CJ5dSkOoMSdhnpmhvXUgBvekpSrnyZSgaiMMLw1gYWiQZtGm7tSl7KAZHzZCqJlB7mtLyHEEv+fDrUcThc1H5qpLcWOdie5odaNDJRKRHOOPsSb9fB5Rs1gsUhEc6+Q8kyN6hgeuKMV3kRcRxrwJL3PFfJ9cPNej3CdrYH53brdfCB8gfFp6qSWbgJ1F0Dw1mwXTDYdnBn4UEPr0p97rV8Q3Iru8cblP1X5e2R2Vx99NyHSk9XQVtBDtfRqELCFN1S65a3lATnQl4CYj8rO3+qQDTPn0Io/YHdYAdlB70unhxDHOdZiuxdhO4RiXEp5sWsfBXoyMsRF0UQleQPxXD0aw7hVL6mOIRVIxDyeKWbicCyFOJHOvP4vH43zouAPuXrNkkUk+m2jgy27BRB9mXay3MoxhnNs02aESqXJvyv1PRgjSUO2QZCylUPQaVlnW9YEOhpRBsuEw6AwWNFXEJ5ZjsdiSfOumbEbB8gAG88nNIVilmIpnvnp+iayc7kJ84wYT3bLlWCoTY7bmQk91yGDWLSxRvn9BrVOCUU1lZ89s6Zcn3w3id0m5bZU/tdjNlnv5DuikBTjEOWvLpZPUpmg0qmb8syUpLIMwAGe8yFiQmfBnkWAsgUtn/W00QkYX1BVKygbEN9WIPxfVOYdljukY+PAxMVjdJBWE54AhHggEXGOxYsQaBdtpnc0QQK2KwHE0UZxlChxr0HwcAhYrZC5ydyQSuTbjsl5LKMH0t/lYXH6+MSh7WlKlhS+fnypTROD6/DC9a2e7laXoDSNjM6YmGOtUBexqro7BMj9vXOZV2vX45n55dms/rIDIJXPdMiBjWSwYmBODtvOJo6jFRfbgHJ+8Ls2lJJxbpCJMRdx4HFasq19TlX1+MnUXfWTuWtWRgHHnqbicgNBevcgLF2xTFizXBgwY8uQxa80O1owW+QCfuq6srKzIVM/T9KGBWK5C60DxNBWh5i07DJQp0mOyLPdjrGl19+B6uBAXuQWgdfOJkvRGecQ4i1pKd3cAMcxVC7xy+7l+aZjkUFqhG1NHtPi0FFUB54AxMk0yA+FUPKQLQgBZt8AjpRCyRzemSh5MrZkMpJYAZ9Z+AsMnH0BIWgQsAtqbgaEhG4bBbFaXOTUO+eCUDZZUpB7WlcJvzzTfkbdYbJMzQU1+i2yatTTGnvmsIOmCe+k03Et6XLODlsHE8Oe6kT5DwLZAMfozKl8a6A8Aupc/ylg9hwXyu+yy9XhcWnqScstKn9x5AYUrVbAbmJowxovBI4UuYuyxZMrvWx8w4M9soOKi2R759uUlMhtWcA9c7xFkorR43PW0tJj0gc4OfD+YRiJBvoJrejYMZo2Ifa+b75U5iFE4pfPs9rDK/sSWecVqVuFypDC+sjuirOHaOR4V32l56mWwUP2gc2P6unZDIfhiksNQlD9b4TL5gDiSL1N5L1s2nG7BOgD6j729vbcwhrH+htXsmZWs/tqktVeT21ZyysEnlbBSsYQ+ptUUKnEF05c3kByfPLIhJPtOp+Ygp1Zwykgb0j7oI7AXQd+ZdMMA4OvhdoJ9fX2l6RhMd0Y3zCyrxCPIqjzS2qOpeJFTJ5fNc8vKBrfUoV9bAcLFrJRZMS3vPMSV1yz2FrR0pgcbxvoVaH44A/P6cO03wLkUGBxZyxTGilnl8vK4SEmbu8zlIjV9cA2YnqNMgTGmom8ChmMFlSlwYwia8zyU6xYG0VyPPxi36LKswaUCdGor59nKfVz3ZBdt5FNYGQugyaRNdiGmO9mlKcE6f5YLbtY+JCCFYFH7MQb6y+lm2RiEVmB4PRQK3ZyOIbXkSIMwRGUfkg9mWcz8QrHUylYG/a8i+w3h3LUQlDKvLaOgcOxdYDtjy42HYvKLTf0yyW+XL6724dOWmt/MsYEuWtiDoPdguns0jhPA8Cos2IPAyzV6GRXFLLuYa+Y1vVjWKf9yHYMPdI/P53ri25lBe97hGiUo2HI+MDGwDBkfrJvctNyrhG0rsq+nt4SVYGWLlUa06YPpPoX22nM8EDD3gOs1Bx90kUF/wvftGaZelGKB5sdwz024127FQIFaD2vz8q6IKrFU+FMumJaSrn9erUPOQ5+z4Ta5uiOdYTbDatG2dSJ5eXM/51DDShDvutCvLFhCyz0WxNDd3c1XVz2e7QFW476DuOcl3Ht7TU3NsCC/BmNEBW8+GZfVjW6ZVZVaGZLeOcs+g0XVVIXfxvqXnrk8wGp/byQpp7oT6t4y7/CsmhjoRRAnHsfhG0YdrGABa4FU/gwN/E9JSYmd728wGcSK9pRSm9xzoU+aT7hkd2tqhr4YT64bz0go4Vo1wyVN1Y4hD2OYPh90xeECH8v1CDvu3QYMr+De60pLS8VcvmOT1FQPk4wyn8j8WlhkZJOzqp3YHcoqMXZin0kzqzPW4qeWU3PBnq5mIF7eFZUtULKZlU758nleWTrNOWTWIlfcEgwG94O+N1n/ynFvL+55FBg+y1dKDeWDLrNB7/kQrF83h+WRt0Jy1UKPGrt0Z8KMn5a2I0j8NlX7238iJuFEZstMvHtPJ2TbibjUBFLlloQ2GKJY+ED3+HNgOJLTGlpN77Zt2wYmjXH+ibKysqvr6uqGLX2xWwL58djMLNkKiv23tbVR+5/H8b043ZZlftLcLsIAvMQnoadMmTIgJKzeP9eccvEUtIUYwAua3DIPGSWX5tBKp6ZSbErAqVRh3McFe5ycf/9YXK20YN3rXM7lLfPITFiPpJ57wtjE0Nra2gfm3IvjpwoILPhik38qLy\\/\\/FjFYF1Gm5hd1eXFnRDYcjCGL1XPW3TTDhdptg+41432SUjIul6IXuRkeS2ymARjCh9249SaWVMzf5n190/bt263xzOVo8Jnq6urJfIIkW1A4Ho+tZXErcubMGVrXW+nGC2jKD0v3d3Cb36ObrKysTD1fCSFrC2qy/qOYbIewHOnkuqikWr7TVMU5VbuK+9TafE5cRzWl/UdgtViK4MDThTI+ZObrdw+fq8wmYF1dXcTwNDA8gOO2bOWLtOMFwPBCVVXVfPPpdKuiU2h2tyRUDY70JbQsPDEy43zJmGbMACyd6lQYXU7bEEU3+NCLsb0Hp56x/javgFksGDcfGvkm3MsPEAO46Gom+tF78/F5uBRqTT9ikgf5KgAZXGCYb+K1AfsTCPQvq62tVc9VcvLZbtPVkiJOc+04lZCP2hMqM+4M6WoRYiSRWtNGYfTCopVxWUuJXSUenIFYhmy30mc3VoOOCMNuxC2fhyXaOcKhuMnpdPIVCNXp7zOzyeDDHPYiajvDASYrusU7IHGS06dPM/b6CfjwA9DQk0/AnDm0J4xGfwGmzoHEfpUdmA9STISQmYwhKPSfBB2PgoZnOJUygjZO4Df347dPtbe3n8P2iIHkMzOtZTJR6YGguFWpoq1Pk+5wqhCsBAwxGWclWDDmNFdNqU0FwbECp1qsGNA/p+G+OwrhYhuvIWv7KcbhH7jExypkulFvTGj6uPKBGSMwMMHiE+kPpwtXQTFYpjccYuODnz+FJbuZrobgxtuSWbW+o6ODQeUvcfxdyfLkSq52jPeArcX+nwiUF/HdYOkYzBeIOGzD40sz/afAJfXClcuKAYJxClr/XUNBRjtwfKvO34MP94EP7onkgylcwMDnH+5Gn/sz3T+qNxyyrolGNyNgnhwOh5cYS31lvN4GbQaS9PVnz57VAeoJnPt7kjeatoyN8307YQWWA0NdJgymENEaxJODu3qCXRtZjSkNw1Fo/UMQrl+NYhZqyLQf2t0KPtiAYSVLccRQrCePsmFgWQgKQuH6Hdzifbi0L9tvRvUCOouQbeLMLKzJMq6DZwGT67GL5TJNbeEcHJhC5rDSzfce/HCkliu9TWM7Dma8DwgzwaDZXGYyXhiYxnd2dpI52yHU30G/L4xRuAbCFrT/HjCcRR9LgIGPvg0Uk4vNB2IAH5LAwJrdg7j8Ua7fZhKwQlyktXMu72Vq+hC0ZyHNNIP/sQC0/BMEVVuhSwG4D3Dqh7jG6aDoWAcr7S3PM+Euv4FzX+fbbkh/sTCwum1gYMzIV7L/GNd25coSR4mLHfKR/e+53e6LjZfCFI0PnALibhRS/xXXnkabXfleLT+qt0xnIgK/WYj9SzCZdwJUJV9MxuCZxcCRmGxmfdQUBsH082BQB7Tzv1kjwr5vrAzJ8Z58L74zLvtr0Hud8Z4FtY8GAy0W6ecOwdrEeA9tvIZ+OtNDiWJaGbTViL5uQ1/3AMP00fLBXJ1i4QPXETE0edScMSnkv68UU8BMa8bnEm8GmNshbNNprhkXcKc2cerGePonNW+WTKqdmk7B4s6VDzh3FANFoXoB+15arYn4Rwz4rMXplej7Kzj+DOj15cJgrvfPgIGzC2/jGpOR9diPpTNlnARMhTn4nIv9OtD5BT7bCgy2QvnA+Vpi4Hec6wCGZ3HL07h/t/WB4I9DwAbe3IdTdSBsOY6vBJiLcW6m8fiV3TDnqRpfatOMyVz+v5+3AeR3OOZrMVtwLTaR/6vIgmMSdi4VvxC3XY1ra3C+3KA/HYNmYOC6+R3Y1+P773HL0fTi6QQJmNkPJ2Lr6V1A0xXgwyXAMZ/JgIkjnQ9cbo6dxeuNOM\\/\\/ScAXLXPZeSgTHz4uAbMOng/HXE1ayocx+dJeptec8pDU/yGiyziN6yf50hJqCJerZPqnThMsYNY+y7EHQHsljqfzhTDY+Tic01i7dQa/Pc5/imX8Iy9OricyZdUTLGAD10C7h3zAJ/8tDstMdVQigw9cHtTNN0TyH5MZfOET2aH08S+6gH2yfbIVe7N/MgSfbOO5/b8AAwDCB5vdkkgX5QAAAABJRU5ErkJggg==\\');height:50px;width:50px;height: 30px;width: 30px;background-size: cover;\"></div></a></li><li><a onclick=\"window.MI_logUsage(\\'share\\');\" href=\"https://www.facebook.com/sharer/sharer.php?u={0}\" target=\"_blank\"><div style=\"background-image: url(\\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJgAAAAxCAYAAAAm0WAHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NTc3MiwgMjAxNC8wMS8xMy0xOTo0NDowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjQxOTgzOUY2RjMxMjExRTQ4RDc1QkNENzc1ODE3OTkzIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjQxOTgzOUY3RjMxMjExRTQ4RDc1QkNENzc1ODE3OTkzIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NDE5ODM5RjRGMzEyMTFFNDhENzVCQ0Q3NzU4MTc5OTMiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NDE5ODM5RjVGMzEyMTFFNDhENzVCQ0Q3NzU4MTc5OTMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5SFpoiAAAe+klEQVR42uxdeXBd1Xn/3r5ptWTJki3bsrzbeMcOm9kNCRCghKWEpFkIkFCSIaShpO1MOmkzmTZJZ2hT2gYCTKCUBEiAYQlJiMHYGLzIeMEL3hfJkmWt7+nt9/b3O+9e6erpbZKeRP7gzly9d5d3zvc73/6dc69suq7LJ9sn23htTuvB1q1bh91gs9nUJwUx/Tt3fjeE1I5Pv9Pp9GiaVm232+fgegP2MlzzYI/gei/2E7j+Ea6fSSQScVwPsUmzLeun2ddoNyuN5rFJL/ofhgv0uHE+gHM+fDZgb8K1GuwB/hx7GNfasB9OJpNHcD6Iz5jD4YhiF3wfMjbmZu0/34axKQgb6TfbtY6b0Qb54MZxJe6bjWszsFfikg97HOf7sJ8y+HAauGM43497EtYxs46XFZOF50O2VatW5Raw0WwgshSdVbnd7ktcLtfl+Gzw+Xx+bAGPx1OFcyUgzIl74gASjEQiZ/v7+0PhcDgUi8WOx+PxN/D5Du7pRHPBQphQzI0DBQy1GOhG0H416L0In9WBQMAGDCX4Xg5m+XHdhvtCwNANDB2hUKgPO5XkEATrZXwewPU+MunjsBTo2wcs5aD3PNB7JXDMBP0VwFECPkzCuVIoAZU/ST5Eo9Eu8gF7GONPIVuPzzfQRjuwdheLLptVEkdiwQiGVgrE3+H1ei+cNGlSTXl5eYNpGXIJikXT9J6enqOdnZ1nIHBvg3FP4/Qh/LZvIiwY+p+OcxeB/i9DKeYDQ3lpaWnJSDBAuPq6u7v3dHV1HQGGV4HhDfyuA8zUJsKCUbBwOB0YbgGGSysrK6dWVFQ04rqrUAz87O3tPQ0+dEDgtkL4nkS7u4Dh7Fgt2IgFDJ/U5EUAdCcEal1NTc10AAtkIz4b49M3MKevvb39CIC+ju+PY4D2WYWjmAIG+ivw/XJguB8YzgGGMiiKjBUDLNq+tra2Hfj8FQTtLTCoc7wEjG1BuGcAw19CKW6ora2dDYtVNVYMoDsOPrSAD+vx/RGcasYemxABo0/HoF1fUlLyjbq6usUA5hurlUnvJ4ittbX1g76+vv/AAL6O893FFDC0uRAYvlVWVnbzlClTKoFFiowhCav8ITC8AUEjg45QboopYLRacHlr4f6+CQxroCRVxeYDaE8Cw0cQtJ/DfT6DMWsdjYA5vv/97w8ctLS0ZO0QoKbBvz8ETblv6tSp82C1XByMYmWhJtGwJG4wn8nBCpjqSQC3ly5zLAJmYczlaP9hMOX6+vp6H7RfxgGDHWNTCwwLOGbA0A2hbgEdyUIELB8taHMS4qu7Jk+e/O1p06adxxhrnPhgBwYma6uBoRF82IPvZ3P9FmM6OgEDgFno8IcNDQ13ANgkSDPdpIxHQM522T4sSyX6XIKYoA6JwA701TMGAbOj3RsgUD8BU5ZVV1ebMdi4YYAQ+MCgucBSB5ffDwzH0Gd8LAKGdmswJn8DBb8bit7kYKA3vnwQ8MFHPgDDAgjaDmBoK6qAoSP6+X+bPn365xBAuoplivMNMgcNlsCDvhfAXE8Bg7aNVMhMAYMFUcIFDHMQAGc18eOAwQkLMwPCVg9F6TRKG4nRCBj4MBmM/h6U/CtVVVXVRllo3DFwAx8E4zcLGBaDD1uAob1QAbPnkeI6gPpHaMxnwRjbRDAm3VQjvvDA6twEOh4CPVNMocm0Z8FwMX77I2BoRFvyMWBwQzE/hZj1TsRN5+PYWYhSWHdgKIOQ3gMG3gE+VNANZ8JgU78vwp6BD7DGgjG8CGP5E9Azu9AxyGXBAjCRd8EU3w2XwqKdbaKr/hYNouWkBjFt3jmCWtNsYPgvYFgCrZ9Q4UrD4ASGabFYzA9X02zU/AoSMP4WbulahCYPINutS7dcvMdhZ9nCpoQDCMdMM9tSlRp9aEBPS4atCR7FgXPvo+/+fBYslzZdgCzxHjAmkJ5tfhxCBjoqkWDe29XVtR1Cs6GAtLscv2W2uJrCNRGuPY+79CK5uA6pfysys382Sxj5SgewFnOA4X4IV2O6cFEIYglN3j0UleYTUekMaaKNESN/7oSALZnmlsvn+yXggQXVh/CBGebnwYf3cO6plBgWOFVkAVUPaf1baD7jh4JrM+PJINBhAz1zwKAHsB+CVrfkYg7inbWIG74EzRe4pqJiSHcjYoyylbcmKeY5IzMrAYarYMk2AsNLwJDIhQE0l+M390IwVwK/3YqBVqsjmJRfbw3J+gNhOYPv0bguYw33dcPVbjkakbMQ2C9+qlQJsm4IGQN/CHsF6H8QgrYNGD4ckYChESYn1yFeWeP3+9X8WrYBVma82MJkTt+k6QXSZGY0jAXWIptZi3ueRf96lsp0DTDcj3ClJBcGu0G/lqG/jK7DZinWGsJjM4Ifm6TaG0KLan+wbWIA/SyI3goGvYNT7Xms3gpgvga724qB3cSTurywPSTPbe+TKWVOuf3cEplR5VR0jMWG8fd7W+Pywo6gvLm3X5ZMdcuqmR5JaAMzF8IxhXwsAh9uxvG/gM7wSASsnloDU+jLpr0caFhmSeJPsZ0O23Y6UnFFUhueOoOuir6+vq8jlnkL2tOaScBw36XAcMmkSZNy9kX3wnFzoz/2m0vITOE6dCYmGw9F5MOWuHT1J0GnTaZWOGXldLec1+SVUo9djnclZPPhiFT67bKm0SvlPru1bQ8swHLEk+vAoGezlS44FQcMrHdNS3ftDtC792RcNoOOxmqX3HdpuSyod4vLXoTxR9uL6hNyuCMu+07HZXdLVM5t9AwTfo4t+PA17M9hXPYUJGCsDeHmCyGhMwFuWNxlWq7jZxPyxt6wbD8Wld6INqDBY/f9CBTBrEvne+XCJp/4XDZJ6kOBwe1xEvocMGcZTrVmyNrKYb2+AK23cfonU9zFGOODk1F5ZkufnA3q8hcr/HLlAr/qP5HBk/J8BM7s1V1BefGDfmnvTSrFshtZ10kI1DaMxe8/DMu0SofsAPM7Q0l1/Uwf3Mx5JaJrKYxUEtDPuuI1wPAKmunKEos1IkxZg92ZiQ9toKEHY3/D8oAsbXAb5Ri9KC6kMmCX2TUu2XkyJn1hfRhzSY/b7SaOWijKlTg+gP7jeQUM5o6rB26B+SvJlHGRMc0nYvLohl45BAn3QWUcNsOuFgFbBPvulpjsPhWT/dCev4L/D3iZpg+9D66vFIHyTYhlNkApgmnNzEDMdQnT6kwYyBwqxfPbg7LpYFS8EOLH3ukTN7BdPM+rrGciMZiLOVQgLbg/JP/7fhDfdZlb65KL53plXo0b8V1KwDZ8FFEM2Qu6fW4b3JZDWnuSsr8tBiFOSoV/iBVzAEMTrPB8uM3NVldv0OwChhtwz+SMma9uuHVmdi6Oj54xrBhWMrCLsrgDAqPTS+hDPAUvJSCoVCoxs9Is2TfG2NHT03ML3P3/cdlPXgFDI5Oh/RdwqUom4k73poLK/W1xaLxPPrPYJ1PKnUOC2bEEzgS2A0wiM1/bHZZaxBY3nxtQA2hlAOhzQhHWxePxKq7JspKJ61eBObglkLEfFwZ456moHDyTUBnSjcsC8v7RqDz8Zq/0RjW5ArjK6NKSqcGny9gE4fltc0gF0Z9Z7Jfb15RIbaljICBeOMUl58/yyvr9ETkIxVuDmKWtNyGPbQzKYfSzCwpzyXyfam8gxS0vn9fe3n4NlKQZzIlYvQgwBIDhWk4D5YqVVPyoFTb2KUXRlVuPJwdDkQCUgUqWyaOY/WSLEWHBbKBzBZUae34Bg3AthQtymstV0v0+XeIe+OR6CNW6hT5ZMsOT0qZkMSZZsaOPGmg+0+1H3uqV5uNRuXiORyaDmUO0DDdDwLwwzyz4HbM0w4WClzAItS7ISy8tH4OL7+7XEL845dolfhVj/DsEjH0ebI/L9UsD0gBX5/c5pA+u7l3EOi3dSbkMrvtWCHxdhSNl5XQj6wLtFNZPn+MDQ3xyoisJoY1AQRyI2eJyFP2l0kpricFeBuaQfpdhvK34piJrrMjEh9FsFK6+qC6v7+qXV7C3wlD43HbEiDa5CS523UK/uJ3DY9789TI7a2M6+HAuaN4ixqR+riB/NRfZZTTLGKDWngTciy4h+Iyn3gsqjVyO4JZmN54YfYmP40jLchZa/4e9EcQ5IaVdFDS6GbqbRFpxkYsa4SZXI6Z5yyy84rsXTFuaLfYytxBcZBT0VpU41MCumOGW+68oV5je3BeW945EYaG9ctFsr7LadHulPpucN8sj06ocEosOTW5UbGUwMpFMTY+safSoOKkzZJeZyO50y4S0pXA5Gcwp4wpTy6ICMm4FrJffPM4UJw2Otm5pN4viYoA3HwrLk5uDKuFYWOdW3iIU11Q2qumGsuiD5Qizfd1oONt4AoMXhmkNXP0TOAzms2CLYBlc2dZh0bTGIVQcsAPQ9B/9rkduWxWAW/EiMMTAx0cuZE57ijH7WmPyXHM/3ExUKsDMagSaHAQKbqYNljYAOhdwKoZhg3GaaSOzL8m6lgz88rqYOUKroSwUCBK9qN4p37myTF7bE5ZNsFi/aQ7Lb3b0K4acDWoyY5JDWS7+PhtGWoBU9qvJq3Dx247H5Y41AbhMt7J4GZjDhKQJse8pi4A58H0+VwMXKyuPQiGOdSakP6aDHp98bkUA2DVV5yrxpDLoQes1Mg4y2IdCLGQhOa+A4aZZLEpmnlJRFSrFkE8j9uLl57b3yyNv9ykXcP0yv8ytcSqNKNTUup02FddsOsyMLqSElvELtX/rsZi09CQGNHRYwgE6yRyuozenLMAcLvOxZ8eQKkVUw3KVeu1ytCOhCpR15XYlAHQZn18dkAtmuWXzkZiKNZkxEnOJx64SAdGyazOVpT8m8hqyyfdhBW9Y6pdrMVZOhwyJv0wrDCHiOvkmtPeODK4Zc2Jv4pr6rLMPlqqunsWC8SsTMKfTZrhyZODgNt22B0LlQYJWXWJXcZlpwcw2rH3qup7TgnGs+eyFoeh562BVrNTmnABnDQTW6sqFXqlBbESr89LOsBKyW1b65VNwIy4giyf1nPGWB8AZ17y+h5YiDMuoyXVLfHIrtCsA5m8/HsupTEZJpRq7w1L9ruVxrtiFt/bHNDWw/RDuF0F/NWLpmlK7UaKghXapNJ1aTlynulmWsKm6VkLLPVFNHHTtTZNdKgli9phtLDDWXFlbw3leE4OBpzofHwqJu8KwWIehRPQ8XSFNYSeWw1DkCK7RelWBl1SA0SZpxlgzrHIVkkW6s64tslBgjtdl8z1K+1/6ICx/RAb18J/6YIqTcpUSPjvinMGpB7MJh+ESKUCsKW04GEUbDrlxaYnKTMuhVafOJgsF5pWhK0LKUgV1W04BO92jSU9YlwV1LhVbMbas9LvUJC9pZBhAprAAuwAZ4uJ612CIkMy9/opuPQjBpBtm0TWhYihbNoFkMdtnrI5IGud4cyDnGq8ChIG0H+qOy49/36dcIEszxMdaHecuKfSrEHt+boU/pTijFDCDTpvBi7wWTDdXR2aqvQwRNuzUgnm1Lrl7rUPqEZ88/X6\\/\\/PK9kMrSbljqk8VTXco1mN7BBatFq7D+QFTFN0chSLMnO+VrF5XIKiQLnI5IJvShZl8yL9E1HxFLx2usuc++ckIXpbkeIKfL4ACrgq6mDyvnaSpDTglWphmDTPFOBFaRicH0SqcS3lSJJesaL7al57iWsS8zGB8I+DO4SM2oj3qAzS5G/Qs301oRuypT2AdDn3QXaY2mc61CyTfHmy5g0Uzzdrkmrsx5vGAkRXwSVusP+yJyEqn6ZfM8CJ5dSkOoMSdhnpmhvXUgBvekpSrnyZSgaiMMLw1gYWiQZtGm7tSl7KAZHzZCqJlB7mtLyHEEv+fDrUcThc1H5qpLcWOdie5odaNDJRKRHOOPsSb9fB5Rs1gsUhEc6+Q8kyN6hgeuKMV3kRcRxrwJL3PFfJ9cPNej3CdrYH53brdfCB8gfFp6qSWbgJ1F0Dw1mwXTDYdnBn4UEPr0p97rV8Q3Iru8cblP1X5e2R2Vx99NyHSk9XQVtBDtfRqELCFN1S65a3lATnQl4CYj8rO3+qQDTPn0Io/YHdYAdlB70unhxDHOdZiuxdhO4RiXEp5sWsfBXoyMsRF0UQleQPxXD0aw7hVL6mOIRVIxDyeKWbicCyFOJHOvP4vH43zouAPuXrNkkUk+m2jgy27BRB9mXay3MoxhnNs02aESqXJvyv1PRgjSUO2QZCylUPQaVlnW9YEOhpRBsuEw6AwWNFXEJ5ZjsdiSfOumbEbB8gAG88nNIVilmIpnvnp+iayc7kJ84wYT3bLlWCoTY7bmQk91yGDWLSxRvn9BrVOCUU1lZ89s6Zcn3w3id0m5bZU/tdjNlnv5DuikBTjEOWvLpZPUpmg0qmb8syUpLIMwAGe8yFiQmfBnkWAsgUtn/W00QkYX1BVKygbEN9WIPxfVOYdljukY+PAxMVjdJBWE54AhHggEXGOxYsQaBdtpnc0QQK2KwHE0UZxlChxr0HwcAhYrZC5ydyQSuTbjsl5LKMH0t/lYXH6+MSh7WlKlhS+fnypTROD6/DC9a2e7laXoDSNjM6YmGOtUBexqro7BMj9vXOZV2vX45n55dms/rIDIJXPdMiBjWSwYmBODtvOJo6jFRfbgHJ+8Ls2lJJxbpCJMRdx4HFasq19TlX1+MnUXfWTuWtWRgHHnqbicgNBevcgLF2xTFizXBgwY8uQxa80O1owW+QCfuq6srKzIVM/T9KGBWK5C60DxNBWh5i07DJQp0mOyLPdjrGl19+B6uBAXuQWgdfOJkvRGecQ4i1pKd3cAMcxVC7xy+7l+aZjkUFqhG1NHtPi0FFUB54AxMk0yA+FUPKQLQgBZt8AjpRCyRzemSh5MrZkMpJYAZ9Z+AsMnH0BIWgQsAtqbgaEhG4bBbFaXOTUO+eCUDZZUpB7WlcJvzzTfkbdYbJMzQU1+i2yatTTGnvmsIOmCe+k03Et6XLODlsHE8Oe6kT5DwLZAMfozKl8a6A8Aupc/ylg9hwXyu+yy9XhcWnqScstKn9x5AYUrVbAbmJowxovBI4UuYuyxZMrvWx8w4M9soOKi2R759uUlMhtWcA9c7xFkorR43PW0tJj0gc4OfD+YRiJBvoJrejYMZo2Ifa+b75U5iFE4pfPs9rDK/sSWecVqVuFypDC+sjuirOHaOR4V32l56mWwUP2gc2P6unZDIfhiksNQlD9b4TL5gDiSL1N5L1s2nG7BOgD6j729vbcwhrH+htXsmZWs/tqktVeT21ZyysEnlbBSsYQ+ptUUKnEF05c3kByfPLIhJPtOp+Ygp1Zwykgb0j7oI7AXQd+ZdMMA4OvhdoJ9fX2l6RhMd0Y3zCyrxCPIqjzS2qOpeJFTJ5fNc8vKBrfUoV9bAcLFrJRZMS3vPMSV1yz2FrR0pgcbxvoVaH44A/P6cO03wLkUGBxZyxTGilnl8vK4SEmbu8zlIjV9cA2YnqNMgTGmom8ChmMFlSlwYwia8zyU6xYG0VyPPxi36LKswaUCdGor59nKfVz3ZBdt5FNYGQugyaRNdiGmO9mlKcE6f5YLbtY+JCCFYFH7MQb6y+lm2RiEVmB4PRQK3ZyOIbXkSIMwRGUfkg9mWcz8QrHUylYG/a8i+w3h3LUQlDKvLaOgcOxdYDtjy42HYvKLTf0yyW+XL6724dOWmt/MsYEuWtiDoPdguns0jhPA8Cos2IPAyzV6GRXFLLuYa+Y1vVjWKf9yHYMPdI/P53ri25lBe97hGiUo2HI+MDGwDBkfrJvctNyrhG0rsq+nt4SVYGWLlUa06YPpPoX22nM8EDD3gOs1Bx90kUF/wvftGaZelGKB5sdwz024127FQIFaD2vz8q6IKrFU+FMumJaSrn9erUPOQ5+z4Ta5uiOdYTbDatG2dSJ5eXM/51DDShDvutCvLFhCyz0WxNDd3c1XVz2e7QFW476DuOcl3Ht7TU3NsCC/BmNEBW8+GZfVjW6ZVZVaGZLeOcs+g0XVVIXfxvqXnrk8wGp/byQpp7oT6t4y7/CsmhjoRRAnHsfhG0YdrGABa4FU/gwN/E9JSYmd728wGcSK9pRSm9xzoU+aT7hkd2tqhr4YT64bz0go4Vo1wyVN1Y4hD2OYPh90xeECH8v1CDvu3QYMr+De60pLS8VcvmOT1FQPk4wyn8j8WlhkZJOzqp3YHcoqMXZin0kzqzPW4qeWU3PBnq5mIF7eFZUtULKZlU758nleWTrNOWTWIlfcEgwG94O+N1n/ynFvL+55FBg+y1dKDeWDLrNB7/kQrF83h+WRt0Jy1UKPGrt0Z8KMn5a2I0j8NlX7238iJuFEZstMvHtPJ2TbibjUBFLlloQ2GKJY+ED3+HNgOJLTGlpN77Zt2wYmjXH+ibKysqvr6uqGLX2xWwL58djMLNkKiv23tbVR+5/H8b043ZZlftLcLsIAvMQnoadMmTIgJKzeP9eccvEUtIUYwAua3DIPGSWX5tBKp6ZSbErAqVRh3McFe5ycf/9YXK20YN3rXM7lLfPITFiPpJ57wtjE0Nra2gfm3IvjpwoILPhik38qLy\\/\\/FjFYF1Gm5hd1eXFnRDYcjCGL1XPW3TTDhdptg+41432SUjIul6IXuRkeS2ymARjCh9249SaWVMzf5n190/bt263xzOVo8Jnq6urJfIIkW1A4Ho+tZXErcubMGVrXW+nGC2jKD0v3d3Cb36ObrKysTD1fCSFrC2qy/qOYbIewHOnkuqikWr7TVMU5VbuK+9TafE5cRzWl/UdgtViK4MDThTI+ZObrdw+fq8wmYF1dXcTwNDA8gOO2bOWLtOMFwPBCVVXVfPPpdKuiU2h2tyRUDY70JbQsPDEy43zJmGbMACyd6lQYXU7bEEU3+NCLsb0Hp56x/javgFksGDcfGvkm3MsPEAO46Gom+tF78/F5uBRqTT9ikgf5KgAZXGCYb+K1AfsTCPQvq62tVc9VcvLZbtPVkiJOc+04lZCP2hMqM+4M6WoRYiSRWtNGYfTCopVxWUuJXSUenIFYhmy30mc3VoOOCMNuxC2fhyXaOcKhuMnpdPIVCNXp7zOzyeDDHPYiajvDASYrusU7IHGS06dPM/b6CfjwA9DQk0/AnDm0J4xGfwGmzoHEfpUdmA9STISQmYwhKPSfBB2PgoZnOJUygjZO4Df347dPtbe3n8P2iIHkMzOtZTJR6YGguFWpoq1Pk+5wqhCsBAwxGWclWDDmNFdNqU0FwbECp1qsGNA/p+G+OwrhYhuvIWv7KcbhH7jExypkulFvTGj6uPKBGSMwMMHiE+kPpwtXQTFYpjccYuODnz+FJbuZrobgxtuSWbW+o6ODQeUvcfxdyfLkSq52jPeArcX+nwiUF/HdYOkYzBeIOGzD40sz/afAJfXClcuKAYJxClr/XUNBRjtwfKvO34MP94EP7onkgylcwMDnH+5Gn/sz3T+qNxyyrolGNyNgnhwOh5cYS31lvN4GbQaS9PVnz57VAeoJnPt7kjeatoyN8307YQWWA0NdJgymENEaxJODu3qCXRtZjSkNw1Fo/UMQrl+NYhZqyLQf2t0KPtiAYSVLccRQrCePsmFgWQgKQuH6Hdzifbi0L9tvRvUCOouQbeLMLKzJMq6DZwGT67GL5TJNbeEcHJhC5rDSzfce/HCkliu9TWM7Dma8DwgzwaDZXGYyXhiYxnd2dpI52yHU30G/L4xRuAbCFrT/HjCcRR9LgIGPvg0Uk4vNB2IAH5LAwJrdg7j8Ua7fZhKwQlyktXMu72Vq+hC0ZyHNNIP/sQC0/BMEVVuhSwG4D3Dqh7jG6aDoWAcr7S3PM+Euv4FzX+fbbkh/sTCwum1gYMzIV7L/GNd25coSR4mLHfKR/e+53e6LjZfCFI0PnALibhRS/xXXnkabXfleLT+qt0xnIgK/WYj9SzCZdwJUJV9MxuCZxcCRmGxmfdQUBsH082BQB7Tzv1kjwr5vrAzJ8Z58L74zLvtr0Hud8Z4FtY8GAy0W6ecOwdrEeA9tvIZ+OtNDiWJaGbTViL5uQ1/3AMP00fLBXJ1i4QPXETE0edScMSnkv68UU8BMa8bnEm8GmNshbNNprhkXcKc2cerGePonNW+WTKqdmk7B4s6VDzh3FANFoXoB+15arYn4Rwz4rMXplej7Kzj+DOj15cJgrvfPgIGzC2/jGpOR9diPpTNlnARMhTn4nIv9OtD5BT7bCgy2QvnA+Vpi4Hec6wCGZ3HL07h/t/WB4I9DwAbe3IdTdSBsOY6vBJiLcW6m8fiV3TDnqRpfatOMyVz+v5+3AeR3OOZrMVtwLTaR/6vIgmMSdi4VvxC3XY1ra3C+3KA/HYNmYOC6+R3Y1+P773HL0fTi6QQJmNkPJ2Lr6V1A0xXgwyXAMZ/JgIkjnQ9cbo6dxeuNOM\\/\\/ScAXLXPZeSgTHz4uAbMOng/HXE1ayocx+dJeptec8pDU/yGiyziN6yf50hJqCJerZPqnThMsYNY+y7EHQHsljqfzhTDY+Tic01i7dQa/Pc5/imX8Iy9OricyZdUTLGAD10C7h3zAJ/8tDstMdVQigw9cHtTNN0TyH5MZfOET2aH08S+6gH2yfbIVe7N/MgSfbOO5/b8AAwDCB5vdkkgX5QAAAABJRU5ErkJggg==\\');height:50px;width:50px;height: 30px;width: 30px;background-size: cover;background-position-x: 32px;;background-position: 32px;\"></div></a></li><li><a onclick=\"window.MI_logUsage(\\'share\\');\" href=\"https://twitter.com/intent/tweet?source={0}&text={1}: {0}\" target=\"_blank\" title=\"Tweet\"><div style=\"background-image: url(\\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJgAAAAxCAYAAAAm0WAHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NTc3MiwgMjAxNC8wMS8xMy0xOTo0NDowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjQxOTgzOUY2RjMxMjExRTQ4RDc1QkNENzc1ODE3OTkzIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjQxOTgzOUY3RjMxMjExRTQ4RDc1QkNENzc1ODE3OTkzIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NDE5ODM5RjRGMzEyMTFFNDhENzVCQ0Q3NzU4MTc5OTMiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NDE5ODM5RjVGMzEyMTFFNDhENzVCQ0Q3NzU4MTc5OTMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5SFpoiAAAe+klEQVR42uxdeXBd1Xn/3r5ptWTJki3bsrzbeMcOm9kNCRCghKWEpFkIkFCSIaShpO1MOmkzmTZJZ2hT2gYCTKCUBEiAYQlJiMHYGLzIeMEL3hfJkmWt7+nt9/b3O+9e6erpbZKeRP7gzly9d5d3zvc73/6dc69suq7LJ9sn23htTuvB1q1bh91gs9nUJwUx/Tt3fjeE1I5Pv9Pp9GiaVm232+fgegP2MlzzYI/gei/2E7j+Ea6fSSQScVwPsUmzLeun2ddoNyuN5rFJL/ofhgv0uHE+gHM+fDZgb8K1GuwB/hx7GNfasB9OJpNHcD6Iz5jD4YhiF3wfMjbmZu0/34axKQgb6TfbtY6b0Qb54MZxJe6bjWszsFfikg97HOf7sJ8y+HAauGM43497EtYxs46XFZOF50O2VatW5Raw0WwgshSdVbnd7ktcLtfl+Gzw+Xx+bAGPx1OFcyUgzIl74gASjEQiZ/v7+0PhcDgUi8WOx+PxN/D5Du7pRHPBQphQzI0DBQy1GOhG0H416L0In9WBQMAGDCX4Xg5m+XHdhvtCwNANDB2hUKgPO5XkEATrZXwewPU+MunjsBTo2wcs5aD3PNB7JXDMBP0VwFECPkzCuVIoAZU/ST5Eo9Eu8gF7GONPIVuPzzfQRjuwdheLLptVEkdiwQiGVgrE3+H1ei+cNGlSTXl5eYNpGXIJikXT9J6enqOdnZ1nIHBvg3FP4/Qh/LZvIiwY+p+OcxeB/i9DKeYDQ3lpaWnJSDBAuPq6u7v3dHV1HQGGV4HhDfyuA8zUJsKCUbBwOB0YbgGGSysrK6dWVFQ04rqrUAz87O3tPQ0+dEDgtkL4nkS7u4Dh7Fgt2IgFDJ/U5EUAdCcEal1NTc10AAtkIz4b49M3MKevvb39CIC+ju+PY4D2WYWjmAIG+ivw/XJguB8YzgGGMiiKjBUDLNq+tra2Hfj8FQTtLTCoc7wEjG1BuGcAw19CKW6ora2dDYtVNVYMoDsOPrSAD+vx/RGcasYemxABo0/HoF1fUlLyjbq6usUA5hurlUnvJ4ittbX1g76+vv/AAL6O893FFDC0uRAYvlVWVnbzlClTKoFFiowhCav8ITC8AUEjg45QboopYLRacHlr4f6+CQxroCRVxeYDaE8Cw0cQtJ/DfT6DMWsdjYA5vv/97w8ctLS0ZO0QoKbBvz8ETblv6tSp82C1XByMYmWhJtGwJG4wn8nBCpjqSQC3ly5zLAJmYczlaP9hMOX6+vp6H7RfxgGDHWNTCwwLOGbA0A2hbgEdyUIELB8taHMS4qu7Jk+e/O1p06adxxhrnPhgBwYma6uBoRF82IPvZ3P9FmM6OgEDgFno8IcNDQ13ANgkSDPdpIxHQM522T4sSyX6XIKYoA6JwA701TMGAbOj3RsgUD8BU5ZVV1ebMdi4YYAQ+MCgucBSB5ffDwzH0Gd8LAKGdmswJn8DBb8bit7kYKA3vnwQ8MFHPgDDAgjaDmBoK6qAoSP6+X+bPn365xBAuoplivMNMgcNlsCDvhfAXE8Bg7aNVMhMAYMFUcIFDHMQAGc18eOAwQkLMwPCVg9F6TRKG4nRCBj4MBmM/h6U/CtVVVXVRllo3DFwAx8E4zcLGBaDD1uAob1QAbPnkeI6gPpHaMxnwRjbRDAm3VQjvvDA6twEOh4CPVNMocm0Z8FwMX77I2BoRFvyMWBwQzE/hZj1TsRN5+PYWYhSWHdgKIOQ3gMG3gE+VNANZ8JgU78vwp6BD7DGgjG8CGP5E9Azu9AxyGXBAjCRd8EU3w2XwqKdbaKr/hYNouWkBjFt3jmCWtNsYPgvYFgCrZ9Q4UrD4ASGabFYzA9X02zU/AoSMP4WbulahCYPINutS7dcvMdhZ9nCpoQDCMdMM9tSlRp9aEBPS4atCR7FgXPvo+/+fBYslzZdgCzxHjAmkJ5tfhxCBjoqkWDe29XVtR1Cs6GAtLscv2W2uJrCNRGuPY+79CK5uA6pfysys382Sxj5SgewFnOA4X4IV2O6cFEIYglN3j0UleYTUekMaaKNESN/7oSALZnmlsvn+yXggQXVh/CBGebnwYf3cO6plBgWOFVkAVUPaf1baD7jh4JrM+PJINBhAz1zwKAHsB+CVrfkYg7inbWIG74EzRe4pqJiSHcjYoyylbcmKeY5IzMrAYarYMk2AsNLwJDIhQE0l+M390IwVwK/3YqBVqsjmJRfbw3J+gNhOYPv0bguYw33dcPVbjkakbMQ2C9+qlQJsm4IGQN/CHsF6H8QgrYNGD4ckYChESYn1yFeWeP3+9X8WrYBVma82MJkTt+k6QXSZGY0jAXWIptZi3ueRf96lsp0DTDcj3ClJBcGu0G/lqG/jK7DZinWGsJjM4Ifm6TaG0KLan+wbWIA/SyI3goGvYNT7Xms3gpgvga724qB3cSTurywPSTPbe+TKWVOuf3cEplR5VR0jMWG8fd7W+Pywo6gvLm3X5ZMdcuqmR5JaAMzF8IxhXwsAh9uxvG/gM7wSASsnloDU+jLpr0caFhmSeJPsZ0O23Y6UnFFUhueOoOuir6+vq8jlnkL2tOaScBw36XAcMmkSZNy9kX3wnFzoz/2m0vITOE6dCYmGw9F5MOWuHT1J0GnTaZWOGXldLec1+SVUo9djnclZPPhiFT67bKm0SvlPru1bQ8swHLEk+vAoGezlS44FQcMrHdNS3ftDtC792RcNoOOxmqX3HdpuSyod4vLXoTxR9uL6hNyuCMu+07HZXdLVM5t9AwTfo4t+PA17M9hXPYUJGCsDeHmCyGhMwFuWNxlWq7jZxPyxt6wbD8Wld6INqDBY/f9CBTBrEvne+XCJp/4XDZJ6kOBwe1xEvocMGcZTrVmyNrKYb2+AK23cfonU9zFGOODk1F5ZkufnA3q8hcr/HLlAr/qP5HBk/J8BM7s1V1BefGDfmnvTSrFshtZ10kI1DaMxe8/DMu0SofsAPM7Q0l1/Uwf3Mx5JaJrKYxUEtDPuuI1wPAKmunKEos1IkxZg92ZiQ9toKEHY3/D8oAsbXAb5Ri9KC6kMmCX2TUu2XkyJn1hfRhzSY/b7SaOWijKlTg+gP7jeQUM5o6rB26B+SvJlHGRMc0nYvLohl45BAn3QWUcNsOuFgFbBPvulpjsPhWT/dCev4L/D3iZpg+9D66vFIHyTYhlNkApgmnNzEDMdQnT6kwYyBwqxfPbg7LpYFS8EOLH3ukTN7BdPM+rrGciMZiLOVQgLbg/JP/7fhDfdZlb65KL53plXo0b8V1KwDZ8FFEM2Qu6fW4b3JZDWnuSsr8tBiFOSoV/iBVzAEMTrPB8uM3NVldv0OwChhtwz+SMma9uuHVmdi6Oj54xrBhWMrCLsrgDAqPTS+hDPAUvJSCoVCoxs9Is2TfG2NHT03ML3P3/cdlPXgFDI5Oh/RdwqUom4k73poLK/W1xaLxPPrPYJ1PKnUOC2bEEzgS2A0wiM1/bHZZaxBY3nxtQA2hlAOhzQhHWxePxKq7JspKJ61eBObglkLEfFwZ456moHDyTUBnSjcsC8v7RqDz8Zq/0RjW5ArjK6NKSqcGny9gE4fltc0gF0Z9Z7Jfb15RIbaljICBeOMUl58/yyvr9ETkIxVuDmKWtNyGPbQzKYfSzCwpzyXyfam8gxS0vn9fe3n4NlKQZzIlYvQgwBIDhWk4D5YqVVPyoFTb2KUXRlVuPJwdDkQCUgUqWyaOY/WSLEWHBbKBzBZUae34Bg3AthQtymstV0v0+XeIe+OR6CNW6hT5ZMsOT0qZkMSZZsaOPGmg+0+1H3uqV5uNRuXiORyaDmUO0DDdDwLwwzyz4HbM0w4WClzAItS7ISy8tH4OL7+7XEL845dolfhVj/DsEjH0ebI/L9UsD0gBX5/c5pA+u7l3EOi3dSbkMrvtWCHxdhSNl5XQj6wLtFNZPn+MDQ3xyoisJoY1AQRyI2eJyFP2l0kpricFeBuaQfpdhvK34piJrrMjEh9FsFK6+qC6v7+qXV7C3wlD43HbEiDa5CS523UK/uJ3DY9789TI7a2M6+HAuaN4ixqR+riB/NRfZZTTLGKDWngTciy4h+Iyn3gsqjVyO4JZmN54YfYmP40jLchZa/4e9EcQ5IaVdFDS6GbqbRFpxkYsa4SZXI6Z5yyy84rsXTFuaLfYytxBcZBT0VpU41MCumOGW+68oV5je3BeW945EYaG9ctFsr7LadHulPpucN8sj06ocEosOTW5UbGUwMpFMTY+safSoOKkzZJeZyO50y4S0pXA5Gcwp4wpTy6ICMm4FrJffPM4UJw2Otm5pN4viYoA3HwrLk5uDKuFYWOdW3iIU11Q2qumGsuiD5Qizfd1oONt4AoMXhmkNXP0TOAzms2CLYBlc2dZh0bTGIVQcsAPQ9B/9rkduWxWAW/EiMMTAx0cuZE57ijH7WmPyXHM/3ExUKsDMagSaHAQKbqYNljYAOhdwKoZhg3GaaSOzL8m6lgz88rqYOUKroSwUCBK9qN4p37myTF7bE5ZNsFi/aQ7Lb3b0K4acDWoyY5JDWS7+PhtGWoBU9qvJq3Dx247H5Y41AbhMt7J4GZjDhKQJse8pi4A58H0+VwMXKyuPQiGOdSakP6aDHp98bkUA2DVV5yrxpDLoQes1Mg4y2IdCLGQhOa+A4aZZLEpmnlJRFSrFkE8j9uLl57b3yyNv9ykXcP0yv8ytcSqNKNTUup02FddsOsyMLqSElvELtX/rsZi09CQGNHRYwgE6yRyuozenLMAcLvOxZ8eQKkVUw3KVeu1ytCOhCpR15XYlAHQZn18dkAtmuWXzkZiKNZkxEnOJx64SAdGyazOVpT8m8hqyyfdhBW9Y6pdrMVZOhwyJv0wrDCHiOvkmtPeODK4Zc2Jv4pr6rLMPlqqunsWC8SsTMKfTZrhyZODgNt22B0LlQYJWXWJXcZlpwcw2rH3qup7TgnGs+eyFoeh562BVrNTmnABnDQTW6sqFXqlBbESr89LOsBKyW1b65VNwIy4giyf1nPGWB8AZ17y+h5YiDMuoyXVLfHIrtCsA5m8/HsupTEZJpRq7w1L9ruVxrtiFt/bHNDWw/RDuF0F/NWLpmlK7UaKghXapNJ1aTlynulmWsKm6VkLLPVFNHHTtTZNdKgli9phtLDDWXFlbw3leE4OBpzofHwqJu8KwWIehRPQ8XSFNYSeWw1DkCK7RelWBl1SA0SZpxlgzrHIVkkW6s64tslBgjtdl8z1K+1/6ICx/RAb18J/6YIqTcpUSPjvinMGpB7MJh+ESKUCsKW04GEUbDrlxaYnKTMuhVafOJgsF5pWhK0LKUgV1W04BO92jSU9YlwV1LhVbMbas9LvUJC9pZBhAprAAuwAZ4uJ612CIkMy9/opuPQjBpBtm0TWhYihbNoFkMdtnrI5IGud4cyDnGq8ChIG0H+qOy49/36dcIEszxMdaHecuKfSrEHt+boU/pTijFDCDTpvBi7wWTDdXR2aqvQwRNuzUgnm1Lrl7rUPqEZ88/X6\\/\\/PK9kMrSbljqk8VTXco1mN7BBatFq7D+QFTFN0chSLMnO+VrF5XIKiQLnI5IJvShZl8yL9E1HxFLx2usuc++ckIXpbkeIKfL4ACrgq6mDyvnaSpDTglWphmDTPFOBFaRicH0SqcS3lSJJesaL7al57iWsS8zGB8I+DO4SM2oj3qAzS5G/Qs301oRuypT2AdDn3QXaY2mc61CyTfHmy5g0Uzzdrkmrsx5vGAkRXwSVusP+yJyEqn6ZfM8CJ5dSkOoMSdhnpmhvXUgBvekpSrnyZSgaiMMLw1gYWiQZtGm7tSl7KAZHzZCqJlB7mtLyHEEv+fDrUcThc1H5qpLcWOdie5odaNDJRKRHOOPsSb9fB5Rs1gsUhEc6+Q8kyN6hgeuKMV3kRcRxrwJL3PFfJ9cPNej3CdrYH53brdfCB8gfFp6qSWbgJ1F0Dw1mwXTDYdnBn4UEPr0p97rV8Q3Iru8cblP1X5e2R2Vx99NyHSk9XQVtBDtfRqELCFN1S65a3lATnQl4CYj8rO3+qQDTPn0Io/YHdYAdlB70unhxDHOdZiuxdhO4RiXEp5sWsfBXoyMsRF0UQleQPxXD0aw7hVL6mOIRVIxDyeKWbicCyFOJHOvP4vH43zouAPuXrNkkUk+m2jgy27BRB9mXay3MoxhnNs02aESqXJvyv1PRgjSUO2QZCylUPQaVlnW9YEOhpRBsuEw6AwWNFXEJ5ZjsdiSfOumbEbB8gAG88nNIVilmIpnvnp+iayc7kJ84wYT3bLlWCoTY7bmQk91yGDWLSxRvn9BrVOCUU1lZ89s6Zcn3w3id0m5bZU/tdjNlnv5DuikBTjEOWvLpZPUpmg0qmb8syUpLIMwAGe8yFiQmfBnkWAsgUtn/W00QkYX1BVKygbEN9WIPxfVOYdljukY+PAxMVjdJBWE54AhHggEXGOxYsQaBdtpnc0QQK2KwHE0UZxlChxr0HwcAhYrZC5ydyQSuTbjsl5LKMH0t/lYXH6+MSh7WlKlhS+fnypTROD6/DC9a2e7laXoDSNjM6YmGOtUBexqro7BMj9vXOZV2vX45n55dms/rIDIJXPdMiBjWSwYmBODtvOJo6jFRfbgHJ+8Ls2lJJxbpCJMRdx4HFasq19TlX1+MnUXfWTuWtWRgHHnqbicgNBevcgLF2xTFizXBgwY8uQxa80O1owW+QCfuq6srKzIVM/T9KGBWK5C60DxNBWh5i07DJQp0mOyLPdjrGl19+B6uBAXuQWgdfOJkvRGecQ4i1pKd3cAMcxVC7xy+7l+aZjkUFqhG1NHtPi0FFUB54AxMk0yA+FUPKQLQgBZt8AjpRCyRzemSh5MrZkMpJYAZ9Z+AsMnH0BIWgQsAtqbgaEhG4bBbFaXOTUO+eCUDZZUpB7WlcJvzzTfkbdYbJMzQU1+i2yatTTGnvmsIOmCe+k03Et6XLODlsHE8Oe6kT5DwLZAMfozKl8a6A8Aupc/ylg9hwXyu+yy9XhcWnqScstKn9x5AYUrVbAbmJowxovBI4UuYuyxZMrvWx8w4M9soOKi2R759uUlMhtWcA9c7xFkorR43PW0tJj0gc4OfD+YRiJBvoJrejYMZo2Ifa+b75U5iFE4pfPs9rDK/sSWecVqVuFypDC+sjuirOHaOR4V32l56mWwUP2gc2P6unZDIfhiksNQlD9b4TL5gDiSL1N5L1s2nG7BOgD6j729vbcwhrH+htXsmZWs/tqktVeT21ZyysEnlbBSsYQ+ptUUKnEF05c3kByfPLIhJPtOp+Ygp1Zwykgb0j7oI7AXQd+ZdMMA4OvhdoJ9fX2l6RhMd0Y3zCyrxCPIqjzS2qOpeJFTJ5fNc8vKBrfUoV9bAcLFrJRZMS3vPMSV1yz2FrR0pgcbxvoVaH44A/P6cO03wLkUGBxZyxTGilnl8vK4SEmbu8zlIjV9cA2YnqNMgTGmom8ChmMFlSlwYwia8zyU6xYG0VyPPxi36LKswaUCdGor59nKfVz3ZBdt5FNYGQugyaRNdiGmO9mlKcE6f5YLbtY+JCCFYFH7MQb6y+lm2RiEVmB4PRQK3ZyOIbXkSIMwRGUfkg9mWcz8QrHUylYG/a8i+w3h3LUQlDKvLaOgcOxdYDtjy42HYvKLTf0yyW+XL6724dOWmt/MsYEuWtiDoPdguns0jhPA8Cos2IPAyzV6GRXFLLuYa+Y1vVjWKf9yHYMPdI/P53ri25lBe97hGiUo2HI+MDGwDBkfrJvctNyrhG0rsq+nt4SVYGWLlUa06YPpPoX22nM8EDD3gOs1Bx90kUF/wvftGaZelGKB5sdwz024127FQIFaD2vz8q6IKrFU+FMumJaSrn9erUPOQ5+z4Ta5uiOdYTbDatG2dSJ5eXM/51DDShDvutCvLFhCyz0WxNDd3c1XVz2e7QFW476DuOcl3Ht7TU3NsCC/BmNEBW8+GZfVjW6ZVZVaGZLeOcs+g0XVVIXfxvqXnrk8wGp/byQpp7oT6t4y7/CsmhjoRRAnHsfhG0YdrGABa4FU/gwN/E9JSYmd728wGcSK9pRSm9xzoU+aT7hkd2tqhr4YT64bz0go4Vo1wyVN1Y4hD2OYPh90xeECH8v1CDvu3QYMr+De60pLS8VcvmOT1FQPk4wyn8j8WlhkZJOzqp3YHcoqMXZin0kzqzPW4qeWU3PBnq5mIF7eFZUtULKZlU758nleWTrNOWTWIlfcEgwG94O+N1n/ynFvL+55FBg+y1dKDeWDLrNB7/kQrF83h+WRt0Jy1UKPGrt0Z8KMn5a2I0j8NlX7238iJuFEZstMvHtPJ2TbibjUBFLlloQ2GKJY+ED3+HNgOJLTGlpN77Zt2wYmjXH+ibKysqvr6uqGLX2xWwL58djMLNkKiv23tbVR+5/H8b043ZZlftLcLsIAvMQnoadMmTIgJKzeP9eccvEUtIUYwAua3DIPGSWX5tBKp6ZSbErAqVRh3McFe5ycf/9YXK20YN3rXM7lLfPITFiPpJ57wtjE0Nra2gfm3IvjpwoILPhik38qLy//FjFYF1Gm5hd1eXFnRDYcjCGL1XPW3TTDhdptg+41432SUjIul6IXuRkeS2ymARjCh9249SaWVMzf5n190/bt263xzOVo8Jnq6urJfIIkW1A4Ho+tZXErcubMGVrXW+nGC2jKD0v3d3Cb36ObrKysTD1fCSFrC2qy/qOYbIewHOnkuqikWr7TVMU5VbuK+9TafE5cRzWl/UdgtViK4MDThTI+ZObrdw+fq8wmYF1dXcTwNDA8gOO2bOWLtOMFwPBCVVXVfPPpdKuiU2h2tyRUDY70JbQsPDEy43zJmGbMACyd6lQYXU7bEEU3+NCLsb0Hp56x/javgFksGDcfGvkm3MsPEAO46Gom+tF78/F5uBRqTT9ikgf5KgAZXGCYb+K1AfsTCPQvq62tVc9VcvLZbtPVkiJOc+04lZCP2hMqM+4M6WoRYiSRWtNGYfTCopVxWUuJXSUenIFYhmy30mc3VoOOCMNuxC2fhyXaOcKhuMnpdPIVCNXp7zOzyeDDHPYiajvDASYrusU7IHGS06dPM/b6CfjwA9DQk0/AnDm0J4xGfwGmzoHEfpUdmA9STISQmYwhKPSfBB2PgoZnOJUygjZO4Df347dPtbe3n8P2iIHkMzOtZTJR6YGguFWpoq1Pk+5wqhCsBAwxGWclWDDmNFdNqU0FwbECp1qsGNA/p+G+OwrhYhuvIWv7KcbhH7jExypkulFvTGj6uPKBGSMwMMHiE+kPpwtXQTFYpjccYuODnz+FJbuZrobgxtuSWbW+o6ODQeUvcfxdyfLkSq52jPeArcX+nwiUF/HdYOkYzBeIOGzD40sz/afAJfXClcuKAYJxClr/XUNBRjtwfKvO34MP94EP7onkgylcwMDnH+5Gn/sz3T+qNxyyrolGNyNgnhwOh5cYS31lvN4GbQaS9PVnz57VAeoJnPt7kjeatoyN8307YQWWA0NdJgymENEaxJODu3qCXRtZjSkNw1Fo/UMQrl+NYhZqyLQf2t0KPtiAYSVLccRQrCePsmFgWQgKQuH6Hdzifbi0L9tvRvUCOouQbeLMLKzJMq6DZwGT67GL5TJNbeEcHJhC5rDSzfce/HCkliu9TWM7Dma8DwgzwaDZXGYyXhiYxnd2dpI52yHU30G/L4xRuAbCFrT/HjCcRR9LgIGPvg0Uk4vNB2IAH5LAwJrdg7j8Ua7fZhKwQlyktXMu72Vq+hC0ZyHNNIP/sQC0/BMEVVuhSwG4D3Dqh7jG6aDoWAcr7S3PM+Euv4FzX+fbbkh/sTCwum1gYMzIV7L/GNd25coSR4mLHfKR/e+53e6LjZfCFI0PnALibhRS/xXXnkabXfleLT+qt0xnIgK/WYj9SzCZdwJUJV9MxuCZxcCRmGxmfdQUBsH082BQB7Tzv1kjwr5vrAzJ8Z58L74zLvtr0Hud8Z4FtY8GAy0W6ecOwdrEeA9tvIZ+OtNDiWJaGbTViL5uQ1/3AMP00fLBXJ1i4QPXETE0edScMSnkv68UU8BMa8bnEm8GmNshbNNprhkXcKc2cerGePonNW+WTKqdmk7B4s6VDzh3FANFoXoB+15arYn4Rwz4rMXplej7Kzj+DOj15cJgrvfPgIGzC2/jGpOR9diPpTNlnARMhTn4nIv9OtD5BT7bCgy2QvnA+Vpi4Hec6wCGZ3HL07h/t/WB4I9DwAbe3IdTdSBsOY6vBJiLcW6m8fiV3TDnqRpfatOMyVz+v5+3AeR3OOZrMVtwLTaR/6vIgmMSdi4VvxC3XY1ra3C+3KA/HYNmYOC6+R3Y1+P773HL0fTi6QQJmNkPJ2Lr6V1A0xXgwyXAMZ/JgIkjnQ9cbo6dxeuNOM//ScAXLXPZeSgTHz4uAbMOng/HXE1ayocx+dJeptec8pDU/yGiyziN6yf50hJqCJerZPqnThMsYNY+y7EHQHsljqfzhTDY+Tic01i7dQa/Pc5/imX8Iy9OricyZdUTLGAD10C7h3zAJ/8tDstMdVQigw9cHtTNN0TyH5MZfOET2aH08S+6gH2yfbIVe7N/MgSfbOO5/b8AAwDCB5vdkkgX5QAAAABJRU5ErkJggg==\\');height:50px;width:50px;height: 30px;width: 30px;background-size: cover;background-position-x: 62px;;background-position: 62px;\"></div></a></li><li style=\"display:none;\"><a onclick=\"window.MI_logUsage(\\'share\\');\" href=\"http://pinterest.com/pin/create/button/?url={0}&description={2}\" target=\"_blank\" title=\"Pin it\"><img onload=\"this.style.opacity=1;this.style.top=0;\" src=\"//d34p6saz4aff9q.cloudfront.net/images/footer/Pinterest.png\" style=\"opacity:0\"></a></li><li><a onclick=\"window.MI_logUsage(\\'share\\');\" href=\"https://plus.google.com/share?url={0}\" target=\"_blank\" title=\"Share on Google+\"><div style=\"background-image: url(\\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAXCAYAAADgKtSgAAAD4klEQVRIDY1VzW8bVRD/7Xq9teOPtElDHdlupSIFKEqUhH5AI7WNBCeQuHAqlEPpASHgyA3hf4ALHwckGoFAHBGIA5zapoiCEUpCEiGFUlHJTkCyiePEXjter5f5rf2CWTuBkcZvPB+/eW/evFkNB9DKysrpVqt1NRgMpoWPmqYZbzQa27ZtF4Vzuq7PjY+P/3QARK9pYWHh4urq6s2trS2r2Wy6kqCHqaedfsvLyxd7UfpolpaW5jY3N7ccx3H/L5dKpS2Je0/gtD6QnkpbXFyctyzLVqDcHWWu/8XVatVmfF9wZqaDkKuYgJQVsJL3szOeJ1cJvGOwZslk8stYLDaoaRpc120fpSMXKi6+Xqnim18sWLstDEUCuDQWxotPROH3LwttbGw8OzExMa8TRW49Q2DKCljJ9wpNfPhtGU+eCuOtZ44gFtLx+MmQB6x8uJIYG4/HB4nH/zrbLZFInKOhH3/24w6OxXWMCo89YGD2oRBurdWwXXMY37MZ6ohHXF0u7KVIJBKm0k8szh9lB9v1dpmY/NSoCdtxhQFpUQ/890IDdrPlhVNHPL4P3TCMlKpbz87FcSIZxJ17dayXbC94s+rgsROHcHjgn677JFv1EhJYUSAQSBt8eQTdjy6fjcBquPjo+yoSUppyzcXLF6KsB37O28je30Wu1MT17yowDQ3XZiIeFHF1Pmm1Y2q7E1GOmBpen43itdkYbqzVpTuAqNn2G4poePiYgXBQw5isjyQML55xUpG4wVmhAP2rSrZebuFPqX3ysIHbd+vSijounxmQ/wGPF+UEMydNhCSJInkb24Y8iKJS+Ffe0adZC6zkmeMmXrkQwY1fd/HFkoUTR3TMPChHELp2fgBmgN3WPhHvkLiGdEuOF0GFnz7+wcLquo23nxvcGxpXzoZR3HGwLHoFfshoR6qTE4+40u/6XKVSqdHg55truwgEJGnHRgj6JAYDOD7Urq/SdcfKGKgRV+c8LhaLWeWkVjq/8VQUf1UcvHPLwt2C43XF7d8aqNstzI4F6er1uid0/RQKhSxxvecvQBnZfdnv/OhoAJmnY9ipO3jzqx28P1+FIRHPnw4jJKVQfc1VMXGk3hli7RWa0yyVSl2R/uxUkOZ/E0+jHhwtSlb3JaDNfD7/weTk5KuevTtcvkDz6XT6vPS+l8AP1u3rlwmcy+XuTE9PXxKb9yr3dt5x5gfj3ZGRkRdkPuyNX7Wz/ZLJBZalzp9PTU1d7U7qB/dsnW9iZnh4+FwoFArLzXfHeDITyVerJp9ENkOG89vv1BdcOXFscmrKEEoJH+WT5ssTXVE4L7rrB339/wYDDxkPEF5efgAAAABJRU5ErkJggg==\\'); background-size: 29px;width:30px;height:30px;background-repeat: no-repeat;\"></div></a></li></ul></div>',\n callForActions: '<tr><td><div id=\"cfa\" style=\"white-space:nowrap;border-top: solid 1px #c5c5c5 !important;padding-left:0;\"><div onclick=\"alert(\\'call to add to favorites\\')\" style=\"cursor:pointer;border-radius: 7px;height: 27px;width: 187px;margin:5px;MARGIN-LEFT:0;display: inline-block;text-align: center;box-shadow: inset 0 -9px 37px -10px silver;vertical-align: middle;padding-top: 8px;border: 1px solid rgba(0,0,0,0.2);color: grey;\">Add to favorites</div><div onclick=\"alert(\\'call to book\\')\" style=\"cursor:pointer;border-radius: 7px;height: 27px;width: 187px;margin:5px;display: inline-block;text-align: center;box-shadow: inset 0 -9px 37px -10px rgb(3, 179, 12);vertical-align: middle;padding-top: 8px;border: 1px solid rgba(0,0,0,0.2);color: white;margin-left: 1px;background-color: rgb(161, 218, 101);\">BOOK</div></div></td></tr>'\n },\n header: {\n header: '<table align=\"left\" class=\"mi_reset mi_greenredtitle\"><tr><td class=\"mi_header_caption@@@gaugeOrientation\" style=\"padding:0 !important;\">' +\n '<div class=\"mi_drag_area\" style=\"position: absolute;width: 100%;height:125px;left:0;z-index: 2\"></div>' +\n '<div class=\"mi_green_close@@@gaugeOrientation\" onclick=\"jQuery.MidasInsight.hidePanel(\\'@@@kfid\\');\" style=\"z-index:3;\"></div>'\n // score gauge\n +\n '<div class=\"mi_gradselectroot @@@gaugeOrientation\" id=\"mi_gradselectroot_@@@kfid\" data-score=\"@@@grade\" style=\"left:123px;top:-48px;\"><div class=\"mi_gradeselect\" id=\"mi_gradeselect_@@@kfid\"></div></div>' +\n '<div class=\"mi_title\" style=\"@@@titleOrientation;margin-top:40px;width:240px;float: left;height:38px\" >@@@displayText</div>' +\n '<div style=\"float:left !important;\" class=\"mi_subtitle\" >@@@count</div>' +\n '<div class=\"mi_preview_images\" style=\"z-index:3;width: 100px;height: 75px;border: 1px solid #ababab;position: absolute;right: 18px;top: 33px;padding: 1px 3px 3px 1px;cursor: pointer; cursor: hand;\" onclick=\"jQuery.MidasInsight.MI_GetPhotos(\\'@@@kfid\\',false);\"><div style=\"border: 1px solid #ababab;width:100%;height:100%;background-image:url(@@@previewimgsrc); background-size: cover;\"></div></div>'\n\n // tools tabs\n +\n '<div style=\"clear:both;height:0px;margin-bottom:0px;border-top:0px solid #DBDBDB!important;\"></div>' +\n '</td></tr>',\n footer: '</table>'\n }\n },\n scrollables: {\n header: '<div style=\"clear:both;height: px;margin-bottom:0px;border-top:1px solid #DBDBDB\"></div><div id=\"mipct_scroll_@@@kfid\" tabindex=\"-1\" style=\"heightdummy:0;outline:none;max-height:auto;\" class=\"mi_scroll\">' +\n '<table align=\"left\" id=\"mipct_tbldefault_@@@kfid\" class=\"mi_results mi_scrolledcontent\">',\n footer: '</table></div>'\n },\n socialItem: {\n timelineItem: '<div class=\"mi_timeline\">@@@fullYear<br/>@@@month<br/>@@@date</div>',\n nonTimelineItem: '<img onerror=\"jQuery.MidasInsight.HandleMissingImage(\\'avatar\\',this)\" src=\"@@@itemImageURL\" valign=\"top\" class=\"mi_resultimage\">',\n youtubeItem: '<div style=\"position:relative;\"><div class=\\\"MI_SourceIcon MI_@@@sourceSite\\\" mi_data-tooltip=\\\"@@@sourceSite\\\"></div><table align=\"left\" class=\"mi_resultcontainer\" style=\"direction:ltr!important;cursor:default;\"><tr><td rowspan=\"4\" valign=\"top\" style=\"padding-right:15px;padding-left:3px;width: 65px;\"><div style=\"position:relative;height: 100%;display: block;\">' +\n '@@@sourceAvatar' +\n '</div></td><th style=\"vertical-align: middle;\" align=\"left\"><div class=\"mi_resultpublisher\">@@@itemPublisher<span class=\"mi_resulttimeago\">@@@timeAgo' +\n '</div></span></th></tr><tr><td style=\"padding-right:30px;\">' +\n '</td></tr><tr><td colspan=\"2\"><div style=\"padding-right:10px;overflow:hidden;position:relative;max-width: 275px;\"><img src=\"https://i.ytimg.com/vi/@@@sourceURL/mqdefault.jpg\" style=\"max-width: @@@itemWidth ;min-width:185px;margin-top: 15px;margin-bottom: 15px;box-shadow: 0px 0 10px 4px #eee;border-radius: 5px;display:inline;\"/><img src=\"//d34p6saz4aff9q.cloudfront.net/images/playvideow.png\" style=\"position:absolute;cursor: pointer;left: 50%!important;margin-top: 20%;display:inline;margin-left: -30px;\" onclick=\"window.MI_logUsage(\\'play_video\\',\\'@@@baseid\\');@@@click\" onerror=\"this.style.display=\\'none\\';\"/></div>' +\n '</div></td></tr></table></div>',\n lightboxYoutubeItem: '<div style=\"position:relative;\"><div class=\\\"MI_SourceIcon MI_@@@sourceSite\\\" mi_data-tooltip=\\\"@@@sourceSite\\\"></div><table align=\"left\" class=\"mi_resultcontainer\" style=\"direction:ltr!important;cursor:default;\"><tr><td rowspan=\"4\" valign=\"top\" style=\"padding-right:15px;padding-left:3px;width: 65px;\"><div style=\"position:relative;height: 100%;display: block;\">' +\n '@@@sourceAvatar' +\n '</div></td><th style=\"vertical-align: middle;\" align=\"left\"><div class=\"mi_resultpublisher\" style=\"color:#838383;\">@@@itemPublisher<span class=\"mi_resulttimeago\" itemDate=\"@@@itemDate\">@@@timeAgo' +\n '</span></div></th></tr><tr><td style=\"padding-right:30px;\"></td></tr>' +\n '<tr><td colspan=\"2\" onclick=\"@@@click\" style=\"cursor: pointer; cursor: hand;\"><div style=\"padding-right:10px;overflow:hidden;position:relative;max-width: 275px;\"><div id=\"#mi_image_lightbox_@@@ksid\" onclick=\" jQuery(mi_image_lightbox_@@@ksid).fadeIn();\"><img src=\"https://i.ytimg.com/vi/@@@sourceURL/mqdefault.jpg\" style=\"max-width: @@@itemWidth ;min-width:185px;margin-top: 15px;margin-bottom: 15px;box-shadow: 0px 0 10px 4px #eee;float: right;border-radius: 5px;display:inline;\"/><img src=\"//d34p6saz4aff9q.cloudfront.net/images/playvideow.png\" style=\"position:absolute;cursor: pointer;left: 50%!important;margin-top: 20%;display:inline;margin-left: -30px;\" onclick=\"window.MI_logUsage(\\'play_video\\',\\'@@@baseid\\');@@@click\" onerror=\"this.style.display=\\'none\\';\"/></div><div class=\"mi_lightbox\" id=\"mi_image_lightbox_@@@ksid\" onclick=\"jQuery.MidasInsight.StopYoutubeVideo(jQuery(\\'#mi_image_lightbox_@@@ksid iframe\\')[0]);jQuery(this).fadeOut();\"><iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/@@@youtubeid?enablejsapi=1\" frameborder=\"0\" allowfullscreen></iframe></a></div>' +\n '</td></tr></table></div>',\n lightboxVimeoItem: '<div style=\"position:relative;\"><div class=\\\"MI_SourceIcon MI_@@@sourceSite\\\" mi_data-tooltip=\\\"@@@sourceSite\\\"></div><table align=\"left\" class=\"mi_resultcontainer\" style=\"direction:ltr!important;cursor:default;\"><tr><td rowspan=\"4\" valign=\"top\" style=\"padding-right:15px;padding-left:3px;width: 65px;\"><div style=\"position:relative;height: 100%;display: block;\">' +\n '@@@sourceAvatar' +\n '</div></td><th style=\"vertical-align: middle;\" align=\"left\"><div class=\"mi_resultpublisher\" style=\"color:#838383;\">@@@itemPublisher<span class=\"mi_resulttimeago\" itemDate=\"@@@itemDate\">@@@timeAgo' +\n '</span></div></th></tr><tr><td style=\"padding-right:30px;\"></td></tr>' +\n '<tr><td colspan=\"2\" onclick=\"@@@click\" style=\"cursor: pointer; cursor: hand;\"><div style=\"padding-right:10px;overflow:hidden;position:relative;max-width: 275px;\"><div id=\"#mi_image_lightbox_@@@ksid\" onclick=\" jQuery(mi_image_lightbox_@@@ksid).fadeIn();jQuery(\\'#mi_iframe_lightbox_@@@ksid\\').attr(\\'src\\',jQuery(\\'#mi_iframe_lightbox_@@@ksid\\').attr(\\'data-src\\'));\"><img src=\"@@@itemContentImageURL\" style=\"max-width: @@@itemWidth ;min-width:185px;margin-top: 15px;margin-bottom: 15px;nbox-shadow: 0px 0 10px 4px #eee;float: right!important;border-radius: 2px;display:inline;\"/><img src=\"//d34p6saz4aff9q.cloudfront.net/images/playvideow.png\" style=\"position:absolute;cursor: pointer;left: 50%!important;margin-top: 20%;display:inline;margin-left: -30px;\" nonclick=\"window.MI_logUsage(\\'play_video\\',\\'@@@baseid\\');@@@click\" onerror=\"this.style.display=\\'none\\';\"/></div><div class=\"mi_lightbox\" id=\"mi_image_lightbox_@@@ksid\" onclick=\"jQuery(\\'#mi_iframe_lightbox_@@@ksid\\').attr(\\'src\\',\\'\\');jQuery(this).fadeOut();\"><iframe id=\"mi_iframe_lightbox_@@@ksid\" data-src=\"@@@sourceURL?autoplay=1&title=0&byline=0&portrait=0\" width=\"500\" height=\"281\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></a></div>' +\n '</td></tr></table></div>',\n normalItem: '<div style=\"position:relative;\">@@@metaicon<table align=\"left\" class=\"mi_resultcontainer\" @@@cond onclick=\"@@@click\"><tr><td rowspan=\"4\" valign=\"top\" style=\"padding-right:15px;padding-left:3px;width: 65px;\"><div style=\"position:relative;height: 100%;display:block;\">' +\n '@@@item' +\n '</div></td><th style=\"vertical-align: middle;\" align=\"left\"><div class=\"mi_resultpublisher\">@@@itempublisher<span class=\"mi_resulttimeago\"> @@@timeago' +\n '</div></span></th></tr><tr><td style=\"padding-right:30px;\"><div class=\"mi_resulttext\">@@@itemtext',\n instagramItem: '<div style=\"position:relative;\">@@@metaicon<table align=\"left\" class=\"mi_resultcontainer\" @@@cond onclick=\"@@@click\"><tr><td rowspan=\"4\" valign=\"top\" style=\"padding-right:15px;padding-left:3px;width: 65px;\"><div style=\"position:relative;height: 100%;display:block;\">' +\n '@@@item' +\n '</div></td><th style=\"vertical-align: middle;\" align=\"left\"><div class=\"mi_resultpublisher\" style=\"color:#838383;\">@@@itempublisher<span class=\"mi_resulttimeago\"> @@@timeago' +\n '</div></span></th></tr><tr><td style=\"padding-right:30px;\"><div class=\"mi_resulttext\">',\n itemContentImage: '</td></tr><tr><td colspan=\"2\"><div style=\"padding-right:10px;overflow:hidden;\"><img onload=\"if (!jQuery.MidasInsight.imageIsGood(this)) jQuery.MidasInsight.HandleMissingImage(\\'preview\\',this);\" onerror=\"jQuery.MidasInsight.HandleMissingImage(\\'preview\\',this);\" src=\"@@@itemcontentimage\" style=\"max-width: 275px;margin-top: 0px;margin-bottom: 15px;box-shadow: 0px 0 10px 4px #eee;float: right;border-radius: 5px;\"/></div>',\n lightboxContentImage: '</td></tr><tr><td colspan=\"2\"><div style=\"padding-right:10px;overflow:hidden;\"><div id=\"#mi_image_lightbox_@@@ksid\" onclick=\" jQuery(mi_image_lightbox_@@@ksid).fadeIn();\"><img src=\"@@@itemcontentimage\" style=\"max-width: 275px;margin-top: 0px;margin-bottom: 15px;box-shadow: 0px 0 10px 4px #eee;float: right;border-radius: 5px;\"></div><div class=\"mi_lightbox\" id=\"mi_image_lightbox_@@@ksid\" onclick=\"jQuery(this).fadeOut();\"><img src=\"@@@itemcontentimage\" style=\"nbox-shadow: 0px 0 10px 4px #eee;border-radius: 5px;\" onload=\"jQuery(this).css(\\'position\\', \\'relative\\').css(\\'top\\',\\'50%\\').css(\\'margin-top\\',((this.height/2)*-1)+ \\'px\\').css(\\'top\\',\\'50%\\',\\'!important\\');\"/></div></div>'\n }\n },\n RASTA: {\n panelLayout: {\n header: [\"tabs\", \"stars\"],\n content: [\"photos\", \"tags\", \"mentions\"],\n footer: [\"share\"]\n },\n panel: {\n videoholder: '<div id=\"mi_videoholder_@@@baseid\" class=\"mi_singlevideocontainer mi_closeTopLeft\" onclick=\"jQuery.MidasInsight.MI_GetPhotos(\\'@@@baseid\\',false)\" style=\"margin-top: 74px;background-position: 10px 18px;\"><div class=\"mi_singlevideo\"></div></div>',\n containerHtml: '<div style=\"padding:0px;margin-top:25px;border: 1px solid #ccc;\" class=\"mi_panelBackground mikfpanel mi_rasta\" id=\"cpcnt_@@@kfid\" style=\"direction: ltr;margin-top: 20px;@@@layout\"></div>',\n tabs: '<tr><td><div class=\"MI_tabs@@@orientation\" style=\"margin-left:0px !important;position:relative;z-index:30;box-shadow:none;left:0px;padding-top: 0 !important;\">@@@tabs</div></td></tr>',\n gauge: '<div class=\"mi_gradeselectgradbg\"></div><div class=\"mi_gradeselectmasknerrow' + (window.MI_defaults.RTL == 'true' ? ' mi_gradeselectmasknerrow_right' : '') + '\" style=\"background-image:url(\\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHIAAABQCAYAAADFuSFAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA25pVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NTc3MiwgMjAxNC8wMS8xMy0xOTo0NDowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoyODYzNTRkZS04NWY4LTg3NDEtYjNmOS02OGU4NGQzZjVjODkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OTM0QjUyMzEwQ0ZBMTFFNTlCQjg4NzExODFEM0Q0M0QiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OTM0QjUyMzAwQ0ZBMTFFNTlCQjg4NzExODFEM0Q0M0QiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6RDVFOTA3RTFFN0Y4MTFFNDkzNjJGQzdDNUEyRDA1MTYiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6RDVFOTA3RTJFN0Y4MTFFNDkzNjJGQzdDNUEyRDA1MTYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5NfkuaAAAX1klEQVR42uxdCZQdVZm+99by9u7Xr1+n926ykOASgQODS5gJijIGJQxbOM4IIosKKgoHZw7icubMAcHjuI3jCHJkNI4LGcEIKuoIozKj4uAIkTBEliyd3ve313bn++tVvby8vNd53R00CXVPbqrqVdWtW/93v3+5SzWXUrIgHfuJb9u2bUk3UgMIhUIsFosx27aZoigsn8+ztrY21t7ezvbu3csikYj7e7FYdO+JRqNM13U2OzvLUqkUE0Iwx3GYqqruNpPJuFsqo1JBzt3fDMNgiUSCzc/Pu+VS+T09PfT88NDQUE9ra2tnOBweRJn9uGcFbm1HDqOeKo5t7JvIczieQN6POu+ZmZnZj3qMo05Te/bscetNdaE60jvRs6mO1e9M9bAsy30XOucTga4tFAru/ZRzuRwzTdP9vaWlhWWzWfe9qN6opys3kg29G+Xp6Wk2OTnpXr+UpI6NjS3pRno4CZQqSS9NlSchU6KKTkxMuIKnytILUiIhEPhUabqeztG9mqa55UGwFWD9RMKia6iR0D41AgiyG8c9AD4NQZ6M3AehpXC+G2V2IrdhvxW3h5AVnHewtbDNovwZlDeOMkaxP4G6TaKh7YCg96Lek7juOQjZKZVKbv0oVzcoapQEEAHoA0HnKFNDpHehhkCyoPel3+m6ubm5yrtTI6D7/Pvp/ej30dHRSlmLBtKv6KKp7FXQb5W09Y+rz/nZB6U2+/f65/2t39Jpi/KiAHc9Dl+LxnEGGtDa9evXnwChtUE4YtWqVYeUWyMQApNeNATBtSOvIQFS2dTICBwwOguARsGknbjv97j25yjnSVwz4pflM7S6/Ebnaq+r/b1aLtXyWzKQR5OepxfyWyheJo58OgC8CHlDOp0eBIApUkmkCah1L/WlqxNpDa/RxMHSNQB1DcDcDICvx/4E8mOo0w9wzU8IVLr2aPQrjhogCUAiOlrmyVBNmwDehfF4/HQSNIFH6mip2qMZ7UKJ1CJleiYBC/UaB6groSYvhSofg6r8d/z+IPKvAOZsAGQNC4mBSG+Bs/E2qLhzkdvI9r6Y4DWTiPWUyTEDqJ0A9b2w0dfB3v0c7N2GxncvLpt4SQPpMRAEFOdBWO8BcH8Bry5Knp1vK46m5IOaTCY52LkRzslGAHotWPp11PVOvMfMSwpIzwbi3flrYOs+AgA3gYkcAvqTsq/ZRE4JVL6bAegrpqamPgGWXgWG3o53uw8aZua4BbI6FgR4L+vu7r5xxYoVlwNAnQCsDjeOpUSqnzJU7xoAejdAfAfe8xNoqD/8YztEfxQJel4ox0u/H6rzxo6OjkGyOxRvLcO6MgoPORdjUvK845jcKY0rQqhPKuHO79e8m4Nrw6X8c1sY07vVUJetKOT1Ulhi9yE6WZYm9z1pvNufj4+PnwaG3osCbwGYw8cNkB6IrxwcHLwVDNwMEH2vcNFOEXhdcGxzhDvGDqnEfmUWRwt6OHU/UyLTjm0xszDCVTVSBJBmnZqwUu6Ff2Y8qjElJYWgvgKLFwoTl4RCXSkmi+uB9gZVDSepVwgNZNEql94LjTU6OTl5BfKG4eHhj+DUvccskNW9ID09PZfBntwOddpDjgy594sC0LH2AcVfAsAnpZ3dAdB+zsz5WUWNESkPfq7QkBu9EoJxJVSUTC/W0O8rdGxaBTyGeoOstbZtnYufNmpqbD3nSrpxmYcmsvOdnZ1kQ0+Exvl2Npt9NTxesp8TxxSQJBTqi8RLJMDA27q6uq6FPVQWw0KoQUMacy84kv8rVyPf49L+A3AwmYMwRQFTuHIQQLWANQKy0bXl3iNioJjDf7+Buv2NYWbaTDu7FtecpWvJ81U1erLgSnQx6pZ6nMDMG4eGhjZAHu8FmI8fE0CSQAhEbFf29/d/qa+v7xxSpeS2N2PzHLOYl1buF0wJfdopzj4GEGeZBtlJ7p5nJGxkTr0rnLrx8Cy7CFxDXveXiuMsk9Y0MIngWt2Fiq5znAx2TEZYlEEjG2t6dtYr3wO3XJYC75P/2nHsXwPUL0BUvY5T+jtVCV+kqKFWznjT7ASIrx4ZGfk+nL13Qz7bXwxHSBzJwrwO5D8D+7bDJp5DoxPNgCjNgm3O7nnAmn7mIsfIvRnS/jGEPesCV5Gv4gqdOQZz8CO35qGmE0xmfgdtOMtULQyBRZlwplEegLQLLnBkG5lTApmzwAL102z3OinnEOTvxn6CGdYwzhcAjeoBLMvthtQxNRyu5LC/y3Gsq/LF0XPmss99oWTONa0qyaRAHp1g6VZ46e/zG/1RxUjf3pA9ROs7e2BgYCtY2J1Opw8b1Eur5Nj5ifsdI/tVaRs/4lCpZOcOUn0u8+AwWTkmiFGFIfgrvYwZU0yJDjAbIgYNq+pDrFXL7KX7padS3d8Ah/S1B93joDHEWCH7NADtQ1uxXDCFsKBZ5KGKmNNAgPpYsTT1mGUXt9oh82pdS2xRlVBrM6oWskmAnf8EJ6gDzPz4kez4OCKMpPgQLW3L6tWr7zvhhBO6SZ0uWEEaebDMR6A+N8nC9F9DvA9woRvMU3menQSZSoyZc6TmGDemvcrKso2kTNe49pI3o7lrnCO6R/HsI5wkprgXUENQNJ3poTjaAFQyM8sNqUpUAo0C9pLAfHfRmH21ZRa+gvo6zfQOwdyw3t7ej4XD4c9Bg/EjxUx1uWz0QLwAhv1OVLCF+kgXMKKQvTlnZ8a+xLTY33OhFOBKukxh8oCkuevOk3ChCq0S4+F2CNUDrNJAvK1jHkBI2hqTxkrmse1gFG08wkDcaO7HwXxZhVpVZcmDnB+hqC7TbQkVjTpaMgsoFRyzKluqSORnbCnflS+MPBrVU7cgPl29UOhCLCQwIbvrx8bGVNM0byAu/MmA9EGEOj0PLNwKEGMLgkiiLWV/4uQn78DdP60A4gvGMVw2CEV3277U4KyQl0oXEPMqcvYAd8w2bFNchN8CSafxo8n19Clg78lMbQO5wxW20r5gbSwcOUnlPLQLP/436VrO1d+jjEfhxBTBqEle47i5gIKtmhJmJXuCKTzCpGu2HZQnDjhJnNlcinvyxtwvVUX/UDSUuvJwMSfkRbvXjY6OmjBLH1wuMxcNpO+Z0ig5PNM3AcSvoYXFFgovpAlbODf0HRZpoxfMsmq1S4OrYJUbhxt5nFI9Z8PL3ENQWjCWvAdt+gKwYECGUhcAi7BIntbr2j/3bZLYTdZpdQqiFp0pqtvQBpHfpKrUt9tioqzRcGjAFCLyX1Ch3+dc/lC6jK1mc9nxKdnzLKJ1sIjSwTKw1VEnDJDjFfspmf1/2L06W5zcrSmhD4e0RPhwYOJdPwBmGlCzf0type7KpYCqLhZECuipfzQSiZwCdfplBPrJBUG0rXlp5N7nZMa3KvEOvKznhBCAZpEJNY6M8EHRKPwos69aiFJ2oSWczPTkFUzRzxVaf4sbgrBYBaSluge87Fn1h/QeetYqsPIytKp9kssHHdt8yJH2DodZL1RUqVt3h4XQCKbFs+VoiPuW2/G8XE0WzKl/cBzjIU2NfRNe7+qFwCTPHsz+0Nzc3DAA/aw/k+BFB5J0PDzSPlTgqwj0B1tbGztsTnYqB3AuF5GW7QDBY1jZznFyLEyrrD7hBEhybKrjdinTQPgaxJIXAayTeaTjRe5OdG0eWbF+lanXSiV0LcDZZTvF/7ClcTfY+r8H5GC59pI83iJi1rBMMQ1xq+PaXOmGLPBuf1MycpsdWfpOLJw+qSEAYGBXVxeNd96GMGV3JpP5LkUAiwVTXQyNSZ3C84oCvLtSqdSrFgoxnKm9GXP46cuUvvXbK94oriUh8HmEiIUc4wk4MaWcx0JeBtWx07j0vTyUuJgJ/ZWMC/bHT2VQQ2p6LSq31nJyF5aY+JZpTt4Flj7N3GYoXYZKDnupcDZVepZpLM6S6uABx4YrO2fyIxcXrNnvpONr1jV6Gmk5qNkIsLgLIA7T9BLycIk0zeKjNtfrwly76HU7fRQtaBP1WDQC0Z54IWPufOQqnuoFE9UDahKaTOB1ZR7BuRat8hjJmXFiYO3l8GZv5nqs/+gZrEJkKeJdqh7/oCIi1+CHm21p/RsYOu2yD8xUuM7GzKfw4ipri6zCb+qBUEZoT41ln7oUrL6vM/HyVY2eQqMnCNs68vn8lwHeGyYnJ6eImc2O0TYNJIEGAP8KQe0NUKkHzfc8iInT+\\/PWEz++jGvqdq7pHoDCVavcQCihRplNndC+x+\\/21jhnMi18s4ilz3XDkaM0hdV2MsyfN+zMFoD0ebBy2wEbFWaWsNiY8RQL2TEW1XoqHRSqiDwxnH3yPGiX+zvjJ61tVD75HtB6r4Ine8euXbuuBZgmTS1thpUqzcVsZigKAK5G/iLUaYgKr2tDZ8cyxlM/uxye33amhbyQAWqoiHBRg0dJMXNVLwxSC+Loa0S07WbYwXZ2lE3vaJR0JXFmV+y016KFrsqZY3ccUKUaA8hs3hlGaJZnXeFXuA4QkUDl+s6x7NMX495tbZHehmqWzBVYeQUigl/Bft7tTQddvrNDdhH01trb2/+Rut4aOTeymMuZ+56+hkv7u+B52bEhVxr2kKGxiI7eKhbaFJL0iGjyDiXc8nYmjr0ZApqIK2Dk7SEluQle7tthO4fIrgIwt7/sycwDLG/Ns3Z1oNwdyEkNix2zhf2XxtTUfboWWdVI88FsKSDPbTj8z/n5+WebmUGhEp0PZxsB4NUIM95Ko/oN0rSTz7wTCH3PVaOGiZJpC5c8N44mHCrHg9xzaNTQWXB0vswUbQ1T2DGbiG0JvWejI80f4sU+5kh5v3Q7/jRydNg4HKA25QQWVtrgVUbdGFnlkScyxcnLW5WuR1RRf3CWNB5k3QFtSeHIJYZhFA7HSuX888+vrD+ozTRtHi7xIBycrwHIlnoqFXEicyaHbpWZmbulUXSHmCgm5HDNhYiXmQlbyaMJmrSK641zRKrnW6JlRR87ThKYuCKurbikYM3Bi2O/pJhy3hwFgEnWFz4VwLawCCxHRLQzjUdgquSodMQGXaPuPN6wXxasXF0oFKhL8XGSvT/vtl5WG9k7n+ZQpR9B6+imWWN1VWp29kHr+R2fYwQeqYBQsjxmWBmC8vtBHfyTrxeJ9q8zPZJmx1mKa13ihMSGT40Un2QlK/dpv5NACJ1FlRAzHaPSTxxSmGXb1j1gWgmAnVtv8IJkD3upQLXehP2HQKo9C7FS1GMiOTekUsHCNyJf3Uj9ymJ+j5ybfg+PtmR5BA6dhkaBcMON6X0Q3Q5xihPlWTyWuBcgdrDjNIWUBO+NnPpJhek3mk4BMuBljxPWlNo1dRhIZmNrUxD6TdxyHvInFxotgVlbAx/lJlrdRetUGmV1amqqrl3UdT28du3aj5MXVTdEkbJgT4x8WM5N7uehmNcfSr01BXeYqjL6YJZgE/U380Tqq1wLpdlxnjQRVQbjZ3xiqPCELDm5z/gzCfxwzakZ7cLxHWDaXyKf2igkgVa8Gp7sPXA8f9so7BP1VkhRAhO3wFM9s3qt4kEVmBx5SM5NfYOrYYQVzLONpFoR6EcSlczbe/qVvjWf46HoCvYSSWGlVT81dcmnYmrbDaZTFOXBbVZZoeYvxfOC/VnqOHcHExp04SFuD8O0fZSmlDaKKdV6MSPsZhvimOtp4Wddvew4IyjvSpFoc0OMigolF9TvibDhudpOXHQP3ArbuZa9xFJKHxSJ1IpPGoaVgyq9y++rJiBpPm/NsrpfIH8bsr6qXlk0PAhmnlMsFjfRyrBaTNwGUk+tdnV1vRW6+TTqkqvLxpnJzwDMWdg8xkNgJLEPal/OzzA5O8Xk9AQFoIzHWz7ABb+MvUSTJiJqVI/fpKiiq9rDJCD9Rb6UPb/kX4idjZxO4BEFHjQMGPZ/45xXVo6rvs6mH6nQSCQS7u3tvZ4C/3r6WGbnn7NH993LFdIY7lg+o7BDzs0QA2keBEA0mOhbdbbSlr6JvcQTGvKJGteuhJxvqx1JqlaT3lTJh2k5YV2vGFEDmLkZseXpsJWP+iD6S+XFunXrKqtpCUjo481wcE6vy0Z6+MjQN3g+t4cV4cTk8wzBJlgZYUq6iyldfdh2M5HuHlTaO79ItpoFidKtyK+rZVntMa0bYQ2mfdB5mDoN7Hs3LWOnbxLQMnxitvvdgoGBAXeH1q8DUAVq9Tp/7f8hOGbmn7czc3dy6kctj6qSTw0nRy/35HjzMZTewQt5S3JtgN8BECDbO2C2LsXhQutBHgeZvgnZv6PeSSIXzY8C4OtQ5jNULo2akDl040h4qG6fKtIZxMYGI/7Syc1t5fHEftYCorW0gu8tzAErrb0vMGtoN7P3PM/s4X2vYeHoLQF8h4B5JsB8Z3V0UGc6pASQX5Hy4JGFaqcmlUrFoEpp1ZcLrN8PKwzDINSSoG0bTrwdejhWd32GZU5zVf+S6IDqTLYz0Z52mcj1MBOtKSYSADcSZcrAyo9zXW8PoKsLxN8AuJ56H5DwvyCCfVrW/t1GZZAHi+u24JougNkCNiaxn6Rv0NxfKpUUhBscJ05t5Knae3f/j7N/zwTXveEpcoRUjVUGjmFfRTh2ttLde1YAWcP0MsibQPhstdqt+aiFgfPfwnYzOb6HeMLlOVMrcc1DOJz0Q0gOoyl9D4poSjq3TtyYs/e+sFkW8g+7A78EYi6LUGOOSd+WlkphZfWJ25SVq94a4NU4Qc7Pg0WvBXDj1Wq1JtDvA+t+hPMvr1cGmUGaPVAdVVBPwTQxthzNN0iF/ONOJrOJK8qEO1cFLHQnVjvywCRvx3olb2n7KQ+FVgRwLZwAxM3Y3H4YL/YbAPNtTRZpeHMTD9OKiqVHwLgJSZ8iQ7jhwO11xseZMzPNnOlpZo9PkLp9QwBicwmabwvYxGu7RWvYuXUxZR5+ihrNSy3mHnbXJdIDSZVqqmsTWcko52IxBZreEEDUtAc7iLzxICBqvpIFMH8Hn+UPRw5IyfYjJvwZb00yjpBDJFqYNK2ybdQ1F1Qej60X6XRvAFHzXbEAbEOto1PjzY5i+1jTLD/cBc7Y2HPO+BjnIW8eDkIchyvueCPN6ZQIRpV0+wX1PKwgLZjO9oawrKpuumpbKSnoh52UzZi/wzKSp1KPKitX5kRfHxP9A0xGEXYWCmClWc6FfCfU7RuPlRlwR1Gi8cczawP+6gxWfo8i+OUz0jTzcnx8V7VHxamDtrvLa0LSfbqS7ugPcFm0nUwCqBW1Tk71wDOONX8Mc3lAquo+3tGx3VWp7uw4gxk7d5BzU57qCEaKaPQKZUVnS8DHJcWUFyJvpyi8TixJ6WkA/gNsz18ekI5UuR4qL0GiB2k6C53xmvJybn9toOP0cEUJUFlal12nh0GpwSU55NFlq1Z7/76wMzLM3Fnj3iopu5j3VlVhY5i6duK6lOgOHNalJKjRpGVZbWBdboHLos18m0gsrMfZnUxwqzJiZRrMoQFlFCxJtdJXjTl/QwDJktMpAPGURmGIt/8ANvllMVL0Dz6LfODYsplqW+VZAMyd8mhwVTECPJaW6vXq1ElDyPRR+Ohy4siDBiaFqtBX0AMEjjCehzlPc3SUpTOSZoYXS7Kyypi2CD34MfpJzqM4Zet4swcdLm81lg0gZ2dYZaojfeUx1e5NfwzSkUq2bZ+E/HD1XxyonWbTDJCiMSFt5uQzyNlyLuSZzB3SeBx2yDcag7RIz/Vd/jINykv9TEtDetHKKRGJ2O4nxAgtw2Cl3c8wXVOY0urN5HBskwnFCeBYVir5Ix/+4L6/vxiyNNaTqsZEZ0/J7b0Jh5k9jrjUMtw5qw5iSWt+hqmxxEYRTfQF/axLTwCu0qtT7++Y4Li0bI9JWuZ11uhQD7Os8hJyeggApqXkxZ2/Wy8deYu7ejNIS04Aiv7C0MUN/jAMeazvYuUZHMvoENBCrxMtSfq+6GoocxXA6rTFqdPCq9Y9qMRbBgMolp2SAPMe5Pdjn9b1a56mpG/zfAH5ymbCD+79eYPEYS7e6cxM/tYc3hPS+lcZIpHciKbUF2Bw5JLHxl8j7waoDo7fhG2zyxCNZoH0n8YCe3hUpkUCGaQAyCAFQAYpADIAMkgBkEEKgAxSAGQAZABkAGSQAiCDFAAZpADI4xxI+qi593nHIB2jySIg6ftn9B1PEcjj2AXy/wUYACIPOMIobjzuAAAAAElFTkSuQmCC\\');width:100%;background-repeat: no-repeat;background-position: 15px 6px;\"></div><div class=\"mi_gradeselecthandlenerrow\"></div><div class=\"mi_gradeselectdigitsnerrow\" ' + (window.MI_defaults.RTL == 'true' ? 'style=\"direction:ltr!important;\"' : 'style=\"direction:ltr; LEFT: -4PX;TOP: 30PX;\"') + '><span style=\"font-size: 43px;z-index: 3;color: #92c83e;font-family: \\'Source Sans Pro\\', Alef!important;\"></span></div><div class=\"mi_gradeselecttext\" ' + (window.MI_defaults.RTL == 'true' ? 'style=\"top:77px;direction:rtl;color:#b8b8b8;\"' : 'style=\"top:77px;direction:ltr;color:#b8b8b8;\"') + '></div>',\n starspanel: {\n header: '<tr><td style=\" border-top: 1px solid #DFDFDF;\"><div class=\"mi_hover_starspanel\" style=\"border-bottom: 1px solid #dfdfdf !important;padding-bottom:5px;;overflow:hidden;border-top:1px solid transparent; padding-top: 20px;margin-top: -17px;background: #f7f7f7; /* Old browsers */background: -moz-linear-gradient(top, #f7f7f7 0%, #ffffff 100%); /* FF3.6+ */background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f7f7f7), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */background: -webkit-linear-gradient(top, #f7f7f7 0%,#ffffff 100%); /* Chrome10+,Safari5.1+ */background: -o-linear-gradient(top, #f7f7f7 0%,#ffffff 100%); /* Opera 11.10+ */background: -ms-linear-gradient(top, #f7f7f7 0%,#ffffff 100%); /* IE10+ */background: linear-gradient(to bottom, #f7f7f7 0%,#ffffff 100%); /* W3C */filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\\'#f7f7f7\\', endColorstr=\\'#ffffff\\',GradientType=0 ); /* IE6-9 */width: @@@widthpx;left: -0px;position: relative; height: 30px;\"><table style=\"position:relative\">',\n footer: '</tr></table></div></td></tr>'\n },\n tag: '<span onclick=\"jQuery.MidasInsight.tagClicked(\\'@@@kfid\\',\\'@@@atags\\')\" class=\"mi_tag_@@@atagsreplace mi_tag\">@@@atagscap<span style=\"display:inline-block;background-color:@@@color;-webkit-font-smoothing: antialiased;padding: 0;margin-bottom: 0;margin-left: 0;margin-top: 5px;left: 4px;position: relative;width:6px;height:6px;border-radius:50%; box-shadow: inset 0 0 10px 10px rgba(0,0,0,0.2);\"></span></span>',\n slidercontainer: '<div id=\"mi_previewPhotosContainer_@@@kfid\" style=\"height:65px;cursor:default;-moz-user-select: none; -webkit-user-select: none; -ms-user-select:none; user-select:none;\" unselectable=\"on\" onselectstart=\"return false;\"><table class=\"mi_previewPhotosContainer\" style=\"\" cellspacing=\"0\"><tr>',\n photopreview: '<tr ><td id=\"mi_photopreview_@@@kfid\" onclick=\"window.MI_logUsage(\\'photo_preview_clicked\\',\\'@@@kfid\\');if(jQuery.inArray(\\'photos\\', jQuery.MidasInsight.ObjDictionary[\\'@@@kfid\\'].options.tabs) ==-1) return;jQuery(this).find(\\'.mi_thumbscontainer\\').hide();jQuery.MidasInsight.MI_GetPhotos(\\'@@@kfid\\',false);\" colspan=\"2\" style=\"width: 100%;overflow: hidden;background-color:white;\"><div class=\"mi_thumbscontainer\" style=\"margin:0 auto;overflow:hidden;width:@@@widthpx;padding-top: 3px;border-top: 0px solid rgba(0,0,0,0.2);\">',\n tabswrapper: {\n header: '<div style=\"width: 152px;margin: 0 auto;background: #fefefe; /* Old browsers */background: -moz-linear-gradient(top, #fefefe 0%, #eeeeee 100%); /* FF3.6+ */background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fefefe), color-stop(100%,#eeeeee)); /* Chrome,Safari4+ */background: -webkit-linear-gradient(top, #fefefe 0%,#eeeeee 100%); /* Chrome10+,Safari5.1+ */background: -o-linear-gradient(top, #fefefe 0%,#eeeeee 100%); /* Opera 11.10+ */background: -ms-linear-gradient(top, #fefefe 0%,#eeeeee 100%); /* IE10+ */background: linear-gradient(to bottom, #fefefe 0%,#eeeeee 100%); /* W3C */filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\\'#fefefe\\', endColorstr=\\'#eeeeee\\',GradientType=0 ); /* IE6-9 */-webkit-border-radius: 15px;-moz-border-radius: 15px;border-radius: 15px;border: 1px solid #cbcbcb;padding: 5px;\">',\n footer: '</div>'\n },\n footer: {\n header: '<div class=\"mi_footerwrapper\" style=\"background-color:#fff;\"><div class=\"mi_footerroot\" style=\"top:2px;\"><div class=\"mi_footercontainer\" id=\"mi_footercontainer_@@@kfid\" nstyle=\"height:100%;position:static;\">' +\n '<div class=\"mi_footer\" style=\"background-image:none;height:auto;margin-top:2px;\"><div onclick=\"jQuery(\\'#cpcnt_@@@kfid\\').find(\\'.MI_tab_selected\\').removeClass(\\'MI_tab_selected\\');jQuery(\\'#mipct_scroll_@@@kfid\\').addClass(\\'mi_blured\\');jQuery(\\'#mipct_tblabout_@@@kfid\\').css(\\'max-height\\',jQuery(\\'#mipct_scroll_@@@kfid\\').height()+1).css(\\'height\\',jQuery(\\'#mipct_scroll_@@@kfid\\').height()+1).css(\\'top\\',jQuery(\\'#mipct_scroll_@@@kfid\\').position().top).fadeIn();\" style=\"z-index: 1;position: absolute;right: 0px;top: 5px;height: 25px;width: 65px;cursor: pointer;display:none;\"></div>',\n share: '<div><ul class=\"mi_share-buttons\" style=\"padding:0; margin: 0 10px 5px;;\"><li><a onclick=\"window.MI_logUsage(\\'share\\');\" href=\"https://www.facebook.com/sharer/sharer.php?u={0}\" target=\"_blank\"><div style=\"margin-right: -6px;background-image: url(//d34p6saz4aff9q.cloudfront.net/img/f.png);height: 30px;width: 30px;\"></div></a></li>' +\n ' <li><a onclick=\"window.MI_logUsage(\\'share\\');\" href=\"https://twitter.com/intent/tweet?url={0}&text={1}:\" target=\"_blank\" title=\"Tweet\"><div style=\"background-image:url(//d34p6saz4aff9q.cloudfront.net/img/t.png);height: 30px;width: 30px;\"></div></a></li><li style=\"display:none;\"><a onclick=\"window.MI_logUsage(\\'share\\');\" href=\"http://pinterest.com/pin/create/button/?url={0}&description={2}\" target=\"_blank\" title=\"Pin it\"><img onload=\"this.style.opacity=1;this.style.top=0;\" src=\"//d34p6saz4aff9q.cloudfront.net/images/footer/Pinterest.png\" style=\"opacity:0\"></a></li>' +\n '<li><a onclick=\"window.MI_logUsage(\\'share\\');\" href=\"https://plus.google.com/share?url={0}\" target=\"_blank\" title=\"Share on Google+\"><div style=\"background-image: url(//d34p6saz4aff9q.cloudfront.net/img/g.png); ;width:30px;height:30px;background-repeat: no-repeat;\"></div></a></li></ul></div>' +\n '<div class=\"mi_footer_prompt\" style=\"color:#59a3e8;top:auto;border-top:none;position:static;float:left;margin-bottom:0;padding: 7px;\">@@@ask</div>',\n callForActions: '<tr><td><div id=\"cfa\" style=\"white-space:nowrap;padding: 0;margin-top: -2px;\"><div onclick=\"alert(\\'call to add to favorites\\')\" style=\"cursor:pointer;height: 21px;width: 50%;margin: 0;display: inline-block;text-align: center;vertical-align: middle;padding-top: 7px;border: 1px solid rgb(239, 239, 239);border-left: none;font-size: 12px;color: #111;border-top: none;\">+Add to Favorites</div><div onclick=\"alert(\\'call to book\\')\" style=\"cursor: pointer;height: 21px;width: 50%;margin: 0;display: inline-block;text-align: center;vertical-align: middle;padding-top: 7px;border: 1px solid rgb(239, 239, 239);border-left: none;font-size: 12px;color: #111;border-top: none;background-color: #31b444;color: white;\">Book</div></div></td></tr>'\n },\n header: {\n header: '<div class=\"mi_panelheader\" style=\" max-width: @@@widthpx;overflow: hidden;display: block;\"><table class=\"mi_rasta\" align=\"left\" class=\"mi_reset mi_greenredtitle\" style=\" max-width: @@@widthpx;overflow: hidden;display: block;\"><tr><td class=\"mi_header_caption@@@gaugeOrientation\" style=\"padding:0 !important;@@@exttrastyle\">' +\n '<div class=\"mi_drag_area\" style=\"position: absolute;width: 100%;height:125px;left:0;z-index: 2\"></div>' +\n '<div class=\"mi_green_close@@@gaugeOrientation\" onclick=\"jQuery.MidasInsight.hidePanel(\\'@@@kfid\\');\" style=\"z-index:3;cursor:pointer;display:none;\">✕</div>'\n // score gauge\n +\n '<div class=\"oi_gauge oi_gauge_@@@clsgrade mi_gradselectroot @@@gaugeOrientation\" id=\"mi_gradselectroot_@@@kfid\" data-score=\"@@@decgrade\" ></div>' +\n '<div class=\"mi_titlescore oi_color_@@@clsgrade\" style=\"@@@titleOrientation;text-align: left;margin-top: 16px;width: 240px;font-size: 25px;height: 0px;margin-left: 105px;\" >@@@textgrade</div>' +\n '<div class=\"mi_title\" style=\"@@@titleOrientation;margin-top: 22px;width: 240px;float: left;height: 41px;margin-left: 102px;color: #030303;\" >@@@displayText</div>' +\n '<div style=\"float:left !important;margin-left:102px;color: #A0A0A0; margin-top: -5px; nmargin-left: 0!important;npadding-left: 0!important;\" class=\"mi_subtitle\" >@@@count</div>' +\n '<div class=\"mi_preview_images\" style=\"z-index: 3;width: 100px;height: 60px;border: 0px solid #ababab;position: absolute;right: 18px;top: 33px;padding: 0px 0px 0px 0px;cursor: pointer;\" onclick=\"if(jQuery.inArray(\\'photos\\', jQuery.MidasInsight.ObjDictionary[\\'@@@kfid\\'].options.tabs) ==-1) return; jQuery.MidasInsight.MI_GetPhotos(\\'@@@kfid\\',false);\"><div style=\"border: 0px solid #ababab;width:100%;height:100%;background-image:url(@@@previewimgsrc); background-size: contain;background-repeat: no-repeat;background-position: center top;\"></div></div>'\n\n // tools tabs\n +\n '<div style=\"clear:both;height:0px;margin-bottom:0px;border-top:0px solid #DBDBDB!important;\"></div>' +\n '</td></tr>',\n footer: '</table></div>'\n }\n },\n scrollables: {\n header: '<div style=\"clear:both;height: px;margin-bottom:0px;border-top:0px solid #DBDBDB\"></div><div id=\"mipct_scroll_@@@kfid\" tabindex=\"-1\" style=\"heightdummy:0;outline:none;max-height:none;\" class=\"mi_scroll\">' +\n '<table align=\"left\" id=\"mipct_tbldefault_@@@kfid\" class=\"mi_results mi_scrolledcontent\">',\n footer: '</table></div>'\n },\n socialItem: {\n timelineItem: '<div class=\"mi_timeline\">@@@fullYear<br/>@@@month<br/>@@@date</div>',\n metaIcon: function(data, baseid) {\n return \"<div style=\\\"left:auto;position: absolute;right: 24px;-moz-transform:none;-moz-filter:grayscale(100%);filter: grayscale(100%);zoom: 1;-webkit-filter: grayscale(1);top: 5px;\\\" class=\\\"mi_widget_social_icon_small mi_widget_social_icon_small_\" + (data.source.replace('.com', '').replace('www.', '').replace('.', '').replace('.', '')).trim().capitalize() + \"\\\" mi_data-tooltip=\\\"\" + (data.source.replace('.com', '').replace('www.', '').replace('mi.google.reviews', 'Google Reviews').replace('plus.google', 'Google+')) + \"\\\"></div>\";\n },\n nonTimelineItem: '<img data-source=\"@@@sourceSite\" onerror=\"jQuery.MidasInsight.HandleMissingImage(\\'avatar\\',this)\" src=\"@@@itemImageURL\" valign=\"top\" class=\"mi_resultimage\">',\n youtubeItem: '<div style=\"position:relative;\"><div class=\\\"MI_SourceIcon MI_@@@sourceSite\\\" mi_data-tooltip=\\\"@@@sourceSite\\\"></div><table align=\"left\" class=\"mi_resultcontainer\" style=\"direction:ltr!important;cursor:default;\"><tr><td rowspan=\"4\" valign=\"top\" style=\"padding-right:15px;padding-left:3px;width: 65px;\"><div style=\"position:relative;height: 100%;display: block;\">' +\n '@@@sourceAvatar' +\n '</div></td><th style=\"vertical-align: middle;\" align=\"left\"><div class=\"mi_resultpublisher\">@@@itemPublisher<span class=\"mi_resulttimeago\">@@@timeAgo' +\n '</div></span></th></tr><tr><td style=\"padding-right:30px;\">' +\n '</td></tr><tr><td colspan=\"2\"><div style=\"padding-right:10px;overflow:hidden;position:relative;max-width: 275px;\" class=\"mi_imgcontainer\"><img src=\"https://i.ytimg.com/vi/@@@sourceURL/mqdefault.jpg\" style=\"max-width: @@@itemWidth ;min-width:185px;margin-top: 15px;margin-bottom: 15px;box-shadow: 0px 0 10px 4px #eee;border-radius: 5px;display:inline;\"/><img src=\"//d34p6saz4aff9q.cloudfront.net/images/playvideow.png\" style=\"position:absolute;cursor: pointer;left: 50%!important;margin-top: 20%;display:inline;margin-left: -30px;\" onclick=\"window.MI_logUsage(\\'play_video\\',\\'@@@baseid\\');@@@click\" onerror=\"this.style.display=\\'none\\';\"/></div>' +\n '</div></td></tr></table></div>',\n lightboxYoutubeItem: '<div style=\"position:relative;\"><div class=\\\"MI_SourceIcon MI_@@@sourceSite\\\" mi_data-tooltip=\\\"@@@sourceSite\\\"></div><table align=\"left\" class=\"mi_resultcontainer\" style=\"direction:ltr!important;cursor:default;\"><tr><td rowspan=\"4\" valign=\"top\" style=\"padding-right:15px;padding-left:3px;width: 65px;\"><div style=\"position:relative;height: 100%;display: block;\">' +\n '@@@sourceAvatar' +\n '</div></td><th style=\"vertical-align: middle;\" align=\"left\"><div class=\"mi_resultpublisher\" style=\"color:#838383;\">@@@itemPublisher<span class=\"mi_resulttimeago\" itemDate=\"@@@itemDate\">@@@timeAgo' +\n '</span></div></th></tr><tr><td style=\"padding-right:30px;\"></td></tr>' +\n '<tr><td colspan=\"2\" onclick=\"@@@click\" style=\"cursor: pointer; cursor: hand;\"><div style=\"padding-right:10px;overflow:hidden;position:relative;max-width: 275px;\" class=\"mi_imgcontainer\">' +\n '<div id=\"#mi_image_lightbox_@@@ksid\" >' +\n '<img src=\"https://i.ytimg.com/vi/@@@sourceURL/mqdefault.jpg\" style=\"max-width: @@@itemWidth ;min-width:185px;margin-top: 15px;margin-bottom: 15px;nbox-shadow: 0px 0 10px 4px #eee;float: right!important;border-radius: 2px;display:inline;\"/>' +\n '<img src=\"//d34p6saz4aff9q.cloudfront.net/images/playvideow.png\" style=\"position:absolute;cursor: pointer;left: 50%!important;margin-top: 20%;display:inline;margin-left: -30px;\" '\n //+'onclick=\"window.MI_logUsage(\\'play_video\\',\\'@@@baseid\\');@@@click\" '\n +\n 'onerror=\"this.style.display=\\'none\\';\"/></div>'\n //+'<div class=\"mi_lightbox\" id=\"mi_image_lightbox_@@@ksid\" onclick=\"jQuery.MidasInsight.StopYoutubeVideo(jQuery(\\'#mi_image_lightbox_@@@ksid iframe\\')[0]);jQuery(this).fadeOut();\"><iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/@@@youtubeid?enablejsapi=1\" frameborder=\"0\" allowfullscreen></iframe></a></div>'\n +\n '</td></tr></table></div>',\n lightboxVimeoItem: '<div style=\"position:relative;\"><div class=\\\"MI_SourceIcon MI_@@@sourceSite\\\" mi_data-tooltip=\\\"@@@sourceSite\\\"></div><table align=\"left\" class=\"mi_resultcontainer\" style=\"direction:ltr!important;cursor:default;\"><tr><td rowspan=\"4\" valign=\"top\" style=\"padding-right:15px;padding-left:3px;width: 65px;\"><div style=\"position:relative;height: 100%;display: block;\">' +\n '@@@sourceAvatar' +\n '</div></td><th style=\"vertical-align: middle;\" align=\"left\"><div class=\"mi_resultpublisher\" style=\"color:#838383;\">@@@itemPublisher<span class=\"mi_resulttimeago\" itemDate=\"@@@itemDate\">@@@timeAgo' +\n '</span></div></th></tr><tr><td style=\"padding-right:30px;\"></td></tr>' +\n '<tr><td colspan=\"2\" onclick=\"@@@click\" style=\"cursor: pointer; cursor: hand;\"><div style=\"padding-right:10px;overflow:hidden;position:relative;max-width: 275px;\" class=\"mi_imgcontainer\">' +\n '<div id=\"#mi_image_lightbox_@@@ksid\" '\n //+'onclick=\" jQuery(mi_image_lightbox_@@@ksid).fadeIn();jQuery(\\'#mi_iframe_lightbox_@@@ksid\\').attr(\\'src\\',jQuery(\\'#mi_iframe_lightbox_@@@ksid\\').attr(\\'data-src\\'));\"'\n +\n '><img src=\"@@@itemContentImageURL\" style=\"max-width: @@@itemWidth ;min-width:185px;margin-top: 15px;margin-bottom: 15px;nbox-shadow: 0px 0 10px 4px #eee;float: right!important;border-radius: 2px;display:inline;\"/>' +\n '<img src=\"//d34p6saz4aff9q.cloudfront.net/images/playvideow.png\" style=\"position:absolute;cursor: pointer;left: 50%!important;margin-top: 20%;display:inline;margin-left: -30px;\" '\n //+'nonclick=\"window.MI_logUsage(\\'play_video\\',\\'@@@baseid\\');@@@click\" onerror=\"this.style.display=\\'none\\';\"\n +\n '/></div>'\n //+'<div class=\"mi_lightbox\" id=\"mi_image_lightbox_@@@ksid\" onclick=\"jQuery(\\'#mi_iframe_lightbox_@@@ksid\\').attr(\\'src\\',\\'\\');jQuery(this).fadeOut();\"><iframe id=\"mi_iframe_lightbox_@@@ksid\" data-src=\"@@@sourceURL?autoplay=1&title=0&byline=0&portrait=0\" width=\"500\" height=\"281\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'\n //+'</a></div>'\n +\n '</td></tr></table></div>',\n normalItem: '<div style=\"position:relative;\">@@@metaicon<table align=\"left\" class=\"mi_resultcontainer\" @@@cond onclick=\"@@@click\"><tr><td rowspan=\"4\" valign=\"top\" style=\"padding-right:15px;padding-left:3px;width: 65px;\"><div style=\"position:relative;height: 100%;display:block;\">' +\n '@@@item' +\n '</div></td><th style=\"vertical-align: middle;\" align=\"left\"><div class=\"mi_resultpublisher\">@@@itempublisher<span class=\"mi_resulttimeago\" style=\"\"> @@@timeago' +\n '</div></span></th></tr><tr><td style=\"padding-right:30px;\"><div class=\"mi_resulttext\">@@@itemtext',\n instagramItem: '<div style=\"position:relative;\">@@@metaicon<table align=\"left\" class=\"mi_resultcontainer\" @@@cond onclick=\"@@@click\"><tr><td rowspan=\"4\" valign=\"top\" style=\"padding-right:15px;padding-left:3px;width: 65px;\"><div style=\"position:relative;height: 100%;display:block;\">' +\n '@@@item' +\n '</div></td><th style=\"vertical-align: middle;\" align=\"left\"><div class=\"mi_resultpublisher\" style=\"color:#838383;\">@@@itempublisher<span class=\"mi_resulttimeago\"> @@@timeago' +\n '</div></span></th></tr><tr><td style=\"padding-right:30px;\"><div class=\"mi_resulttext\">',\n itemContentImage: '</td></tr><tr><td colspan=\"2\"><div style=\"padding-right:10px;overflow:hidden;\"><img nonload=\"if (!jQuery.MidasInsight.imageIsGood(this)) jQuery.MidasInsight.HandleMissingImage(\\'preview\\',this);\" onerror=\"jQuery.MidasInsight.HandleMissingImage(\\'preview\\',this);\" src=\"@@@itemcontentimage\" style=\"max-width: 275px;margin-top: 0px;margin-bottom: 15px;nbox-shadow: 0px 0 10px 4px #eee;float: right;border-radius: 5px;\"/></div>',\n lightboxContentImage: '</td></tr><tr><td colspan=\"2\"><div style=\"padding-right:10px;overflow:hidden;\"><div id=\"#mi_image_lightbox_@@@ksid\" ><img src=\"@@@itemcontentimage\" style=\"max-width: 275px;margin-top: 0px;margin-bottom: 15px;nbox-shadow: 0px 0 10px 4px #eee; border-radius: 2px;float: left!important;cursor:pointer;\" nonerror=\"jQuery.MidasInsight.HandleMissingImage(\\'preview\\',this);\" nonload=\"if (!jQuery.MidasInsight.imageIsGood(this)) jQuery.MidasInsight.HandleMissingImage(\\'preview\\',this); else ' +\n '{jQuery.MidasInsight.AddtoGallery(\\'@@@kfid\\', { href: \\'@@@itemcontentimage\\', title:\\'\\' });' +\n ' jQuery(this).parent().attr(\\'onclick\\',\\'jQuery.MidasInsight.ShowLightBoxURL(\\\\\\'@@@itemcontentimage\\\\\\',\\\\\\'@@@kfid\\\\\\')\\');}\"></div></div>'\n //<div class=\"mi_lightbox\" id=\"mi_image_lightbox_@@@ksid\" onclick=\"jQuery(this).fadeOut();\"><img src=\"@@@itemcontentimage\" style=\"nbox-shadow: 0px 0 10px 4px #eee;border-radius: 5px;\" onload=\"jQuery(this).css(\\'position\\', \\'relative\\').css(\\'top\\',\\'50%\\').css(\\'margin-top\\',((this.height/2)*-1)+ \\'px\\').css(\\'top\\',\\'50%\\',\\'!important\\');\"/></div></div>'\n }\n }\n }\n\n var langDictionary = {\n EN: {\n scores: ['Lame', 'Fair', 'Okay', 'Good', 'Great!'],\n basedon: 'Based on %d Reviews & Mentions ',\n ask: 'Ask friends for their opinion',\n mentions: 'Mentions <br/>&&nbsp;Reviews',\n media: 'Photos <br/>&&nbsp;Videos',\n facebook: 'Facebook',\n feelter: 'Social <br/>Insights',\n comment: 'Comment',\n back: 'Back',\n insights: 'Insights',\n clickhere: \"CLICK HERE\",\n hoverbuttontext: 'REVIEWS, MENTIONS & PHOTOS',\n rating: 'Rating <span style=\"font-family: \\'Source Sans Pro\\'\">%d</span> Reviews & Mentions',\n translate: 'Translate'\n },\n FR: {\n scores: ['Boiteux', 'Juste', 'Bien', 'Bon', 'Grand!'],\n basedon: 'Basé sur %d Critiques et Mentions ',\n ask: 'Demandez à vos amis pour leur opinion',\n mentions: 'Mentions & Commentaires',\n media: 'Photos & Vidéos',\n facebook: 'Facebook',\n feelter: 'Insights sociaux',\n comment: 'Commentaire',\n back: 'Arrière',\n insights: 'Insights',\n clickhere: \"CLIQUEZ ICI\",\n hoverbuttontext: 'CRITIQUES, MENTIONS ET PHOTOS',\n rating: ' Rating %d Critiques & Commentaires'\n },\n IT: {\n scores: ['Zoppo', 'Fiera', 'Bene', 'Buono', 'Grande!'],\n basedon: 'Sulla base %d Recensioni e Menzioni',\n ask: 'Chiedi amici per il loro parere',\n mentions: 'Menzioni & Recensioni',\n media: 'Foto & Video',\n facebook: 'Facebook',\n feelter: 'Insights Sociali',\n comment: 'Commento',\n back: 'Indietro',\n insights: 'Insights',\n clickhere: \"CLICK HERE\",\n hoverbuttontext: 'REVIEWS, MENTIONS & PHOTOS',\n rating: 'Rating %d Reviews & Mentions'\n },\n DE: {\n scores: ['lahm', 'Messe', 'Okay', 'gut', 'Na Toll!'],\n basedon: 'Basierend auf %d Bewertungen & Mentions ',\n ask: 'Fragen Sie Freunde nach ihrer Meinung',\n mentions: 'Erwähnungen & Reviews',\n media: 'Fotos & Videos',\n facebook: 'Facebook',\n feelter: 'Social Insights',\n comment: 'Kommentar',\n back: 'Der Rücken',\n insights: 'Insights',\n clickhere: \"HIER KLICKEN\",\n hoverbuttontext: 'REZENSIONEN, ERWÄHNUNGEN UND FOTOS',\n rating: 'Bewertung %d Rezensionen und Erwähnungen'\n },\n ES: {\n scores: ['Cojos', 'Justo', 'Bien', 'Bueno', 'Excelente!'],\n basedon: 'Basado en %d Comentarios y Menciones ',\n ask: 'Pregunte a sus amigos para su opinión ',\n mentions: 'Menciones',\n media: 'Medios',\n facebook: 'Facebook',\n feelter: 'Feelter',\n comment: 'comentario',\n back: 'Back',\n clickhere: \"CLIC AQUÍ\",\n hoverbuttontext: ' COMENTARIOS, MENCIONCES Y FOTOS',\n rating: 'Puntuación %d Comentarios Y Menciones'\n },\n HE: {\n scores: ['גרוע', 'סביר', 'טוב', 'טוב מאוד', '!מעולה'],\n basedon: 'מבוסס על %d חוות דעת ',\n ask: 'שתף את החברים ',\n mentions: 'חוות&nbsp;דעת',\n media: '×ª×ž×•× ×•×ª ווידאו',\n facebook: 'פייסבוק',\n feelter: 'Feelter',\n comment: 'תגובה',\n moreInfo: 'מידע × ×•×¡×£',\n back: 'סגור',\n insights: '×ª×•×‘× ×•×ª',\n clickhere: \"לחץ כאן\",\n hoverbuttontext: 'ביקורות, איזכורים ×•×ª×ž×•× ×•×ª',\n rating: 'הדירוג מבוסס על <span style=\"font-family: \\'Source Sans Pro\\'\"> %d </span>ביקורות ואיזכורים',\n translate: 'תרגם'\n },\n CN: {\n scores: ['拉梅', '公平', '好吧', '好', '太好了!'],\n basedon: '基于%d个评论与说起 ',\n ask: '问朋友他们的意见 ',\n mentions: '说起 ',\n media: '媒体 ',\n facebook: 'Facebookçš„ ',\n feelter: 'Feelter',\n comment: '评论}',\n back: 'Back',\n clickhere: \"CLICK HERE\",\n hoverbuttontext: 'REVIEWS, MENTIONS & PHOTOS',\n rating: 'Rating %d Reviews & Mentions'\n },\n AR: {\n scores: ['عرجاء', 'معرض', 'حسنا،', 'جيدة', 'عظيم!'],\n basedon: 'استنادا %d الآراء Ùˆ التنويهات ',\n ask: ' نسأل الاصدقاء عن رأيهم ',\n mentions: ' يذكر ',\n media: ' الصور ',\n facebook: ' الفيسبوك ',\n feelter: ' Feelter ',\n comment: ' تعليق',\n back: 'Back',\n clickhere: \"CLICK HERE\",\n hoverbuttontext: 'REVIEWS, MENTIONS & PHOTOS',\n rating: 'Rating %d Reviews & Mentions'\n },\n CS: {\n scores: ['Příšerné', 'Uspokojivé', 'PrůmÄ›rné', 'Dobré', 'Vynikající'],\n basedon: 'Na základÄ› %d hodnocení a zmínek',\n ask: 'Zeptej se přítele na jeho názor',\n mentions: 'Hodnocení a zmínky',\n media: 'Fotky a videa ',\n facebook: 'Facebook',\n feelter: ' Feelter ',\n comment: 'Komentář',\n back: 'ZpÄ›t',\n clickhere: \"Klikni zde\",\n hoverbuttontext: 'Názory, zmínky a fotky',\n rating: 'Hodnocení %d názory a zmínky',\n translate: 'pÅ™eložit'\n },\n PL: {\n scores: ['Okropnie', 'Źle', 'Åšredni', 'Bardzo Dobrze', 'Doskonale'],\n basedon: 'Bazowane na %d Opiniach',\n ask: 'Zapytaj znajomych o opiniÄ™',\n mentions: 'Wzmianki i Opinie',\n media: 'Filmy i ZdjÄ™cia',\n facebook: 'Facebook',\n feelter: ' Feelter',\n comment: 'komentarz',\n back: 'z powrotem',\n clickhere: \"kliknij tutaj\",\n hoverbuttontext: 'Opinie, Wzmianki i ZdjÄ™cia',\n rating: 'Ranking %d Wzmianek i Opini',\n translate: 'tÅ‚umaczyć'\n },\n SK: {\n scores: ['Hrozné', 'Uspokojivé', 'Priemerné', 'Dobré', 'Výborné'],\n basedon: 'Na základe %d hodnotení a zmienok',\n ask: 'Spýtaj sa priateľa na jeho názor',\n mentions: 'Zmienky a hodnotenia',\n media: 'Fotky a videá',\n facebook: 'Facebook',\n feelter: ' Feelter',\n comment: 'Komentár',\n back: 'Späť',\n clickhere: \"Klikni tu\",\n hoverbuttontext: 'Opinie, Wzmianki i ZdjÄ™cia',\n rating: 'Hodnotenie %d názory a zmienky',\n translate: 'PreložiÅ¥'\n }\n };\n\n window.langDictionary = langDictionary;\n\n\n // Constructs an object from a query string\n // in the format of key=value&key2=value2\n function parseQuery(query) {\n var Params = new Object();\n if (!query) return Params; // return empty object\n var Pairs = unescape(query).split('&');\n for (var i = 0; i < Pairs.length; i++) {\n if (Pairs[i].indexOf('=') == -1) continue;\n var key = Pairs[i].substr(0, Pairs[i].indexOf('='));\n var val = Pairs[i].substr(Pairs[i].indexOf('=') + 1);\n val = val.replace(/\\+/g, ' ');\n Params[key] = val;\n }\n return Params;\n }\n\n // parse parameters from script source\n var myScript = req.url;\n var queryString = req.query;//(typeof myScript == 'undefined' || typeof myScript.src == 'undefined') ? '' : myScript.src.replace(/^[^\\?]+\\??/, '');\n\n var params = parseQuery(queryString);\n //res.write('zzzz'+queryString+' '+ JSON.stringify(queryString));\n \n window.MI_defaults = extend({}, window.MI_defaults, queryString)\n if (typeof window.MI_defaults.feedback != 'undefined') window.MI_defaults.inqa = window.MI_defaults.feedback;\n\n //get template from html if availasble\n if (!(typeof mi_template === \"undefined\")) {\n window.tempDictionary[window.MI_defaults.template].panelLayout = mi_template.panelLayout;\n }\n if (typeof window.MI_defaults.panelLayout == \"string\") try {\n window.MI_defaults.panelLayout = JSON.parse(window.MI_defaults.panelLayout.replace(/'/g, '\"'));\n }\n catch (e) {}\n if (!(typeof window.MI_defaults.panelLayout === \"undefined\")) {\n window.tempDictionary[window.MI_defaults.template].panelLayout = window.MI_defaults.panelLayout;\n }\n if (typeof window.MI_defaults.frameElements == \"string\") try {\n window.MI_defaults.frameElements = JSON.parse(window.MI_defaults.frameElements.replace(/'/g, '\"'));\n }\n catch (e) {}\n if (typeof window.MI_defaults.tabs == \"string\") try {\n window.MI_defaults.tabs = JSON.parse(window.MI_defaults.tabs.replace(/'/g, '\"'));\n }\n catch (e) {}\n if (typeof window.MI_defaults.ex == \"string\") try {\n window.MI_defaults.ex = JSON.parse(window.MI_defaults.ex.replace(/'/g, '\"'));\n }\n catch (e) {}\n if (typeof window.MI_defaults.panelLayout == 'undefined') window.MI_defaults.panelLayout = {};\n if (typeof window.MI_defaults.panelLayout.flags == 'undefined') window.MI_defaults.panelLayout.flags = [];\n if (typeof window.MI_defaults.panelLayout.flags == \"string\") try {\n window.MI_defaults.panelLayout.flags = JSON.parse(window.MI_defaults.panelLayout.flags.replace(/'/g, '\"'));\n }\n catch (e) {}\n if (typeof window.langDictionary[window.MI_defaults.lang] == 'undefined') window.MI_defaults.lang = 'EN';\n\n if (typeof window.langDictionary[window.MI_defaults.lang] == 'undefined')\n window.langDictionary[window.MI_defaults.lang] = extend({}, langDictionary['EN'], window.langDictionary[window.MI_defaults.lang]);\n\n //exclude tripadvisor\n if (typeof window.MI_defaults.ex == 'undefined') {\n window.MI_defaults.ex = [];\n }\n window.MI_defaults.ex.push(3);\n window.MI_defaults.ex.push(24);\n switch (window.MI_defaults.lang) {\n case 'AR':\n window.MI_defaults.RTL = 'true';\n window.MI_defaults.gaugeOrientation = 'right';\n break;\n }\n window.MI_defaults.minPanelWidth = window.MI_defaults.layout == \"inlinepanel\" ? 750 : 485;\n window.MI_defaults.panelWidth = window.MI_defaults.template == 'RASTA' ? window.MI_defaults.minPanelWidth : 386;\n\n if (typeof String.prototype.camelCase !== 'function') {\n String.prototype.camelCase = function() {\n return this.toLowerCase().replace(/-(.)/g, function(match, group1) {\n return group1.toUpperCase();\n });\n }\n }\n if (typeof String.prototype.trim !== 'function') {\n String.prototype.trim = function() {\n return this.replace(/^\\s+|\\s+$/g, '');\n }\n }\n\n if (typeof String.prototype.trim !== 'function') {\n String.prototype.trim = function() {\n return this.replace(/^\\s+|\\s+$/g, '');\n }\n }\n String.prototype.capitalize = function() {\n return this.replace(/((?:^|\\s(?!and)(?!or)(?!of)(?!the)(?!\\bat\\b))\\S)/g, function(a) {\n return a.toUpperCase();\n }).replace(/\\b\\S\\S$/g, function(a) {\n return a.toUpperCase();\n });\n };\n\n if (!Object.keys) {\n Object.keys = function(obj) {\n var keys = [];\n\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n keys.push(i);\n }\n }\n return keys;\n };\n }\n if (typeof console == \"undefined\") {\n this.console = {\n log: function() {}\n };\n }\n\n if (!Array.prototype.map) {\n Array.prototype.map = function(fun) {\n var t = Object(this);\n var len = t.length >>> 0;\n var res = new Array(len);\n var thisArg = arguments.length >= 2 ? arguments[1] : void 0;\n for (var i = 0; i < len; i++) {\n if (i in t)\n res[i] = fun.call(thisArg, t[i], i, t);\n }\n return res;\n };\n }\n\n Array.maxProp = function(array, prop) {\n var values = array.map(function(el) {\n return el[prop];\n });\n return Math.max.apply(Math, values);\n };\n Array.minProp = function(array, prop) {\n var values = array.map(function(el) {\n return el[prop];\n });\n return Math.min.apply(Math, values);\n };\n String.prototype.format = function() {\n var formatted = this;\n for (var i = 0; i < arguments.length; i++) {\n var regexp = new RegExp('\\\\{' + i + '\\\\}', 'gi');\n formatted = formatted.replace(regexp, arguments[i]);\n }\n return formatted;\n };\n\n\n // initiate logging parameters and create \n // on-screen log if in debug mode\n window.MI_logState = '';\n window.MI_logDetails = '';\n window.MI_logKey = '';\n window.MI_logLast = new Date();\n window.MI_scrollLast = new Date(1970, 1, 1);\n window.MI_queuedLoggingEvents = '';\n if (typeof(window.MI_defaults.debug) != 'undefined' && window.MI_defaults.debug == 'true') {\n jQuery('<div id=\"MI_onScreenLog\" style=\"padding:5px;overflow:hidden;z-index:999;position:fixed;right:10px;top:10px;width:200px;bottom:10px;border-radius:5px;border:1px solid #333;background:#aaa;background:rgba(0,0,0,0.5);color:white;\"><div class=\"mi-logCaption\" style=\"background:#aaa;margin:-10px -10px 10px -10px;padding:10px;color:#333;\" ><strong style=\"color: white;\">Debug-Mode Log</strong><br><div style=\"box-shadow: 0px 0px 5px gray;background-color: white;border: 1px solid #7D7D7D;border-radius: 4px;padding: 5px;margin-top: 5px;font-size: 11px;color: #999;\">This log is only displayed on debug mode.To stop showing It, Remove the \"debug=true\" parameter from your script reference or hash tag.</div></div>').appendTo(\"body\");\n }\n else if (typeof(window.MI_defaults.hidden) != 'undefined' && window.MI_defaults.hidden == 'true') {\n return;\n }\n\n window.misstimer = 0;\n }", "static Setup(options) {\n return Part_1.Part.Setup(options);\n }", "static Setup(options) {\n return Part_1.Part.Setup(options);\n }", "function Plugin( element, options ) {\n this.element = element;\n // jQuery has an extend method that merges the\n // contents of two or more objects, storing the\n // result in the first object. The first object\n // is generally empty because we don't want to alter\n // the default options for future instances of the plugin\n this.options = $.extend( {}, defaults, options) ;\n this._defaults = defaults;\n this._name = pluginName;\n this.init();\n }" ]
[ "0.55727583", "0.55137944", "0.5491354", "0.5477057", "0.5477057", "0.5477057", "0.54474187", "0.5436628", "0.5425356", "0.54101443", "0.54101443", "0.5381722", "0.5378221", "0.53756124", "0.53603595", "0.53582263", "0.53397644", "0.53294885", "0.53237104", "0.5295137", "0.5291827", "0.52891725", "0.5286831", "0.527983", "0.5279748", "0.5275693", "0.52752215", "0.5274698", "0.5272996", "0.52718115", "0.52655476", "0.52647567", "0.5257926", "0.52563345", "0.52563345", "0.52555186", "0.5252712", "0.5250625", "0.52407086", "0.5229095", "0.52216285", "0.5220399", "0.5216763", "0.5214702", "0.5214702", "0.5214216", "0.5214216", "0.52096593", "0.5206878", "0.5205665", "0.5203018", "0.51965415", "0.5191991", "0.5191883", "0.51918477", "0.51907545", "0.51907545", "0.51836866", "0.51834804", "0.51830834", "0.5173309", "0.5170749", "0.51677835", "0.51563174", "0.51512396", "0.51512396", "0.51507676", "0.51507676", "0.5146633", "0.51446915", "0.51420337", "0.5138526", "0.5138282", "0.5132331", "0.51296973", "0.51276654", "0.51217854", "0.51217854", "0.51183194", "0.51147586", "0.5114145", "0.5114145", "0.511307", "0.511307", "0.511307", "0.511307", "0.51123506", "0.5106065", "0.51043695", "0.51017654", "0.51001143", "0.5098417", "0.50947845", "0.50931156", "0.50931156", "0.5090559" ]
0.5292157
23
Parse a file (in string or VFile representation) into a Unist node using the `Parser` on the processor.
function parse(doc) { var file = vfile(doc) var Parser freeze() Parser = processor.Parser assertParser('parse', Parser) if (newable(Parser)) { return new Parser(String(file), file).parse() } return Parser(String(file), file) // eslint-disable-line new-cap }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Parser(doc, file) {\n this.file = file;\n this.offset = {};\n this.options = xtend(this.options);\n this.setOptions({});\n\n this.inList = false;\n this.inBlock = false;\n this.inLink = false;\n this.atStart = true;\n\n this.toOffset = vfileLocation(file).toOffset;\n this.unescape = unescape(this, 'escape');\n this.decode = decode(this);\n}", "function parse( file ) {\n\t\treturn __awaiter( this, void 0, void 0, function () {\n\t\t\treturn __generator( this, function ( _a ) {\n\t\t\t\treturn [\n\t\t\t\t\t2,\n\t\t\t\t\t/*return*/\n\t\t\t\t\tnew Promise( function ( resolve, reject ) {\n\t\t\t\t\t\tfs.readFile( file, 'utf8', function ( err, data ) {\n\t\t\t\t\t\t\tif ( err ) {\n\t\t\t\t\t\t\t\treject( err );\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tresolve( parseString( data ) );\n\t\t\t\t\t\t} );\n\t\t\t\t\t} ),\n\t\t\t\t];\n\t\t\t} );\n\t\t} );\n\t}", "function parse() {\n var self = this\n var value = String(self.file)\n var start = {line: 1, column: 1, offset: 0}\n var content = xtend(start)\n var node\n\n // Clean non-unix newlines: `\\r\\n` and `\\r` are all changed to `\\n`.\n // This should not affect positional information.\n value = value.replace(lineBreaksExpression, lineFeed)\n\n // BOM.\n if (value.charCodeAt(0) === 0xfeff) {\n value = value.slice(1)\n\n content.column++\n content.offset++\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {start: start, end: self.eof || xtend(start)}\n }\n\n if (!self.options.position) {\n removePosition(node, true)\n }\n\n return node\n}", "function parse(file) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2\n /*return*/\n , new Promise(function (resolve, reject) {\n fs.readFile(file, 'utf8', function (err, data) {\n if (err) {\n reject(err);\n return;\n }\n\n resolve(parseString(data));\n });\n })];\n });\n });\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc);\n var Parser;\n\n freeze();\n Parser = processor.Parser;\n assertParser('parse', Parser);\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc);\n var Parser;\n\n freeze();\n Parser = processor.Parser;\n assertParser('parse', Parser);\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse();\n }\n\n return Parser(String(file), file); // eslint-disable-line new-cap\n }", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse(file: string): ParserReturn {\n if (file.match(/\\.tsx?$/)) {\n return TypeScriptParser.parse(file);\n } else {\n return babylonParser(file);\n }\n}", "function treeForFile (file) {\n var contents = null\n try {\n contents = fs.readFileSync(file).toString()\n } catch (err) {\n if (err.code === 'ENOENT') {\n logger.error(\"File not found: \"+file)\n process.exit(1)\n }\n throw err\n }\n var name = path.basename(file),\n parser = new Parser()\n\n parser.file = name\n // Parse and type-check the file; catch and report any errors\n try {\n var tree = parser.parse(contents),\n typesystem = new TypeSystem()\n typesystem.walk(tree)\n } catch (err) {\n reportError(err)\n process.exit(1)\n }\n return tree\n}// treeForFile", "function parse(context, file) {\n var message\n\n if (stats(file).fatal) {\n return\n }\n\n if (context.treeIn) {\n debug('Not parsing already parsed document')\n\n try {\n context.tree = json(file.toString())\n } catch (error) {\n message = file.message(\n new Error('Cannot read file as JSON\\n' + error.message)\n )\n message.fatal = true\n }\n\n // Add the preferred extension to ensure the file, when serialized, is\n // correctly recognised.\n // Only add it if there is a path — not if the file is for example stdin.\n if (file.path) {\n file.extname = context.extensions[0]\n }\n\n file.contents = ''\n\n return\n }\n\n debug('Parsing `%s`', file.path)\n\n context.tree = context.processor.parse(file)\n\n debug('Parsed document')\n}", "function parseFile(fileToParse){\n var fs = require('fs');\n var decodedFile = {};\n\n var toDecode = fs.readFileSync(fileToParse);\n\n // pass the byte array into _parse for decoding\n decodedFile = _parse(toDecode).result;\n\n return decodedFile;\n}", "function decodeFile(input) {\n let ondata = (evt, cb) => {\n if (evt.data[0] == 0) {\n cb({raw: evt.data.subarray(1), links: [], data: evt.data.subarray(1)})\n } else if (evt.data[0] == 1) {\n try {\n let node = dagPB.util.deserialize(evt.data.subarray(1))\n\n let file = Unixfs.unmarshal(node.Data)\n if (file.type != \"raw\" && file.type != \"file\") {\n throw new Error(\"got unexpected file type, wanted raw or file\")\n }\n if (file.data == null) {\n file.data = Buffer.alloc(0)\n }\n\n cb({raw: evt.data.subarray(1), links: node.Links, data: file.data})\n } catch (err) {\n cb(null, err)\n }\n } else {\n cb(null, new Error(\"failed to decode a chunk of file data\"))\n }\n }\n\n return asynchronous(input, ondata)\n}", "function Parser(f) {\n this.parse = f;\n }", "function parseFile(file, successCallback, errorCallback) {\n let r = new FileReader();\n\n r.onload = e => {\n // load the contents of the file into `contents`\n let contents = e.target.result;\n successCallback(contents);\n };\n\n r.onerror = errorCallback;\n\n r.readAsText(file);\n}", "function parse$a(context, file) {\n var message;\n\n if (stats$5(file).fatal) {\n return\n }\n\n if (context.treeIn) {\n debug$8('Not parsing already parsed document');\n\n try {\n context.tree = json$1(file.toString());\n } catch (error) {\n message = file.message(\n new Error('Cannot read file as JSON\\n' + error.message)\n );\n message.fatal = true;\n }\n\n // Add the preferred extension to ensure the file, when serialized, is\n // correctly recognised.\n // Only add it if there is a path — not if the file is for example stdin.\n if (file.path) {\n file.extname = context.extensions[0];\n }\n\n file.contents = '';\n\n return\n }\n\n debug$8('Parsing `%s`', file.path);\n\n context.tree = context.processor.parse(file);\n\n debug$8('Parsed document');\n}", "function parseDocument(file) {\n const inputString = fs.readFileSync(file, 'utf-8');\n return DocumentParser.parse(inputString);\n}", "function parseLine(line) {\n const groups = line.match(RE_LINE);\n if (groups === null) {\n return undefined;\n }\n const name = groups[5];\n if (name === \".\" || name === \"..\") { // Ignore parent directory links\n return undefined;\n }\n const file = new FileInfo_1.FileInfo(name);\n const fileType = groups[3];\n if (fileType === \"<DIR>\") {\n file.type = FileInfo_1.FileType.Directory;\n file.size = 0;\n }\n else {\n file.type = FileInfo_1.FileType.File;\n file.size = parseInt(groups[4], 10);\n }\n file.rawModifiedAt = groups[1] + \" \" + groups[2];\n return file;\n}", "function parseFile(file) {\n\n if (window.File && window.FileReader && Window.FileList && window.Blob) {\n alert(\"File Reader APIs not up to date on current browser.\")\n return\n }\n \n //create file reader \n var reader = new FileReader()\n\n\n if(file.files && file.files[0]) {\n reader.onload = function (e) {\n parseInput(e.target.result)\n }\n\n reader.readAsText(file.files[0])\n }\n else {\n alert(\"Error reading file.\")\n }\n\n}", "function parseLine(line) {\n const groups = line.match(RE_LINE);\n if (groups === null) {\n return undefined;\n }\n const name = groups[21];\n if (name === \".\" || name === \"..\") { // Ignore parent directory links\n return undefined;\n }\n const file = new FileInfo_1.FileInfo(name);\n file.size = parseInt(groups[18], 10);\n file.user = groups[16];\n file.group = groups[17];\n file.hardLinkCount = parseInt(groups[15], 10);\n file.rawModifiedAt = groups[19] + \" \" + groups[20];\n file.permissions = {\n user: parseMode(groups[4], groups[5], groups[6]),\n group: parseMode(groups[8], groups[9], groups[10]),\n world: parseMode(groups[12], groups[13], groups[14]),\n };\n // Set file type\n switch (groups[1].charAt(0)) {\n case \"d\":\n file.type = FileInfo_1.FileType.Directory;\n break;\n case \"e\": // NET-39 => z/OS external link\n file.type = FileInfo_1.FileType.SymbolicLink;\n break;\n case \"l\":\n file.type = FileInfo_1.FileType.SymbolicLink;\n break;\n case \"b\":\n case \"c\":\n file.type = FileInfo_1.FileType.File; // TODO change this if DEVICE_TYPE implemented\n break;\n case \"f\":\n case \"-\":\n file.type = FileInfo_1.FileType.File;\n break;\n default:\n // A 'whiteout' file is an ARTIFICIAL entry in any of several types of\n // 'translucent' filesystems, of which a 'union' filesystem is one.\n file.type = FileInfo_1.FileType.Unknown;\n }\n // Separate out the link name for symbolic links\n if (file.isSymbolicLink) {\n const end = name.indexOf(\" -> \");\n if (end !== -1) {\n file.name = name.substring(0, end);\n file.link = name.substring(end + 4);\n }\n }\n return file;\n}", "function LevelParser(filename) {\n //Engine.Object.call(this);\n this.filename = filename;\n }", "function SceneFileParser(sceneFilePath, type) {\n if (type === \"XML\") {\n this.mScene = gEngine.ResourceMap.retrieveAsset(sceneFilePath);\n }\n if (type === \"JSON\") {\n var jsonString = gEngine.ResourceMap.retrieveAsset(sceneFilePath);\n var sceneInfo = JSON.parse(jsonString);\n this.mScene = sceneInfo;\n }\n if (type === \"SMALL\") {\n var jsonString = gEngine.ResourceMap.retrieveAsset(sceneFilePath);\n var sceneInfo = JSON.parse(jsonString);\n this.mScene = sceneInfo; \n }\n}", "function BinaryParser() {}", "function BinaryParser() {}", "function BinaryParser() {}", "function BinaryParser() {}", "function BinaryParser() {}", "parseFlsFile(baseFile) {\r\n this.extension.logger.addLogMessage('Parse fls file.');\r\n const rootDir = path.dirname(baseFile);\r\n const outDir = this.getOutDir(baseFile);\r\n const flsFile = path.resolve(rootDir, path.join(outDir, path.basename(baseFile, '.tex') + '.fls'));\r\n if (!fs.existsSync(flsFile)) {\r\n this.extension.logger.addLogMessage(`Cannot find fls file: ${flsFile}`);\r\n return;\r\n }\r\n this.extension.logger.addLogMessage(`Fls file found: ${flsFile}`);\r\n const ioFiles = this.parseFlsContent(fs.readFileSync(flsFile).toString(), rootDir);\r\n ioFiles.input.forEach((inputFile) => {\r\n // Drop files that are also listed as OUTPUT or should be ignored\r\n if (ioFiles.output.includes(inputFile) ||\r\n this.isExcluded(inputFile) ||\r\n !fs.existsSync(inputFile)) {\r\n return;\r\n }\r\n // Drop the current rootFile often listed as INPUT and drop any file that is already in the texFileTree\r\n if (baseFile === inputFile || inputFile in this.cachedContent) {\r\n return;\r\n }\r\n if (path.extname(inputFile) === '.tex') {\r\n // Parse tex files as imported subfiles.\r\n this.cachedContent[baseFile].children.push({\r\n index: Number.MAX_VALUE,\r\n file: inputFile\r\n });\r\n this.parseFileAndSubs(inputFile);\r\n }\r\n else if (this.fileWatcher && !this.filesWatched.includes(inputFile)) {\r\n // Watch non-tex files.\r\n this.fileWatcher.add(inputFile);\r\n this.filesWatched.push(inputFile);\r\n }\r\n });\r\n ioFiles.output.forEach((outputFile) => {\r\n if (path.extname(outputFile) === '.aux' && fs.existsSync(outputFile)) {\r\n this.parseAuxFile(fs.readFileSync(outputFile).toString(), path.dirname(outputFile).replace(outDir, rootDir));\r\n }\r\n });\r\n }", "function file_load(file, callback) {\n\tif (!file) return; // No file found.\n\n\tlet reader = new FileReader();\n\n\treader.onload = event => callback(sched_parse(\n\t\tevent.target.result\n\t), file.path);\n\n\treader.readAsText(file);\n}", "function Parser(filename, scene) {\n this.loadedOk = null;\n\n // Establish bidirectional references between scene and graph\n this.scene = scene;\n scene.graph = this;\n\n this.nodes = [];\n\n this.idRoot = null; // The id of the root element.\n\n this.axisCoords = [];\n this.axisCoords['x'] = [1, 0, 0];\n this.axisCoords['y'] = [0, 1, 0];\n this.axisCoords['z'] = [0, 0, 1];\n\n // File reading\n this.reader = new CGFXMLreader();\n\n /*\n * Read the contents of the xml file, and refer to this class for loading and error handlers.\n * After the file is read, the reader calls onXMLReady on this object.\n * If any error occurs, the reader calls onXMLError on this object, with an error message\n */\n\n this.reader.open('scenes/' + filename, this);\n}", "function parseFile(path, cvt, cb) {\n if (cvt == null) cvt = adapter;\n fs.readFile(path, (err, data) => {\n if (err) return cb(err);\n xml2js.parseString(data, (err, data) => {\n if (err) return cb(err);\n if (! data) return cb(null, null);\n const key = Object.keys(data)[0];\n if (! key) return cb(null, null);\n cb(null, cvt(data[key], key));\n });\n });\n}", "parseFileAndSubs(file, onChange = false) {\r\n if (this.isExcluded(file)) {\r\n this.extension.logger.addLogMessage(`Ignoring ${file}`);\r\n return;\r\n }\r\n this.extension.logger.addLogMessage(`Parsing ${file}`);\r\n if (this.fileWatcher && !this.filesWatched.includes(file)) {\r\n // The file is first time considered by the extension.\r\n this.fileWatcher.add(file);\r\n this.filesWatched.push(file);\r\n }\r\n const content = this.getDirtyContent(file, onChange);\r\n this.cachedContent[file].children = [];\r\n this.cachedContent[file].bibs = [];\r\n this.cachedFullContent = undefined;\r\n this.parseInputFiles(content, file);\r\n this.parseBibFiles(content, file);\r\n // We need to parse the fls to discover file dependencies when defined by TeX macro\r\n // It happens a lot with subfiles, https://tex.stackexchange.com/questions/289450/path-of-figures-in-different-directories-with-subfile-latex\r\n this.parseFlsFile(file);\r\n }", "async processXmlFile(xmlFile) {\n const response = await fetch(xmlFile);\n const xmlData = await response.text();\n\n const parser = new DOMParser();\n const doc = parser.parseFromString(xmlData, \"text/xml\");\n\n this.processDoc(xmlFile, doc);\n }", "function readFile() {\n\t\tlet reader = new FileReader();\n\t\treader.addEventListener('loadend', () => {\n\t\t\tparseFile(reader.result);\n\t\t});\n\t\treader.readAsText(this.files[0]);\n\t}", "function makeParser(filename, style)\n{\n if (style === undefined) style = \"file_input\";\n var p = new Parser(SkulptParseTables);\n p.setup(SkulptParseTables.symbol2number[style]);\n var curIndex = 0;\n var lineno = 1;\n var column = 0;\n var prefix = \"\";\n var tokenizer = new Tokenizer(filename, function(type, value, start, end, line)\n {\n //print(JSON.stringify([type, value, start, end, line]));\n var s_lineno = start[0];\n var s_column = start[1];\n /*\n if (s_lineno !== lineno && s_column !== column)\n {\n // todo; update prefix and line/col\n }\n */\n if (type === T_COMMENT || type === T_NL)\n {\n prefix += value;\n lineno = end[0];\n column = end[1];\n if (value[value.length - 1] === \"\\n\")\n {\n lineno += 1;\n column = 0;\n }\n return undefined;\n }\n if (type === T_OP)\n {\n type = SkulptOpMap[value];\n }\n if (p.addtoken(type, value, [start, end, line]))\n {\n return true;\n }\n });\n return function(line)\n {\n var ret = tokenizer.generateTokens(line);\n //print(\"tok:\"+ret);\n if (ret)\n {\n if (ret !== \"done\")\n throw \"ParseError: incomplete input\";\n return p.rootnode;\n }\n return false;\n };\n}", "function parse(file) {\n let names = [];\n let parts = file.split(':');\n parts[0].split('\\n').forEach(function(line) {\n if (line !== '') {\n names.push(line.split(',')[0]);\n }\n });\n let n = -1;\n parts[1].split('\\n').forEach(function(line) {\n if (n >= 0) {\n data[names[n]] = line;\n }\n n++;\n });\n}", "function parseFile(filePath) {\n return new Promise((resolve, reject) => {\n fs.readFile(filePath, 'utf8', (err, data) => {\n if (err) {\n reject(err.toString());\n return;\n }\n if (!frontMatter.test(data)) {\n resolve();\n return;\n }\n const matter = frontMatter(data);\n matter.attributes.__src = filePath;\n resolve(matter);\n });\n });\n}", "function parseFile(fileUpload) {\n\n //Add error handling here.\n var status = 'good';\n \n \n //TODO: Insert parsing code here\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n //TODO: Insert parsing code here\n let glFile = csvGenerator(),\n wideFile = csvGenerator(),\n longFile = csvGenerator()\n \n if (status === 'good') {\n return {\n GL: glFile,\n Workorders_Wide: wideFile,\n Workorders_Long: longFile\n };\n } else {\n return null;\n }\n \n}", "static fromFile(file){\n return new IteratorFlow(FlowFactory.createIteratorFromFileSystem(file));\n }", "function parseFile(fileType, e) {\n var content = e.target.result;\n if (fileType.match('text/html')) {\n var dummy = document.createElement('div');\n dummy.innerHTML = content;\n appendContent(dummy.querySelector('.slides').innerHTML);\n } else {\n var img = new Image();\n img.src = e.target.result;\n document.querySelector('.present').appendChild(img); // FIXME\n }\n}", "function parseFile(fileType, e) {\n var content = e.target.result;\n if (fileType.match('text/html')) {\n var dummy = document.createElement('div');\n dummy.innerHTML = content;\n appendContent(dummy.querySelector('.slides').innerHTML);\n } else {\n var img = new Image();\n img.src = e.target.result;\n document.querySelector('.present').appendChild(img); // FIXME\n }\n}", "async load (filename) {\n const xml = await fs.readFile(filename, { encoding: \"utf8\" })\n this.options.log(2, `loading XML file ${chalk.blue(filename)}: ${xml.length} bytes`)\n const dom = slimdomSAX.sync(xml, { position: false })\n let m\n if ((m = xml.match(/^(<\\?xml.+?\\?>\\r?\\n)/)) !== null)\n dom.PI = m[1]\n return dom\n }", "function processFile(lvfs, fi, thenDo) {\n var rootDir = lvfs.getRootDirectory();\n fs.readFile(path.join(rootDir, fi.path), handleReadResult);\n function handleReadResult(err, content) {\n if (!err) {\n lvfs.createVersionRecord({\n path: fi.path,\n stat: fi.stat,\n content: content\n }, thenDo);\n } else {\n console.error('error reading file %s:', fi.path, err);\n thenDo(err);\n }\n }\n}", "function BinaryParser() { }", "function parseFile(err, contents) {\r\n const output = parse(contents, {\r\n columns: true,\r\n skip_empty_lines: true\r\n });\r\n\r\n // Call build function. Interpret and construct Org Chart\r\n buildOutput(output);\r\n}", "parse(parser) {\n this._processor = this._process(parser);\n this._processor.next();\n }", "async parse(options = {}) {\n if (!this.file.path) {\n throw new Error(`Missing underlying file component with a path.`)\n }\n\n const { code, ast, meta } = await require('@skypager/helpers-mdx')(this.content, {\n filePath: this.file.path,\n ...options,\n rehypePlugins: [\n () => tree => {\n this.state.set('rehypeAst', tree)\n return tree\n },\n ],\n babel: false,\n })\n\n this.state.set('parsed', true)\n this.state.set('parsedContent', code)\n\n return { ast, code, meta }\n }", "function parse(filename, callback) { \n //run the command\n exec('alpr -j -c us '+ filename, function(error, stdout, stderr) {\n // if null, bad things\n if(error != null)\n {\n // if error, bad things\n console.log('oh no');\n }\n output = JSON.parse(stdout);\n callback(output.results[0]);\n });\n}", "function parseVastSource(source){\n\t\tvar xdoc, parser;\n\t\t\n\t\tparser = new DOMParser();\n\t\txdoc = parser.parseFromString(source, 'text/xml');\n\t\t\n\t\treturn new VastDoc(xdoc);\n\t\n\t}", "constructor(file) {\n this._file = file\n this.size = file.size\n }", "function Parser() {\n var nodeFactory = arguments.length <= 0 || arguments[0] === undefined ? new _nodeFactory.NodeFactory() : arguments[0];\n\n _classCallCheck(this, Parser);\n\n this.nodeFactory = nodeFactory;\n }", "function parseQML(src, file) {\n loadParser();\n QmlWeb.parse.nowParsingFile = file;\n var parsetree = QmlWeb.parse(src, QmlWeb.parse.QmlDocument);\n return convertToEngine(parsetree);\n}", "function parseLiveFile(e) {\n if (e.document.isUntitled) {\n return;\n }\n if (e.document.languageId !== 'go') {\n return;\n }\n if (!goLiveErrorsEnabled()) {\n return;\n }\n if (runner != null) {\n clearTimeout(runner);\n }\n runner = setTimeout(() => {\n processFile(e);\n runner = null;\n }, config_1.getGoConfig(e.document.uri)['liveErrors']['delay']);\n}", "function Parser() {\n}", "function Parser() {\n}", "function parse(src) {\n return new recast.types.NodePath(recast.parse(stringify(src)).program);\n}", "async load (filePath) {\n console.log(`Deserializing from ${filePath}`)\n this.data = this.formatStrategy.deserialize(\n await fs.readFile(filePath, 'utf-8')\n )\n }", "function TorrentParser() {\n ModelParser.call(this);\n\n this.on('string', function(string) {\n\t\tif (!this.infoHasher &&\n\t\t string.length == 4 && // avoid converting long buffers to strings\n\t\t string.toString() == 'info') {\n\t\t // Start infoHash\n\t\t this.infoStart = this.pos + 1;\n\t\t this.levels = 0;\n\t\t this.infoHasher = new crypto.createHash('sha1');\n\t\t}\n\t });\n this.on('list', function() {\n\t\tif (this.levels !== undefined)\n\t\t this.levels++;\n\t });\n this.on('dict', function() {\n\t\tif (this.levels !== undefined)\n\t\t this.levels++;\n\t });\n this.on('up', function() {\n\t\tif (this.levels !== undefined) {\n\t\t this.levels--;\n\n\t\t if (this.levels == 0) {\n\t\t\t// Finalize infoHash\n\t\t\tthis.infoHasher.update(this.currentBuffer.slice(this.infoStart, this.pos + 1));\n\t\t\tvar infoHex = this.infoHasher.digest('hex');\n\t\t\tthis.emit('infoHex', infoHex);\n\n\t\t\tdelete this.levels;\n\t\t\tdelete this.infoHasher;\n\t\t\tdelete this.infoStart;\n\t\t }\n\t\t}\n\t });\n this.on('parsed', function(pos) {\n\t\tthis.pos = pos;\n\t });\n}", "function parseFile(event) {\n Papa.parse(event.target.files[0], {\n complete: function (results) {\n console.log(results.data)\n setParse(results.data);\n setIsReady(true)\n }\n })\n }", "constructor( parser ){ \n super()\n this.parser = parser \n }", "async load(path) {\n\t\tlet file = await vfile.read({ path, cwd: this.options.cwd }, 'utf8');\n\n\t\tfile.data.frontmatter = {};\n\n\t\t// Load frontmatter from external file\n\t\tlet fm_path = resolve(this.options.cwd, this.options.frontmatter_path);\n\t\tif (await exists(fm_path)) {\n\t\t\tfile.data.frontmatter = JSON.parse(await readFile(fm_path, 'utf8'));\n\t\t}\n\n\t\t// Load file stats\n\t\tlet stats = await stat(resolve(file.cwd, file.path));\n\t\tfile.data.stats = {\n\t\t\tdate: new Date(stats.birthtimeMs),\n\t\t\tupdated: new Date(stats.mtimeMs)\n\t\t};\n\n\t\tthis.file = file;\n\n\t\t__posts__.set(this.file.path, this);\n\t}", "parseU() {\n\t\tif (this.tid === Parser.OP_ADD) {\n\t\t\tthis.lex();\n\t\t\treturn this.parseV();\n\t\t}\n\t\telse if (this.tid === Parser.OP_SUB) {\n\t\t\tthis.lex();\n\t\t\treturn -this.parseV();\n\t\t}\n\t\telse {\n\t\t\treturn this.parseV();\n\t\t}\n\t}", "function parse(input, options) {\n return Parser.parse(input, options)\n }", "function parse(input, options) {\n return Parser.parse(input, options)\n }", "function parse(input, options) {\n return Parser.parse(input, options)\n }", "constructor( filename )\r\n { super( \"position\", \"normal\", \"texture_coord\" );\r\n // Begin downloading the mesh. Once that completes, return\r\n // control to our parse_into_mesh function.\r\n this.load_file( filename );\r\n }", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "parseFile(file) {\r\n this._lines = [];\r\n this._currentLine = -1;\r\n this._resetStates();\r\n\r\n lineReader.eachLine(file, (line) => {\r\n this._lines.push(ParseUtil.clearCRLF(line));\r\n }).then(()=>{\r\n this._linesGenerator = this.lineReader();\r\n this._readNextLine();\r\n });\r\n }", "function IniFile(parent, file) {\n this.parent = parent;\n this.file = file;\n this.saving = false;\n this.savingCb = null;\n\n let fileContent = \"\";\n try {\n fileContent = fs.readFileSync(file, \"utf8\");\n } catch (ex) {}\n let rawLines = fileContent.split(\"\\n\");\n let head = this.head = new IniLine(this);\n let tail = this.tail = new IniLine(this);\n head.next = tail;\n tail.prev = head;\n\n // Each group keeps its own list of lines\n let group = new IniGroup(this, \"_\");\n let groups = this.groups = {_: group};\n\n // Now read it all in\n while (rawLines.length) {\n let lineParts = getLine(rawLines);\n let rawLine = lineParts.rawLine;\n let line = lineParts.line;\n let il;\n let res;\n\n if (rawLine === \"\" && rawLines.length === 0)\n break;\n\n if ((res = headerRE.exec(line)) !== null) {\n // It's a group header\n if (res[1] in groups) {\n group = groups[res[1]];\n } else {\n group = groups[res[1]] = new IniGroup(this, res[1]);\n }\n\n il = new IniLine(this, rawLine, res[1]);\n\n } else if ((res = entryRE.exec(line)) !== null) {\n // It's an entry\n il = new IniLine(this, rawLine, (res[1].length?res[2]:null), res[4], res[5], res[7]);\n\n } else {\n // Unknown/other\n il = new IniLine(this, rawLine);\n\n }\n\n group.push(il);\n this.push(il);\n }\n}", "static deserialize(fileString)\n {\n // split head and data parts\n let m = fileString.match(/[^\\n]*\\n/)\n if (m === null)\n throw new Error(\"File has bad format - head not found.\")\n let head = m[0]\n let data = fileString.slice(head.length)\n\n // check file version\n if (head != \"v1.0.0\\n\")\n throw new Error(\"File version is not compatible.\")\n\n // parse data\n data = JSON.parse(data)\n\n // load the file\n let file = new File()\n\n file.meta = data.meta\n file.accounts = data.accounts.map(x => Account.deserialize(x))\n file.transactions = data.transactions.map(\n x => Transaction.deserialize(x, file.getAccount.bind(file))\n )\n\n return file\n }", "function load() {\n // Get the file selected by user through file opening dialog\n let file = document.getElementById(\"fileLoader\").files[0];\n // Convert file to stream then put its content in \"editor\" div\n file.text().then(text => {\n editor.innerText = text;\n parse();\n }); \n}", "load(file) {\n this._loading = file;\n\n // Read file and split into lines\n const map = {};\n\n const content = fs.readFileSync(file, 'ascii');\n const lines = content.split(/[\\r\\n]+/);\n\n lines.forEach(line => {\n // Clean up whitespace/comments, and split into fields\n const fields = line.replace(/\\s*#.*|^\\s*|\\s*$/g, '').split(/\\s+/);\n map[fields.shift()] = fields;\n });\n\n this.define(map);\n\n this._loading = null;\n }", "function VFile(options) {\n var prop\n var index\n\n if (!options) {\n options = {}\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options}\n } else if ('message' in options && 'messages' in options) {\n return options\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options)\n }\n\n this.data = {}\n this.messages = []\n this.history = []\n this.cwd = proc.cwd()\n\n // Set path related properties in the correct order.\n index = -1\n\n while (++index < order.length) {\n prop = order[index]\n\n if (own.call(options, prop)) {\n this[prop] = options[prop]\n }\n }\n\n // Set non-path related properties.\n for (prop in options) {\n if (order.indexOf(prop) < 0) {\n this[prop] = options[prop]\n }\n }\n}", "function VFile(options) {\n var prop\n var index\n\n if (!options) {\n options = {}\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options}\n } else if ('message' in options && 'messages' in options) {\n return options\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options)\n }\n\n this.data = {}\n this.messages = []\n this.history = []\n this.cwd = proc.cwd()\n\n // Set path related properties in the correct order.\n index = -1\n\n while (++index < order.length) {\n prop = order[index]\n\n if (own.call(options, prop)) {\n this[prop] = options[prop]\n }\n }\n\n // Set non-path related properties.\n for (prop in options) {\n if (order.indexOf(prop) < 0) {\n this[prop] = options[prop]\n }\n }\n}", "function parseFile(str) {\n\n\t\t// Verifying str type\n\t\tif (typeof str !== 'string') {\n\t\t\talert('Sorry... we had a uhh... error parsing?');\n\t\t\treturn;\n\t\t}\n\n\t\t// RegEx is a blast -_-\n\t\tlet newParsedArr = str.match(/['\"].*?['\"]/g).map(item => {\n\t\t\treturn item.replace(/['\"]/g, \"\");\n\t\t});\n\t\tformatPaths(newParsedArr);\n\t}", "function Parser(text) {\n if (typeof text !== 'string') {\n throw new Error('not a string');\n }\n this.text = text.trim();\n this.level = 0;\n this.place = 0;\n this.root = null;\n this.stack = [];\n this.currentObject = null;\n this.state = NEUTRAL;\n}", "function Parser(text) {\n if (typeof text !== 'string') {\n throw new Error('not a string');\n }\n this.text = text.trim();\n this.level = 0;\n this.place = 0;\n this.root = null;\n this.stack = [];\n this.currentObject = null;\n this.state = NEUTRAL;\n}", "function Parser(text) {\n if (typeof text !== 'string') {\n throw new Error('not a string');\n }\n this.text = text.trim();\n this.level = 0;\n this.place = 0;\n this.root = null;\n this.stack = [];\n this.currentObject = null;\n this.state = NEUTRAL;\n}", "function Parser(text) {\n if (typeof text !== 'string') {\n throw new Error('not a string');\n }\n this.text = text.trim();\n this.level = 0;\n this.place = 0;\n this.root = null;\n this.stack = [];\n this.currentObject = null;\n this.state = NEUTRAL;\n}", "function VFile(options) {\n var prop\n var index\n var length\n\n if (!options) {\n options = {}\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options}\n } else if ('message' in options && 'messages' in options) {\n return options\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options)\n }\n\n this.data = {}\n this.messages = []\n this.history = []\n this.cwd = process.cwd()\n\n // Set path related properties in the correct order.\n index = -1\n length = order.length\n\n while (++index < length) {\n prop = order[index]\n\n if (own.call(options, prop)) {\n this[prop] = options[prop]\n }\n }\n\n // Set non-path related properties.\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop]\n }\n }\n}", "function Parser()\n{\n this.pathArray = [];\n \n this.onopentag = function(path, node) { }\n this.onclosetag = function(path) { }\n this.ontext = function(path, text) { }\n \n this.parse = function(xmlSource) {\n this.pathArray = [];\n this.path = '';\n \n var parser = sax.parser(true);\n \n parser.onopentag = function(node) {\n this.pathArray.push(node.name);\n this.path = this.pathArray.join(\".\");\n \n this.onopentag(this.path, node);\n }.bind(this);\n \n parser.ontext = function(text) {\n this.ontext(this.path, text);\n }.bind(this);\n \n parser.onclosetag = function() {\n this.onclosetag(this.path);\n this.pathArray.pop();\n this.path = this.pathArray.join(\".\");\n }.bind(this);\n \n parser.write(xmlSource).close();\n }\n}", "function process(file, enc, callback) {\n /*jshint validthis:true*/\n\n // Do nothing if no contents\n if (file.isNull()) {\n return callback();\n }\n if (file.isStream()) {\n this.emit(\"error\",\n new gutil.PluginError(PLUGIN_NAME, \"Stream content is not supported\"));\n return callback();\n }\n // check if file.contents is a `Buffer`\n if (file.isBuffer() || file.isFile()) {\n var parser = imagesize.Parser();\n\n var retStatus = parser.parse(file.contents);\n if (imagesize.Parser.DONE === retStatus) {\n var result = parser.getResult();\n result.file = libpath.relative(file.base, file.path)\n list.push(result);\n }\n }\n return callback();\n }", "function VFile$1(options) {\n var prop;\n var index;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer$1(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options\n }\n\n if (!(this instanceof VFile$1)) {\n return new VFile$1(options)\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = proc$1.cwd();\n\n // Set path related properties in the correct order.\n index = -1;\n\n while (++index < order$3.length) {\n prop = order$3[index];\n\n if (own$c.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n // Set non-path related properties.\n for (prop in options) {\n if (order$3.indexOf(prop) < 0) {\n this[prop] = options[prop];\n }\n }\n}", "function parse(input, options) {\n return Parser.parse(input, options)\n}" ]
[ "0.6035281", "0.599663", "0.59361535", "0.5814588", "0.57627934", "0.57627934", "0.57627934", "0.5695019", "0.565769", "0.5630263", "0.5630263", "0.5630263", "0.5630263", "0.5630263", "0.5630263", "0.5603139", "0.5554233", "0.533918", "0.52537864", "0.5195392", "0.5108613", "0.5074919", "0.5066456", "0.5035245", "0.50212973", "0.49442518", "0.49318975", "0.4864165", "0.48563245", "0.48268306", "0.48268306", "0.48268306", "0.48268306", "0.48268306", "0.48186067", "0.4818527", "0.48111904", "0.48000467", "0.47325137", "0.4697508", "0.4690282", "0.46818942", "0.46721303", "0.46560258", "0.46461684", "0.46347135", "0.46248513", "0.46248513", "0.4615408", "0.45896113", "0.45861462", "0.45818543", "0.45712894", "0.45476878", "0.45474342", "0.45242497", "0.4524243", "0.45194864", "0.4519479", "0.45028597", "0.45019302", "0.45019302", "0.4500855", "0.44769293", "0.44705027", "0.44694564", "0.44648483", "0.44508433", "0.4429083", "0.44191456", "0.44191456", "0.44191456", "0.44163406", "0.4413828", "0.4413828", "0.4413828", "0.4413828", "0.4413828", "0.4413828", "0.44137824", "0.44018838", "0.43958893", "0.43952295", "0.43917474", "0.43842983", "0.43842983", "0.43825507", "0.43766677", "0.43766677", "0.43766677", "0.43766677", "0.43738773", "0.436716", "0.43659607", "0.43617496", "0.43542415" ]
0.57612985
10
Run transforms on a Unist node representation of a file (in string or VFile representation), async.
function run(node, file, cb) { assertNode(node) freeze() if (!cb && typeof file === 'function') { cb = file file = null } if (!cb) { return new Promise(executor) } executor(null, cb) function executor(resolve, reject) { transformers.run(node, vfile(file), done) function done(err, tree, file) { tree = tree || node if (err) { reject(err) } else if (resolve) { resolve(tree) } else { cb(null, tree, file) } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(error, tree, file) {\n tree = tree || node\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(error, tree, file) {\n tree = tree || node\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node);\n freeze();\n\n if (!cb && typeof file === 'function') {\n cb = file;\n file = null;\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done);\n\n function done(error, tree, file) {\n tree = tree || node;\n if (error) {\n reject(error);\n } else if (resolve) {\n resolve(tree);\n } else {\n cb(null, tree, file);\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node);\n freeze();\n\n if (!cb && func(file)) {\n cb = file;\n file = null;\n }\n\n if (!cb) {\n return new Promise(executor);\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done);\n\n function done(err, tree, file) {\n tree = tree || node;\n if (err) {\n reject(err);\n } else if (resolve) {\n resolve(tree);\n } else {\n cb(null, tree, file);\n }\n }\n }\n }", "function transform(context, file, fileSet, next) {\n if (stats(file).fatal) {\n next()\n } else {\n debug('Transforming document `%s`', file.path)\n context.processor.run(context.tree, file, onrun)\n }\n\n function onrun(error, node) {\n debug('Transformed document (error: %s)', error)\n context.tree = node\n next(error)\n }\n}", "_transformFiles(files, done) {\n let transformedFiles = [];\n // Clumsy way of handling asynchronous calls, until I get to add a proper Future library.\n let doneCounter = 0;\n for(let i = 0; i < files.length; i++)this.options.transformFile.call(this, files[i], (transformedFile)=>{\n transformedFiles[i] = transformedFile;\n if (++doneCounter === files.length) done(transformedFiles);\n });\n }", "function transform(file, cb) {\n gutil.log('Preprocessing:', file.path);\n // read and modify file contents\n var fileContents = String(file.contents);\n fileContents = fileContents.replace(/^\\s*(import .*?)(?:;|$)/gm,\n function(str, group1) {\n return 'jsio(\"' + group1 + '\");';\n });\n file.contents = new Buffer(fileContents);\n\n // if there was some error, just pass as the first parameter here\n cb(null, file);\n }", "async function main() {\n const resolvedPaths = globby.sync(files as string[])\n const transformationModule = loadTransformationModule(transformationName)\n\n log(`Processing ${resolvedPaths.length} files…`)\n\n for (const p of resolvedPaths) {\n debug(`Processing ${p}…`)\n const fileInfo = {\n path: p,\n source: fs.readFileSync(p).toString(),\n }\n try {\n const result = runTransformation(\n fileInfo,\n transformationModule,\n params as object\n )\n fs.writeFileSync(p, result)\n } catch (e) {\n console.error(e)\n }\n }\n}", "function transformFileSync(filename) {\n\t var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n\t opts.filename = filename;\n\t return _transformation2[\"default\"](_fs2[\"default\"].readFileSync(filename, \"utf8\"), opts);\n\t}", "function transformFileSync(filename) {\n\t var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n\t opts.filename = filename;\n\t return _transformation2[\"default\"](_fs2[\"default\"].readFileSync(filename, \"utf8\"), opts);\n\t}", "function tjs_gulp_transformFile(file) {\n\t// console.log(file)\n\treturn `gulp.task('${file.file}', function() {\n\tlet pipe = gulp.src('${file.file}', { base: __dirname })\n\n\t// pre-piping\n\tif (typeof __t.start == 'function')\n\t\tpipe = pipe.pipe(__t.start.bind(pipe)())\n\n\t${file.transforms.length == 0 ? `if (typeof __t.blank == 'function') pipe = __t.blank.bind(pipe)()` : ''}\n\n\t${file.transforms.map(t => `// pipe setup for ${t.name}\n\tpipe = __t.${t.name}.bind(pipe)${t.argsTuple}\n\tif (typeof __t.each == 'function') pipe = pipe.pipe(__t.each.bind(pipe)())`).join('\\n\\t')}\n\n\t// post-piping\n\tif (typeof __t.finish == 'function')\n\t\tpipe = pipe.pipe(__t.finish.bind(pipe)())\n\t\n\treturn pipe\n})`\n}", "function transformFileSync(filename) {\n var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n opts.filename = filename;\n return _transformation2[\"default\"](_fs2[\"default\"].readFileSync(filename, \"utf8\"), opts);\n}", "async transform(mode) {\n // console.log('Mode:', mode, '->');\n try {\n const buffer = await readFile(`${this.file}`);\n\n // console.log('buffer argument:', buffer);\n\n let transformed;\n switch (mode) {\n // case 'soRandom':\n // case 'random':\n // transformed = await soRandom(buffer);\n // break;\n case 'shave':\n transformed = await shave(buffer);\n break;\n case 'angelOfMusic':\n case 'phantom':\n transformed = await angelOfMusic(buffer);\n break;\n case 'grayscale':\n case 'greyscale':\n transformed = await greyscale(buffer);\n break;\n // case 'randomlyPastel':\n // case 'pastel':\n // transformed = await randomlyPastel(buffer);\n // break;\n default:\n // console.log(`Something is wrong. Output not modified.`);\n transformed = buffer;\n break;\n }\n\n writeFile(`${__dirname}/transformations/${transformed.output}`, transformed.buffer);\n console.log(transformed.message);\n } catch (err) {\n console.error('There was an error transforming your file:', err);\n }\n }", "function transform(src, filename, options) {\n validateArguments(src, filename);\n return new Promise((resolve, reject) => {\n try {\n const res = transformSync(src, filename, options);\n resolve(res);\n }\n catch (error) {\n reject(error);\n }\n });\n}", "function transform$5(context, file, fileSet, next) {\n if (stats$4(file).fatal) {\n next();\n } else {\n debug$7('Transforming document `%s`', file.path);\n context.processor.run(context.tree, file, onrun);\n }\n\n function onrun(error, node) {\n debug$7('Transformed document (error: %s)', error);\n context.tree = node;\n next(error);\n }\n}", "transformFile(data, filePath) {\n this.updateBabelConfig(filePath);\n return babel.transformSync(data, this.babelConfig.options);\n }", "runTransformation(input) {\n return this.transform(input)\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze();\n assertParser('process', processor.Parser);\n assertCompiler('process', processor.Compiler);\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n var file = vfile(doc);\n\n pipeline.run(processor, {file: file}, done);\n\n function done(error) {\n if (error) {\n reject(error);\n } else if (resolve) {\n resolve(file);\n } else {\n cb(null, file);\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(error) {\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(error) {\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze();\n assertParser('process', processor.Parser);\n assertCompiler('process', processor.Compiler);\n\n if (!cb) {\n return new Promise(executor);\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n var file = vfile(doc);\n\n pipeline.run(processor, {file: file}, done);\n\n function done(err) {\n if (err) {\n reject(err);\n } else if (resolve) {\n resolve(file);\n } else {\n cb(null, file);\n }\n }\n }\n }", "function transformFile(filename, opts, callback) {\n\t if (_lodashLangIsFunction2[\"default\"](opts)) {\n\t callback = opts;\n\t opts = {};\n\t }\n\n\t opts.filename = filename;\n\n\t _fs2[\"default\"].readFile(filename, function (err, code) {\n\t if (err) return callback(err);\n\n\t var result;\n\n\t try {\n\t result = _transformation2[\"default\"](code, opts);\n\t } catch (err) {\n\t return callback(err);\n\t }\n\n\t callback(null, result);\n\t });\n\t}", "function transformFile(filename, opts, callback) {\n\t if (_lodashLangIsFunction2[\"default\"](opts)) {\n\t callback = opts;\n\t opts = {};\n\t }\n\n\t opts.filename = filename;\n\n\t _fs2[\"default\"].readFile(filename, function (err, code) {\n\t if (err) return callback(err);\n\n\t var result;\n\n\t try {\n\t result = _transformation2[\"default\"](code, opts);\n\t } catch (err) {\n\t return callback(err);\n\t }\n\n\t callback(null, result);\n\t });\n\t}", "async function transform(file, dir = 'lib') {\n const dest = file.replace('/src/', `/${dir}/`)\n await fs.ensureDir(path.dirname(dest))\n\n if (fs.statSync(file).isDirectory()) return\n\n if (file.endsWith('.svelte')) {\n const source = await fs.readFile(file, 'utf8')\n const item = await preprocess(\n source,\n autoprocessor({\n typescript: {\n tsconfigFile: path.resolve(rootDir, 'tsconfig-base.json'),\n },\n // https://github.com/sveltejs/svelte/issues/189#issuecomment-586142198\n replace: [\n [/(>)[\\s]*([<{])/g, '$1$2'],\n [/({[/:][a-z]+})[\\s]*([<{])/g, '$1$2'],\n [/({[#:][a-z]+ .+?})[\\s]*([<{])/g, '$1$2'],\n [/([>}])[\\s]+(<|{[/#:][a-z][^}]*})/g, '$1$2'],\n ],\n }),\n {\n filename: file,\n }\n )\n await fs.writeFile(\n dest,\n item.code.replace('<script lang=\"ts\">', '<script>')\n )\n } else {\n await fs.copyFile(file, dest)\n }\n}", "function parse(file) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2\n /*return*/\n , new Promise(function (resolve, reject) {\n fs.readFile(file, 'utf8', function (err, data) {\n if (err) {\n reject(err);\n return;\n }\n\n resolve(parseString(data));\n });\n })];\n });\n });\n }", "async function treeify(forEachFile) {\n const treeRoot = process.cwd()\n const ignorePattern = await _ignore()\n const tree = gl.baseCase\n\n if (await fs.pathExists(treeRoot)) {\n await Promise.all((await rget(treeRoot, ignorePattern)).map(file => forEachFile(tree, file)))\n }\n return tree\n}", "async processFile(hndl) {\n }", "async processFile(hndl) {\n }", "async function image(file) {\n const decoded = tf.node.decodeImage(file);\n const casted = decoded.toFloat();\n const result = casted.expandDims(0);\n decoded.dispose();\n casted.dispose();\n return result;\n}", "function transformSync(src, filename, options) {\n validateArguments(src, filename);\n const normalizedOptions = options_1.validateTransformOptions(options);\n return transformFile(src, filename, normalizedOptions);\n}", "static transform() {}", "function transform(file, cb) {\n // read and modify file contents\n console.log(file.history[0]);\n var lines = String(file.contents).replace(/\\r\\n/g, '\\n').split('\\n');\n var files = [];\n var found = false;\n\n for (var i = 0; i < lines.length; i++) {\n lines[i] = lines[i].replace(/http:\\/\\/www\\.iobroker\\.net\\/wp-content\\/uploads\\/\\//g, 'http://iobroker.net/wp-content/uploads/');\n lines[i] = lines[i].replace(/http:\\/\\/www\\.iobroker\\.net\\/wp-content\\/uploads\\//g, 'http://iobroker.net/wp-content/uploads/');\n lines[i] = lines[i].replace(/http:\\/\\/iobroker\\.net\\/wp-content\\/uploads\\/\\//g, 'http://iobroker.net/wp-content/uploads/');\n // [![](http://www.iobroker.net/wp-content/uploads//email_set.png)](http://www.iobroker.net/wp-content/uploads//email_set.png)]\n var m = lines[i].match(/(\\[caption[^\\]]*\\])?\\!\\[[^\\]]*\\]\\(http:\\/\\/iobroker\\.net\\/[^\\)]+\\)(\\]\\([^\\)]*\\))?\\]?(.*\\[\\/caption\\])?/g);\n if (m) {\n for (var j = 0; j < m.length; j++) {\n found = true;\n // try to extract caption\n var caption = m[j].match(/\\)\\]?(.+)\\[\\/caption\\]/);\n if (caption) {\n caption = caption[1].trim();\n }\n\n // change it to \\n![](img/filename_oldf_filename)\\n\n var mm = m[j].split('](')[1];\n mm = mm.replace(/\\).*$/, '');\n // noe we have \"http://www.iobroker.net/wp-content/uploads/email_set.png\"\n var fileName = mm.split('/').pop();\n var mdPath = file.history[0].replace(/\\\\/g, '/');\n var parts = mdPath.split('/');\n var mdFileName = parts.pop().replace(/\\.md$/, '');\n mdPath = parts.join('/');\n\n var task = {url: mm, name: mdPath + '/img/' + mdFileName + '_' + fileName, relative: 'img/' + mdFileName + '_' + fileName};\n bigTasks.push(task);\n lines[i] = lines[i].replace(m[j], '\\n![' + (caption || '') + '](' + task.relative + ')\\n');\n }\n }\n }\n /*downloadFiles(files, [], function (err) {\n if (found && (!err || !err.length)) {\n console.log('Write modified ' + file.history[0]);\n //file.contents = new Buffer(lines.join('\\n'));\n }\n\n // if there was some error, just pass as the first parameter here\n cb(null, file);\n });*/\n cb(null, file);\n }", "async transform() {\n if (this.options.minify) {\n await uglify(this);\n }\n }", "function Transform() {}", "function Transform() {}", "function Transform() {}", "function Transform() {}", "function Transform() {}", "function parse( file ) {\n\t\treturn __awaiter( this, void 0, void 0, function () {\n\t\t\treturn __generator( this, function ( _a ) {\n\t\t\t\treturn [\n\t\t\t\t\t2,\n\t\t\t\t\t/*return*/\n\t\t\t\t\tnew Promise( function ( resolve, reject ) {\n\t\t\t\t\t\tfs.readFile( file, 'utf8', function ( err, data ) {\n\t\t\t\t\t\t\tif ( err ) {\n\t\t\t\t\t\t\t\treject( err );\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tresolve( parseString( data ) );\n\t\t\t\t\t\t} );\n\t\t\t\t\t} ),\n\t\t\t\t];\n\t\t\t} );\n\t\t} );\n\t}", "function applyTransform(path, data, callback) {\n if(typeof data === \"function\") {\n callback = data;\n data = null;\n }\n\n var transform = getTransform(path);\n if(!transform) {\n return callback(null);\n }\n\n function _applyTransform(path, data) {\n transform.transform(path, data, function(err, transformed) {\n if(err) {\n console.error(\"[Bramble Error] unable to transform file\", path, err);\n return callback(err);\n }\n\n var transformedPath = transform.rewritePath(path);\n\n _fs.writeFile(transformedPath, transformed, function(err) {\n if(err) {\n console.error(\"[Bramble Error] unable to write transformed file\", transformedPath, err);\n return callback(err);\n }\n\n Handlers.handleFile(transformedPath, data, function(err) {\n if(err) {\n console.error(\"[Bramble Error] unable to rewrite URL for transformed file\", transformedPath, err);\n return callback(err);\n }\n\n // Refresh the file tree so this new file shows up.\n CommandManager.execute(Commands.FILE_REFRESH).always(callback);\n });\n });\n });\n }\n\n if(!data) {\n _fs.readFile(path, \"utf8\", function(err, data) {\n if(err) {\n if(err.code === \"ENOENT\") {\n // File is being created (not written yet) use empty string\n data = \"\";\n } else {\n // Some other error, send it back\n return callback(err);\n }\n }\n\n _applyTransform(path, data);\n });\n } else {\n _applyTransform(path, data);\n }\n }", "function run(transformer, options) {\n return runFile(process.argv[2], transformer, options);\n}", "function transformFile(filename, opts, callback) {\n if (_lodashLangIsFunction2[\"default\"](opts)) {\n callback = opts;\n opts = {};\n }\n\n opts.filename = filename;\n\n _fs2[\"default\"].readFile(filename, function (err, code) {\n if (err) return callback(err);\n\n var result;\n\n try {\n result = _transformation2[\"default\"](code, opts);\n } catch (err) {\n return callback(err);\n }\n\n callback(null, result);\n });\n}", "function transformerAsync() {\n switch (arguments.length) {\n case 0:\n throw new Error('transformer error: no arguments.')\n case 1: // loading\n return Loader(arguments[0]);\n default: // find conversions\n return transformerAsync.compose(_.toArray(arguments))\n }\n}", "function decodeFile(input) {\n let ondata = (evt, cb) => {\n if (evt.data[0] == 0) {\n cb({raw: evt.data.subarray(1), links: [], data: evt.data.subarray(1)})\n } else if (evt.data[0] == 1) {\n try {\n let node = dagPB.util.deserialize(evt.data.subarray(1))\n\n let file = Unixfs.unmarshal(node.Data)\n if (file.type != \"raw\" && file.type != \"file\") {\n throw new Error(\"got unexpected file type, wanted raw or file\")\n }\n if (file.data == null) {\n file.data = Buffer.alloc(0)\n }\n\n cb({raw: evt.data.subarray(1), links: node.Links, data: file.data})\n } catch (err) {\n cb(null, err)\n }\n } else {\n cb(null, new Error(\"failed to decode a chunk of file data\"))\n }\n }\n\n return asynchronous(input, ondata)\n}", "function processFile (inputLoc, out, replacements) {\n var file = urlRegex.test(inputLoc) ?\n hyperquest(inputLoc) :\n fs.createReadStream(inputLoc, encoding)\n\n file.pipe(bl(function (err, data) {\n if (err) throw err\n\n data = data.toString()\n replacements.forEach(function (replacement) {\n data = data.replace.apply(data, replacement)\n })\n if (inputLoc.slice(-3) === '.js') {\n const transformed = babel.transform(data, {\n plugins: [\n 'transform-es2015-parameters',\n 'transform-es2015-arrow-functions',\n 'transform-es2015-block-scoping',\n 'transform-es2015-template-literals',\n 'transform-es2015-shorthand-properties',\n 'transform-es2015-for-of',\n 'transform-es2015-destructuring'\n ]\n })\n data = transformed.code\n }\n fs.writeFile(out, data, encoding, function (err) {\n if (err) throw err\n\n console.log('Wrote', out)\n })\n }))\n}", "function run(transformer, options) {\n\t return runFile(process.argv[2], transformer, options);\n\t}", "function processSVGImage(i, inputFile, outputFile) {\n console.log(\"processSVGImage:\" + i + \",\" + inputFile + \",output:\" + outputFile);\n\n // pretty print the input file first\n xmlFormat(tempDir + \"/\" + inputFile + \".svg\");\n // var processBg = new transform();\n // processBg._transform = function (data, encoding, cb) {\n // // do transformation\n // cb(null, tools.processData(data,processBgImg));\n // };\n\n var removeBd = new transform();\n removeBd._transform = function (data, encoding, cb) {\n // do transformation\n cb(null, tools.processData(data, removeBdTag));\n };\n var removeXMLSpacePreserve = new transform();\n removeXMLSpacePreserve._transform = function (data, encoding, cb) {\n // do transformation\n cb(null, tools.processData(data, removeXMLSpacePreserveTag));\n };\n var processNt = new transform();\n processNt._transform = function (data, encoding, cb) {\n // do transformation\n cb(null, tools.processData(data, processNtTag));\n };\n\n var processTextLine = new transform();\n processTextLine._transform = function (data, encoding, cb) {\n // do transformation\n cb(null, tools.processData(data, processTextTag));\n };\n\n var processImageLine = new transform();\n processImageLine._transform = function (data, encoding, cb) {\n // do transformation\n cb(null, tools.processData(data, processImageTag));\n };\n\n // var getFonts = new transform();\n // getFonts._transform = function (data, encoding, cb) {\n // // do transformation\n // cb(null, tools.processData(data, getFontsList));\n // };\n var addFonts = new transform();\n addFonts._transform = function (data, encoding, cb) {\n // do transformation\n // console.log(\"transform:\" + fontList[i]);\n cb(null, tools.processData(data, addFontsLine, fontList[i]));\n };\n\n var inputPath = tempDir + \"/\" + inputFile + \".svg\";\n var inputStream1 = fs.createReadStream(inputPath);\n var outputPath = tempDir + \"/\" + outputFile + \".svg\";\n var outputStream1 = fs.createWriteStream(outputPath);\n inputStream1\n .pipe(removeBd)\n .pipe(removeXMLSpacePreserve)\n .pipe(processNt)\n .pipe(processTextLine)\n .pipe(processImageLine)\n .pipe(addFonts)\n .pipe(outputStream1);\n\n setTimeout(function () {\n xmlFormat(outputPath)\n }, 2000);\n // delay 2 seconds for the first round is over\n // setTimeout(function () {\n // console.log(\"start second round\");\n // var inputStream2 = fs.createReadStream(outputPath);\n // outputPath = tempDir + \"/\" + outputFile + \".svg\";\n // var outputStream2 = fs.createWriteStream(outputPath);\n // inputStream2\n // .pipe(addFonts)\n // .pipe(outputStream2);\n // }, 2000);\n\n}", "async transform(chunk, encoding, cb) {\n\n // DRY method for handling each chunk as it comes in\n const do_transform = () => {\n // Write data to our fork stream. If it fails,\n // emit a 'drain' event\n if (!this._fork_stream.write(chunk)) {\n this._fork_stream.once('drain', () => {\n cb(null, chunk);\n });\n } else {\n // Push data back out to whatever is listening (if anything)\n // and let Node know we're ready for more data\n cb(null, chunk);\n }\n };\n\n // DRY method for handling errors when the arise from the\n // ClamAV Socket connection\n const handle_error = (err, is_infected=null, result=null) => {\n this._fork_stream.unpipe();\n this._fork_stream.destroy();\n this._clamav_transform.destroy();\n clear_scan_benchmark();\n\n // Finding an infected file isn't really an error...\n if (is_infected === true) {\n if (_scan_complete === false) {\n _scan_complete = true;\n this.emit('scan-complete', result);\n }\n this.emit('stream-infected', result); // just another way to catch an infected stream\n } else {\n this.emit('error', err);\n }\n };\n\n // If we haven't initialized a socket connection to ClamAV yet,\n // now is the time...\n if (!this._clamav_socket) {\n // We're using a PassThrough stream as a middle man to fork the input\n // into two paths... (1) ClamAV and (2) The final destination.\n this._fork_stream = new PassThrough();\n // Instantiate our custom Transform stream that coddles\n // chunks into the correct format for the ClamAV socket.\n this._clamav_transform = new NodeClamTransform({}, me.settings.debug_mode);\n // Setup an array to collect the responses from ClamAV\n this._clamav_response_chunks = [];\n\n try {\n // Get a connection to the ClamAV Socket\n this._clamav_socket = await me._init_socket('passthrough');\n if (me.settings.debug_mode) console.log(`${me.debug_label}: ClamAV Socket Initialized...`);\n\n // Setup a pipeline that will pass chunks through our custom Tranform and on to ClamAV\n this._fork_stream.pipe(this._clamav_transform).pipe(this._clamav_socket);\n\n // When the CLamAV socket connection is closed (could be after 'end' or because of an error)...\n this._clamav_socket.on('close', hadError => {\n if (me.settings.debug_mode) console.log(`${me.debug_label}: ClamAV socket has been closed! Because of Error:`, hadError);\n })\n // When the ClamAV socket connection ends (receives chunk)\n .on('end', () => {\n if (me.settings.debug_mode) console.log(`${me.debug_label}: ClamAV socket has received the last chunk!`);\n // Process the collected chunks\n const response = Buffer.concat(this._clamav_response_chunks);\n const result = me._process_result(response.toString('utf8'), null);\n this._clamav_response_chunks = [];\n if (me.settings.debug_mode) {\n console.log(`${me.debug_label}: Result of scan:`, result);\n console.log(`${me.debug_label}: It took ${_av_scan_time} seconds to scan the file(s).`);\n clear_scan_benchmark();\n }\n\n // NOTE: \"scan-complete\" could be called by the `handle_error` method.\n // We don't want to to double-emit this message.\n if (_scan_complete === false) {\n _scan_complete = true;\n this.emit('scan-complete', result);\n }\n })\n // If connection timesout.\n .on('timeout', () => {\n this.emit('timeout', new Error('Connection to host/socket has timed out'));\n if (me.settings.debug_mode) console.log(`${me.debug_label}: Connection to host/socket has timed out`);\n })\n // When the ClamAV socket is ready to receive packets (this will probably never fire here)\n .on('ready', () => {\n if (me.settings.debug_mode) console.log(`${me.debug_label}: ClamAV socket ready to receive`);\n })\n // When we are officially connected to the ClamAV socket (probably will never fire here)\n .on('connect', () => {\n if (me.settings.debug_mode) console.log(`${me.debug_label}: Connected to ClamAV socket`);\n })\n // If an error is emitted from the ClamAV socket\n .on('error', err => {\n console.error(`${me.debug_label}: Error emitted from ClamAV socket: `, err);\n handle_error(err);\n })\n // If ClamAV is sending stuff to us (ie, an \"OK\", \"Virus FOUND\", or \"ERROR\")\n .on('data', cv_chunk => {\n // Push this chunk to our results collection array\n this._clamav_response_chunks.push(cv_chunk);\n if (me.settings.debug_mode) console.log(`${me.debug_label}: Got result!`, cv_chunk.toString());\n\n // Parse what we've gotten back from ClamAV so far...\n const response = Buffer.concat(this._clamav_response_chunks);\n const result = me._process_result(response.toString(), null);\n\n // If there's an error supplied or if we detect a virus, stop stream immediately.\n if (result instanceof NodeClamError || (typeof result === 'object' && 'is_infected' in result && result.is_infected === true)) {\n // If a virus is detected...\n if (typeof result === 'object' && 'is_infected' in result && result.is_infected === true) {\n // handle_error(new NodeClamError(result, `Virus(es) found! ${'viruses' in result && Array.isArray(result.viruses) ? `Suspects: ${result.viruses.join(', ')}` : ''}`));\n handle_error(null, true, result);\n }\n // If any other kind of error is detected...\n else {\n handle_error(result);\n }\n }\n // For debugging purposes, spit out what was processed (if anything).\n else {\n if (me.settings.debug_mode) console.log(`${me.debug_label}: Processed Result: `, result, response.toString());\n }\n });\n\n if (me.settings.debug_mode) console.log(`${me.debug_label}: Doing initial transform!`);\n // Handle the chunk\n do_transform();\n } catch (err) {\n // If there's an issue connecting to the ClamAV socket, this is where that's handled\n if (me.settings.debug_mode) console.error(`${me.debug_label}: Error initiating socket to ClamAV: `, err);\n handle_error(err);\n }\n } else {\n //if (me.settings.debug_mode) console.log(`${me.debug_label}: Doing transform: ${++counter}`);\n // Handle the chunk\n do_transform();\n }\n }", "function makeTransform(registry) {\n\n return function(filename, options) {\n options = options || {};\n\n var registry = registry || registryFromOptions(options);\n\n return aggregate(function(src) {\n try {\n src = jstransform(src);\n } catch(err) {\n return this.emit('error', err);\n }\n this.queue(src);\n this.queue(null);\n });\n }\n}", "function _transform(node, callback) {\n return node.map(function (child, path, parent) {\n var replacement = callback(child, path, parent);\n return _transform(replacement, callback);\n });\n }", "function _transform (node, callback) {\n return node.map(function(child, path, parent) {\n var replacement = callback(child, path, parent);\n return _transform(replacement, callback);\n });\n }", "function _transform (node, callback) {\n return node.map(function(child, path, parent) {\n var replacement = callback(child, path, parent);\n return _transform(replacement, callback);\n });\n }", "async function uploadFile(file) {\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader()\r\n reader.onloadend = () => {\r\n const buffer = Buffer.from(reader.result)\r\n ipfs.add(buffer)\r\n .then(files => {\r\n resolve(files)\r\n })\r\n .catch(error => reject(error))\r\n }\r\n reader.readAsArrayBuffer(file)\r\n })\r\n}", "function test_transform() {\n var f = function(x) {\n return Number($(x)) + 1;\n };\n\n\n var plan1 = tasks(\"ns:identity\").plan({\n x: [0, 1]\n });\n\n var plan2 = tasks(\"ns:mult\").plan({\n x: transform(f, plan1),\n y: [3, 5]\n });\n\n // Optimize and run\n // Should be an array of XML values 3, 6, 5, 10\n var result = plan2.run();\n check_array(result, [3, 5, 6, 10]);\n}", "function Transform() { // eslint-disable-line no-unused-vars\n\n var request = new XMLHttpRequest();\n\n setLocalStorageItem('code', cppEditor.getValue());\n setLocalStorageItem('insightsOptions', getInsightsOptions());\n\n request.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n var response = JSON.parse(this.responseText);\n cppOutEditor.setValue(response.stdout);\n stdErrEditor.setValue(response.stderr);\n SetRunListeners();\n } else if (this.readyState == 4 && this.status != 200) {\n stdErrEditor.setValue('Sorry, your request failed');\n SetRunListeners();\n }\n };\n\n stdErrEditor.setValue('Waiting for response...');\n\n var url = buildURL('/api/v1/transform');\n\n request.open('POST', url, true);\n request.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');\n\n var data = {};\n\n data.insightsOptions = getInsightsOptions();\n data.code = cppEditor.getValue();\n\n SetWaitForResultListeners();\n request.send(JSON.stringify(data));\n}", "function transform(filename) {\n if (shouldStub(filename)) {\n return reactStub;\n } else {\n var content = fs.readFileSync(filename, 'utf8');\n return ReactTools.transform(content, {harmony: true});\n }\n}", "async function run() {\n\t\t\t\tlet mdast = markdownToMdast(article.content);\n\t\t\t\ttransformRelativeImages(mdast, articleBaseUrl);\n\t\t\t\tlet hast = mdastToHast(mdast);\n\t\t\t\thastHighlight(hast);\n\t\t\t\tlet children = hastToReact(hast);\n\t\t\t\tsetPreview(children);\n\t\t\t}", "function runSync(node, file) {\n var result\n var complete\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(error, tree) {\n complete = true\n result = tree\n bail(error)\n }\n }", "function runSync(node, file) {\n var result\n var complete\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(error, tree) {\n complete = true\n result = tree\n bail(error)\n }\n }", "async processXmlFile(xmlFile) {\n const response = await fetch(xmlFile);\n const xmlData = await response.text();\n\n const parser = new DOMParser();\n const doc = parser.parseFromString(xmlData, \"text/xml\");\n\n this.processDoc(xmlFile, doc);\n }", "async function uploadFile(file) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onloadend = () => {\n const buffer = Buffer.from(reader.result)\n ipfs.add(buffer)\n .then(files => {\n resolve(files)\n })\n .catch(error => reject(error))\n }\n reader.readAsArrayBuffer(file)\n })\n}", "function convert (src, filter) {\n return new Promise((resolve, reject) => {\n fs.readFile(path.join(__dirname, 'uploads', src), (err, buffer) => {\n if (err) return reject(err)\n\n const result = effects.apply(buffer, filter, {})\n resolve(result)\n })\n })\n}", "function runSync(node, file) {\n var result;\n var complete;\n\n run(node, file, done);\n\n assertDone('runSync', 'run', complete);\n\n return result\n\n function done(error, tree) {\n complete = true;\n result = tree;\n bail(error);\n }\n }", "function transmorph( xslSrc, file, filterKey, filterValue )\r\n{\r\n var result = transform( xslSrc, filterKey, filterValue );\r\n saveFile( result, file );\r\n}", "async load () {}", "function runSync(node, file) {\n var complete = false\n var result\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(err, tree) {\n complete = true\n bail(err)\n result = tree\n }\n }", "function runSync(node, file) {\n var complete = false\n var result\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(err, tree) {\n complete = true\n bail(err)\n result = tree\n }\n }", "function runSync(node, file) {\n var complete = false\n var result\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(err, tree) {\n complete = true\n bail(err)\n result = tree\n }\n }", "function runSync(node, file) {\n var complete = false\n var result\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(err, tree) {\n complete = true\n bail(err)\n result = tree\n }\n }", "function runSync(node, file) {\n var complete = false\n var result\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(err, tree) {\n complete = true\n bail(err)\n result = tree\n }\n }", "function runSync(node, file) {\n var complete = false\n var result\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(err, tree) {\n complete = true\n bail(err)\n result = tree\n }\n }", "function processSync(doc) {\n var file;\n var complete;\n\n freeze();\n assertParser('processSync', processor.Parser);\n assertCompiler('processSync', processor.Compiler);\n file = vfile(doc);\n\n process(file, done);\n\n assertDone('processSync', 'process', complete);\n\n return file\n\n function done(error) {\n complete = true;\n bail(error);\n }\n }", "process (filepath) {\n\t\tlet {\n\t\t\tchassis,\n\t\t\tgenerateNamespacedSelector,\n\t\t\tisNamespaced,\n\t\t\tnamespaceSelectors,\n\t\t\tprocessImports,\n\t\t\tprocessNesting,\n\t\t\tprocessAtRules,\n\t\t\tprocessMixins,\n\t\t\tprocessNot,\n\t\t\tprocessFunctions,\n\t\t\tstoreAtRules,\n\t\t\ttypographyEngineIsInitialized\n\t\t} = this\n\n\t\tlet {\n\t\t\tatRules,\n\t\t\tpost,\n\t\t\tsettings,\n\t\t\tutils\n\t\t} = chassis\n\n\t\tlet tasks = new NGN.Tasks()\n\t\tlet sourceMap\n\n\t\ttasks.add('Processing Imports', next => {\n\t\t\tif (typographyEngineIsInitialized) {\n\t\t\t\tthis.tree.walkAtRules('import', atRule => {\n\t\t\t\t\tchassis.imports.push(atRule.params)\n\t\t\t\t\tatRule.remove()\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tprocessImports()\n\t\t\tprocessNesting()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Mixins', next => {\n\t\t\tprocessMixins()\n\t\t\tprocessNot()\n\t\t\tprocessNesting()\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Functions', next => {\n\t\t\tprocessFunctions()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Namespacing Selectors', next => {\n\t\t\tnamespaceSelectors()\n\t\t\tnext()\n\t\t})\n\n\t\tif (typographyEngineIsInitialized) {\n\t\t\ttasks.add('Initializing Typography Engine', next => {\n\t\t\t\tthis.tree = this.core.css.append(this.tree)\n\t\t\t\tnext()\n\t\t\t})\n\t\t}\n\n\t\ttasks.add('Running Post-Processing Routines', next => {\n\t\t\tthis.tree.walkAtRules('chassis-post', atRule => {\n\t\t\t\tlet data = Object.assign({\n\t\t\t\t\troot: this.tree,\n\t\t\t\t\tatRule\n\t\t\t\t}, atRules.getProperties(atRule))\n\n\t\t\t\tpost.process(data)\n\t\t\t})\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing CSS4 Syntax', next => {\n\t\t\tenv.process(this.tree, {from: filepath}, settings.envCfg).then(processed => {\n\t\t\t\tthis.tree = processed.root\n\t\t\t\tnext()\n\t\t\t}, err => console.error(err))\n\t\t})\n\n\t\t// tasks.add('Merging matching adjacent rules...', next => {\n\t\t// \toutput = mergeAdjacentRules.process(output.toString())\n\t\t// \tnext()\n\t\t// })\n\n\t\ttasks.add('Beautifying Output', next => {\n\t\t\tremoveComments.process(this.tree).then(result => {\n\t\t\t\tperfectionist.process(result.css).then(result => {\n\t\t\t\t\tthis.tree = result.root\n\n\t\t\t\t\t// Remove empty rulesets\n\t\t\t\t\tthis.tree.walkRules(rule => {\n\t\t\t\t\t\tif (rule.nodes.length === 0) {\n\t\t\t\t\t\t\trule.remove()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\n\t\t\t\t\tnext()\n\t\t\t\t}, () => {\n\t\t\t\t\tthis.emit('processing.error', new Error('Error Beautifying Output'))\n\t\t\t\t})\n\t\t\t}, () => {\n\t\t\t\tthis.emit('processing.error', new Error('Error Removing Comments'))\n\t\t\t})\n\t\t})\n\n\t\tif (settings.minify) {\n\t\t\tlet minified\n\n\t\t\ttasks.add('Minifying Output', next => {\n\t\t\t\tminified = new CleanCss({\n\t\t\t\t\tsourceMap: settings.sourceMap\n\t\t\t\t}).minify(this.tree.toString())\n\n\t\t\t\tthis.tree = minified.styles\n\t\t\t\tnext()\n\t\t\t})\n\n\t\t\tif (settings.sourceMap) {\n\t\t\t\ttasks.add('Generating source map', next => {\n\t\t\t\t\tsourceMap = minified.sourceMap.toString()\n\t\t\t\t\tnext()\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// tasks.on('taskstart', evt => console.log(`${evt.name}...`))\n\t\t// tasks.on('taskcomplete', evt => console.log('Done.'))\n\n\t\ttasks.on('complete', () => this.emit('processing.complete', {\n\t\t\tcss: this.tree.toString(),\n\t\t\tsourceMap\n\t\t}))\n\n\t\tthis.emit('processing')\n\t\ttasks.run(true)\n\t}", "function processEach(params, file, done) {\r\n console.log(\"Parsing file: \", file);\r\n parseUtils\r\n .parseFile(file)\r\n .then(function(parseResult) {\r\n // save the original source code.\r\n params.sourceStore[file] = parseResult.src;\r\n\r\n // adapt our block ID generator for this file.\r\n var blockIDGen = function(blockInfo) {\r\n return params.idGenerator.newID({\r\n script: file,\r\n func: blockInfo.func\r\n });\r\n };\r\n\r\n // instrument the code.\r\n var result = instrument(\r\n parseResult.src,\r\n parseResult.ast,\r\n blockIDGen,\r\n params\r\n );\r\n\r\n // write the modified code back to the original file.\r\n fs.writeFileSync(file, result.result, \"utf8\");\r\n\r\n // just return the block & function data.\r\n done(null, {\r\n blocks: result.blocks,\r\n functions: result.functions\r\n });\r\n })\r\n .catch(function(e) {\r\n // don't kill the whole process.\r\n console.error(\"Problem instrumenting file. \", e, \" in file: \", file);\r\n done(null, { blocks: [], functions: [] });\r\n })\r\n .done();\r\n}", "function processSync(doc) {\n var file\n var complete\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(error) {\n complete = true\n bail(error)\n }\n }", "function processSync(doc) {\n var file\n var complete\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(error) {\n complete = true\n bail(error)\n }\n }", "function file_load(file, callback) {\n\tif (!file) return; // No file found.\n\n\tlet reader = new FileReader();\n\n\treader.onload = event => callback(sched_parse(\n\t\tevent.target.result\n\t), file.path);\n\n\treader.readAsText(file);\n}", "transform(filePath, fileContent, dependencies = {}) {\n\t\t\tif (filePath === textureList) {\n\t\t\t\t/**\n\t\t\t\t * The \"dependencies\" object always contains the files that were\n\t\t\t\t * required earlier. Structure: { [filePath]: fileContent }\n\t\t\t\t * We're only interested in the file paths in this case\n\t\t\t\t */\n\t\t\t\treturn Object.keys(dependencies).map((dep) => {\n\t\t\t\t\tconst parts = dep.split('.')\n\t\t\t\t\tparts.pop() // Removes the file extension\n\t\t\t\t\treturn parts.join('.')\n\t\t\t\t})\n\t\t\t}\n\t\t}", "function process(file, enc, callback) {\n /*jshint validthis:true*/\n\n // Do nothing if no contents\n if (file.isNull()) {\n return callback();\n }\n if (file.isStream()) {\n this.emit(\"error\",\n new gutil.PluginError(PLUGIN_NAME, \"Stream content is not supported\"));\n return callback();\n }\n // check if file.contents is a `Buffer`\n if (file.isBuffer() || file.isFile()) {\n var parser = imagesize.Parser();\n\n var retStatus = parser.parse(file.contents);\n if (imagesize.Parser.DONE === retStatus) {\n var result = parser.getResult();\n result.file = libpath.relative(file.base, file.path)\n list.push(result);\n }\n }\n return callback();\n }", "loadFile(file, module, x, y) {\n var dsp_code;\n var reader = new FileReader();\n var ext = file.name.toString().split('.').pop();\n var filename = file.name.toString().split('.').shift();\n var type;\n if (ext == \"dsp\") {\n type = \"dsp\";\n reader.readAsText(file);\n }\n else if (ext == \"json\") {\n type = \"json\";\n reader.readAsText(file);\n }\n else if (ext == \"jfaust\") {\n type = \"jfaust\";\n reader.readAsText(file);\n }\n else if (ext == \".polydsp\") {\n type = \"poly\";\n reader.readAsText(file);\n }\n else {\n throw new Error(Utilitary.messageRessource.errorObjectNotFaustCompatible);\n }\n reader.onloadend = (e) => {\n dsp_code = \"process = vgroup(\\\"\" + filename + \"\\\",environment{\" + reader.result + \"}.process);\";\n if (!module) {\n if (type == \"dsp\") {\n this.compileFaust({ isMidi: false, name: filename, sourceCode: dsp_code, x: x, y: y, callback: (factory) => { this.createModule(factory); } });\n }\n else if (type == \"jfaust\") {\n Utilitary.currentScene.recallScene(reader.result);\n }\n else if (type == \"poly\") {\n this.compileFaust({ isMidi: true, name: filename, sourceCode: dsp_code, x: x, y: y, callback: (factory) => { this.createModule(factory); } });\n }\n }\n else {\n if (type == \"dsp\") {\n module.isMidi = false;\n module.update(filename, dsp_code);\n }\n else if (type == \"jfaust\") {\n Utilitary.currentScene.recallScene(reader.result);\n }\n else if (type == \"poly\") {\n module.isMidi = true;\n module.update(filename, dsp_code);\n }\n }\n };\n }", "function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }", "function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }", "function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }", "function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }", "function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }", "function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }", "async function translate(file_path, book_id, trans_langs) {\n var arguments = [];\n arguments.push(file_path);\n arguments.push(book_id);\n for (var i = 0; i < trans_langs.length; i++) {\n arguments.push(trans_langs[i]);\n }\n console.log(arguments);\n let options = {\n mode: \"text\",\n executable: \"python3.9\",\n pythonOptions: [\"-u\"], // get print results in real-time\n scriptPath:\n \"./public/translation\",\n args: arguments, //An argument which can be accessed in the script using sys.argv[1]\n };\n console.log(\"entered the async\")\n try{\n await PythonShell.run(\n \"ParseAndTranslate.py\",\n options,\n function (err, result) {\n if (err) throw err;\n //result is an array consisting of messages collected\n //during execution of script.\n console.log(\"result: \", result.toString());\n for(var i = 0 ; i < trans_langs.length ; i++){\n console.log(\"doing something in this loop for downloads\");\n uploadTranslatedBook(book_id, trans_langs[i]);\n }\n }\n );console.log(\"ok this is it\")} catch (error){\n console.log(\"ded\")\n console.log(error)\n }\n console.log(\"exiting the async\")\n \n}", "function runSync(node, file) {\n var complete = false;\n var result;\n\n run(node, file, done);\n\n assertDone('runSync', 'run', complete);\n\n return result;\n\n function done(err, tree) {\n complete = true;\n bail(err);\n result = tree;\n }\n }", "transformFile (file, done) {\n if ((this.options.resizeWidth || this.options.resizeHeight) && file.type.match(/image.*/)) return this.resizeImage(file, this.options.resizeWidth, this.options.resizeHeight, this.options.resizeMethod, done);\n else return done(file);\n }" ]
[ "0.65101844", "0.65101844", "0.6500248", "0.6294634", "0.57297754", "0.57229096", "0.5722432", "0.5682045", "0.5500241", "0.5500241", "0.54538906", "0.5404583", "0.53382605", "0.5318412", "0.5295097", "0.529395", "0.52614886", "0.51727426", "0.51727426", "0.51727426", "0.51727426", "0.51727426", "0.51727426", "0.5164193", "0.5164185", "0.5164185", "0.5163895", "0.5093822", "0.5093822", "0.50922084", "0.5078285", "0.5074991", "0.5068217", "0.5068217", "0.5046903", "0.5037829", "0.5030349", "0.49921373", "0.49876112", "0.49607566", "0.49607566", "0.49607566", "0.49607566", "0.49607566", "0.49428758", "0.49171588", "0.4909643", "0.48846695", "0.48667425", "0.48349527", "0.47796875", "0.47782296", "0.47751397", "0.47626165", "0.47606793", "0.47535083", "0.47475874", "0.47475874", "0.4726175", "0.4722694", "0.47151867", "0.4713337", "0.47130078", "0.47078863", "0.47078863", "0.4701207", "0.47006968", "0.46969882", "0.4675821", "0.46587098", "0.46474597", "0.46456736", "0.46456736", "0.46456736", "0.46456736", "0.46456736", "0.46456736", "0.46370897", "0.46324137", "0.462", "0.46123847", "0.46123847", "0.4592718", "0.45921934", "0.4582093", "0.45671654", "0.4552349", "0.4552349", "0.4552349", "0.4552349", "0.4552349", "0.4552349", "0.45521346", "0.45511076", "0.4547693" ]
0.64889526
7
Run transforms on a Unist node representation of a file (in string or VFile representation), sync.
function runSync(node, file) { var complete = false var result run(node, file, done) assertDone('runSync', 'run', complete) return result function done(err, tree) { complete = true bail(err) result = tree } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(error, tree, file) {\n tree = tree || node\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(error, tree, file) {\n tree = tree || node\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node);\n freeze();\n\n if (!cb && typeof file === 'function') {\n cb = file;\n file = null;\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done);\n\n function done(error, tree, file) {\n tree = tree || node;\n if (error) {\n reject(error);\n } else if (resolve) {\n resolve(tree);\n } else {\n cb(null, tree, file);\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node);\n freeze();\n\n if (!cb && func(file)) {\n cb = file;\n file = null;\n }\n\n if (!cb) {\n return new Promise(executor);\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done);\n\n function done(err, tree, file) {\n tree = tree || node;\n if (err) {\n reject(err);\n } else if (resolve) {\n resolve(tree);\n } else {\n cb(null, tree, file);\n }\n }\n }\n }", "function transformFileSync(filename) {\n\t var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n\t opts.filename = filename;\n\t return _transformation2[\"default\"](_fs2[\"default\"].readFileSync(filename, \"utf8\"), opts);\n\t}", "function transformFileSync(filename) {\n\t var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n\t opts.filename = filename;\n\t return _transformation2[\"default\"](_fs2[\"default\"].readFileSync(filename, \"utf8\"), opts);\n\t}", "function transformFileSync(filename) {\n var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n opts.filename = filename;\n return _transformation2[\"default\"](_fs2[\"default\"].readFileSync(filename, \"utf8\"), opts);\n}", "function transform(file, cb) {\n gutil.log('Preprocessing:', file.path);\n // read and modify file contents\n var fileContents = String(file.contents);\n fileContents = fileContents.replace(/^\\s*(import .*?)(?:;|$)/gm,\n function(str, group1) {\n return 'jsio(\"' + group1 + '\");';\n });\n file.contents = new Buffer(fileContents);\n\n // if there was some error, just pass as the first parameter here\n cb(null, file);\n }", "function transform(context, file, fileSet, next) {\n if (stats(file).fatal) {\n next()\n } else {\n debug('Transforming document `%s`', file.path)\n context.processor.run(context.tree, file, onrun)\n }\n\n function onrun(error, node) {\n debug('Transformed document (error: %s)', error)\n context.tree = node\n next(error)\n }\n}", "function tjs_gulp_transformFile(file) {\n\t// console.log(file)\n\treturn `gulp.task('${file.file}', function() {\n\tlet pipe = gulp.src('${file.file}', { base: __dirname })\n\n\t// pre-piping\n\tif (typeof __t.start == 'function')\n\t\tpipe = pipe.pipe(__t.start.bind(pipe)())\n\n\t${file.transforms.length == 0 ? `if (typeof __t.blank == 'function') pipe = __t.blank.bind(pipe)()` : ''}\n\n\t${file.transforms.map(t => `// pipe setup for ${t.name}\n\tpipe = __t.${t.name}.bind(pipe)${t.argsTuple}\n\tif (typeof __t.each == 'function') pipe = pipe.pipe(__t.each.bind(pipe)())`).join('\\n\\t')}\n\n\t// post-piping\n\tif (typeof __t.finish == 'function')\n\t\tpipe = pipe.pipe(__t.finish.bind(pipe)())\n\t\n\treturn pipe\n})`\n}", "function transformSync(src, filename, options) {\n validateArguments(src, filename);\n const normalizedOptions = options_1.validateTransformOptions(options);\n return transformFile(src, filename, normalizedOptions);\n}", "_transformFiles(files, done) {\n let transformedFiles = [];\n // Clumsy way of handling asynchronous calls, until I get to add a proper Future library.\n let doneCounter = 0;\n for(let i = 0; i < files.length; i++)this.options.transformFile.call(this, files[i], (transformedFile)=>{\n transformedFiles[i] = transformedFile;\n if (++doneCounter === files.length) done(transformedFiles);\n });\n }", "async function main() {\n const resolvedPaths = globby.sync(files as string[])\n const transformationModule = loadTransformationModule(transformationName)\n\n log(`Processing ${resolvedPaths.length} files…`)\n\n for (const p of resolvedPaths) {\n debug(`Processing ${p}…`)\n const fileInfo = {\n path: p,\n source: fs.readFileSync(p).toString(),\n }\n try {\n const result = runTransformation(\n fileInfo,\n transformationModule,\n params as object\n )\n fs.writeFileSync(p, result)\n } catch (e) {\n console.error(e)\n }\n }\n}", "transformFile(data, filePath) {\n this.updateBabelConfig(filePath);\n return babel.transformSync(data, this.babelConfig.options);\n }", "function transform$5(context, file, fileSet, next) {\n if (stats$4(file).fatal) {\n next();\n } else {\n debug$7('Transforming document `%s`', file.path);\n context.processor.run(context.tree, file, onrun);\n }\n\n function onrun(error, node) {\n debug$7('Transformed document (error: %s)', error);\n context.tree = node;\n next(error);\n }\n}", "function runSync(node, file) {\n var result\n var complete\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(error, tree) {\n complete = true\n result = tree\n bail(error)\n }\n }", "function runSync(node, file) {\n var result\n var complete\n\n run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n return result\n\n function done(error, tree) {\n complete = true\n result = tree\n bail(error)\n }\n }", "function runSync(node, file) {\n var result;\n var complete;\n\n run(node, file, done);\n\n assertDone('runSync', 'run', complete);\n\n return result\n\n function done(error, tree) {\n complete = true;\n result = tree;\n bail(error);\n }\n }", "runTransformation(input) {\n return this.transform(input)\n }", "function Transform() {}", "function Transform() {}", "function Transform() {}", "function Transform() {}", "function Transform() {}", "async function transform(file, dir = 'lib') {\n const dest = file.replace('/src/', `/${dir}/`)\n await fs.ensureDir(path.dirname(dest))\n\n if (fs.statSync(file).isDirectory()) return\n\n if (file.endsWith('.svelte')) {\n const source = await fs.readFile(file, 'utf8')\n const item = await preprocess(\n source,\n autoprocessor({\n typescript: {\n tsconfigFile: path.resolve(rootDir, 'tsconfig-base.json'),\n },\n // https://github.com/sveltejs/svelte/issues/189#issuecomment-586142198\n replace: [\n [/(>)[\\s]*([<{])/g, '$1$2'],\n [/({[/:][a-z]+})[\\s]*([<{])/g, '$1$2'],\n [/({[#:][a-z]+ .+?})[\\s]*([<{])/g, '$1$2'],\n [/([>}])[\\s]+(<|{[/#:][a-z][^}]*})/g, '$1$2'],\n ],\n }),\n {\n filename: file,\n }\n )\n await fs.writeFile(\n dest,\n item.code.replace('<script lang=\"ts\">', '<script>')\n )\n } else {\n await fs.copyFile(file, dest)\n }\n}", "async function treeify(forEachFile) {\n const treeRoot = process.cwd()\n const ignorePattern = await _ignore()\n const tree = gl.baseCase\n\n if (await fs.pathExists(treeRoot)) {\n await Promise.all((await rget(treeRoot, ignorePattern)).map(file => forEachFile(tree, file)))\n }\n return tree\n}", "function transmorph( xslSrc, file, filterKey, filterValue )\r\n{\r\n var result = transform( xslSrc, filterKey, filterValue );\r\n saveFile( result, file );\r\n}", "function runSync(node, file) {\n var complete = false;\n var result;\n\n run(node, file, done);\n\n assertDone('runSync', 'run', complete);\n\n return result;\n\n function done(err, tree) {\n complete = true;\n bail(err);\n result = tree;\n }\n }", "static transform() {}", "function processSync(doc) {\n var file;\n var complete;\n\n freeze();\n assertParser('processSync', processor.Parser);\n assertCompiler('processSync', processor.Compiler);\n file = vfile(doc);\n\n process(file, done);\n\n assertDone('processSync', 'process', complete);\n\n return file\n\n function done(error) {\n complete = true;\n bail(error);\n }\n }", "function processSync(doc) {\n var file\n var complete\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(error) {\n complete = true\n bail(error)\n }\n }", "function processSync(doc) {\n var file\n var complete\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(error) {\n complete = true\n bail(error)\n }\n }", "async transform(mode) {\n // console.log('Mode:', mode, '->');\n try {\n const buffer = await readFile(`${this.file}`);\n\n // console.log('buffer argument:', buffer);\n\n let transformed;\n switch (mode) {\n // case 'soRandom':\n // case 'random':\n // transformed = await soRandom(buffer);\n // break;\n case 'shave':\n transformed = await shave(buffer);\n break;\n case 'angelOfMusic':\n case 'phantom':\n transformed = await angelOfMusic(buffer);\n break;\n case 'grayscale':\n case 'greyscale':\n transformed = await greyscale(buffer);\n break;\n // case 'randomlyPastel':\n // case 'pastel':\n // transformed = await randomlyPastel(buffer);\n // break;\n default:\n // console.log(`Something is wrong. Output not modified.`);\n transformed = buffer;\n break;\n }\n\n writeFile(`${__dirname}/transformations/${transformed.output}`, transformed.buffer);\n console.log(transformed.message);\n } catch (err) {\n console.error('There was an error transforming your file:', err);\n }\n }", "function applyTransform(path, data, callback) {\n if(typeof data === \"function\") {\n callback = data;\n data = null;\n }\n\n var transform = getTransform(path);\n if(!transform) {\n return callback(null);\n }\n\n function _applyTransform(path, data) {\n transform.transform(path, data, function(err, transformed) {\n if(err) {\n console.error(\"[Bramble Error] unable to transform file\", path, err);\n return callback(err);\n }\n\n var transformedPath = transform.rewritePath(path);\n\n _fs.writeFile(transformedPath, transformed, function(err) {\n if(err) {\n console.error(\"[Bramble Error] unable to write transformed file\", transformedPath, err);\n return callback(err);\n }\n\n Handlers.handleFile(transformedPath, data, function(err) {\n if(err) {\n console.error(\"[Bramble Error] unable to rewrite URL for transformed file\", transformedPath, err);\n return callback(err);\n }\n\n // Refresh the file tree so this new file shows up.\n CommandManager.execute(Commands.FILE_REFRESH).always(callback);\n });\n });\n });\n }\n\n if(!data) {\n _fs.readFile(path, \"utf8\", function(err, data) {\n if(err) {\n if(err.code === \"ENOENT\") {\n // File is being created (not written yet) use empty string\n data = \"\";\n } else {\n // Some other error, send it back\n return callback(err);\n }\n }\n\n _applyTransform(path, data);\n });\n } else {\n _applyTransform(path, data);\n }\n }", "function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }", "function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }", "function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }", "function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }", "function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }", "function processSync(doc) {\n var complete = false\n var file\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(err) {\n complete = true\n bail(err)\n }\n }", "function processSync(doc) {\n var complete = false;\n var file;\n\n freeze();\n assertParser('processSync', processor.Parser);\n assertCompiler('processSync', processor.Compiler);\n file = vfile(doc);\n\n process(file, done);\n\n assertDone('processSync', 'process', complete);\n\n return file;\n\n function done(err) {\n complete = true;\n bail(err);\n }\n }", "function transform(file, cb) {\n // read and modify file contents\n console.log(file.history[0]);\n var lines = String(file.contents).replace(/\\r\\n/g, '\\n').split('\\n');\n var files = [];\n var found = false;\n\n for (var i = 0; i < lines.length; i++) {\n lines[i] = lines[i].replace(/http:\\/\\/www\\.iobroker\\.net\\/wp-content\\/uploads\\/\\//g, 'http://iobroker.net/wp-content/uploads/');\n lines[i] = lines[i].replace(/http:\\/\\/www\\.iobroker\\.net\\/wp-content\\/uploads\\//g, 'http://iobroker.net/wp-content/uploads/');\n lines[i] = lines[i].replace(/http:\\/\\/iobroker\\.net\\/wp-content\\/uploads\\/\\//g, 'http://iobroker.net/wp-content/uploads/');\n // [![](http://www.iobroker.net/wp-content/uploads//email_set.png)](http://www.iobroker.net/wp-content/uploads//email_set.png)]\n var m = lines[i].match(/(\\[caption[^\\]]*\\])?\\!\\[[^\\]]*\\]\\(http:\\/\\/iobroker\\.net\\/[^\\)]+\\)(\\]\\([^\\)]*\\))?\\]?(.*\\[\\/caption\\])?/g);\n if (m) {\n for (var j = 0; j < m.length; j++) {\n found = true;\n // try to extract caption\n var caption = m[j].match(/\\)\\]?(.+)\\[\\/caption\\]/);\n if (caption) {\n caption = caption[1].trim();\n }\n\n // change it to \\n![](img/filename_oldf_filename)\\n\n var mm = m[j].split('](')[1];\n mm = mm.replace(/\\).*$/, '');\n // noe we have \"http://www.iobroker.net/wp-content/uploads/email_set.png\"\n var fileName = mm.split('/').pop();\n var mdPath = file.history[0].replace(/\\\\/g, '/');\n var parts = mdPath.split('/');\n var mdFileName = parts.pop().replace(/\\.md$/, '');\n mdPath = parts.join('/');\n\n var task = {url: mm, name: mdPath + '/img/' + mdFileName + '_' + fileName, relative: 'img/' + mdFileName + '_' + fileName};\n bigTasks.push(task);\n lines[i] = lines[i].replace(m[j], '\\n![' + (caption || '') + '](' + task.relative + ')\\n');\n }\n }\n }\n /*downloadFiles(files, [], function (err) {\n if (found && (!err || !err.length)) {\n console.log('Write modified ' + file.history[0]);\n //file.contents = new Buffer(lines.join('\\n'));\n }\n\n // if there was some error, just pass as the first parameter here\n cb(null, file);\n });*/\n cb(null, file);\n }", "function transform(src, filename, options) {\n validateArguments(src, filename);\n return new Promise((resolve, reject) => {\n try {\n const res = transformSync(src, filename, options);\n resolve(res);\n }\n catch (error) {\n reject(error);\n }\n });\n}", "function transformFile(filename, opts, callback) {\n\t if (_lodashLangIsFunction2[\"default\"](opts)) {\n\t callback = opts;\n\t opts = {};\n\t }\n\n\t opts.filename = filename;\n\n\t _fs2[\"default\"].readFile(filename, function (err, code) {\n\t if (err) return callback(err);\n\n\t var result;\n\n\t try {\n\t result = _transformation2[\"default\"](code, opts);\n\t } catch (err) {\n\t return callback(err);\n\t }\n\n\t callback(null, result);\n\t });\n\t}", "function transformFile(filename, opts, callback) {\n\t if (_lodashLangIsFunction2[\"default\"](opts)) {\n\t callback = opts;\n\t opts = {};\n\t }\n\n\t opts.filename = filename;\n\n\t _fs2[\"default\"].readFile(filename, function (err, code) {\n\t if (err) return callback(err);\n\n\t var result;\n\n\t try {\n\t result = _transformation2[\"default\"](code, opts);\n\t } catch (err) {\n\t return callback(err);\n\t }\n\n\t callback(null, result);\n\t });\n\t}", "async transform() {\n if (this.options.minify) {\n await uglify(this);\n }\n }", "function _transform (node, callback) {\n return node.map(function(child, path, parent) {\n var replacement = callback(child, path, parent);\n return _transform(replacement, callback);\n });\n }", "function _transform (node, callback) {\n return node.map(function(child, path, parent) {\n var replacement = callback(child, path, parent);\n return _transform(replacement, callback);\n });\n }", "function _transform(node, callback) {\n return node.map(function (child, path, parent) {\n var replacement = callback(child, path, parent);\n return _transform(replacement, callback);\n });\n }", "fileNormalizeSync(fileNames){\n // If filenames is one filename, resolve it and return it's normalized value\n if (typeof fileNames === 'string' || fileNames instanceof String)\n return this._system.normalizeSync.call(this._system, this._preNormalize(fileNames));\n // If filenames is array, resolve all normalize promises\n fileNames = fileNames.map(this._preNormalize);\n return fileNames.map( fileName => this._system.normalizeSync.call(this._system, fileName), this)\n }", "set transform(value) {}", "set transform(value) {}", "set transform(value) {}", "set transform(value) {}", "updateLocalTransform()\n {\n // empty\n }", "transform(filePath, fileContent, dependencies = {}) {\n\t\t\tif (filePath === textureList) {\n\t\t\t\t/**\n\t\t\t\t * The \"dependencies\" object always contains the files that were\n\t\t\t\t * required earlier. Structure: { [filePath]: fileContent }\n\t\t\t\t * We're only interested in the file paths in this case\n\t\t\t\t */\n\t\t\t\treturn Object.keys(dependencies).map((dep) => {\n\t\t\t\t\tconst parts = dep.split('.')\n\t\t\t\t\tparts.pop() // Removes the file extension\n\t\t\t\t\treturn parts.join('.')\n\t\t\t\t})\n\t\t\t}\n\t\t}", "async function copyAndTransform(file, ampRuntimeVersion) {\n const originalHtml = await readFile(file);\n const ampFile = file.substring(1, file.length)\n .replace('.html', '.amp.html');\n const allTransformationsFile = file.substring(1, file.length)\n .replace('.html', '.all.html');\n const validTransformationsFile = file.substring(1, file.length)\n .replace('.html', '.valid.html');\n\n // Transform into valid optimized AMP\n ampOptimizer.setConfig({\n validAmp: true,\n verbose: true,\n });\n const validOptimizedHtml = await ampOptimizer.transformHtml(originalHtml);\n\n // Run all optimizations including versioned AMP runtime URLs\n ampOptimizer.setConfig({\n validAmp: false,\n verbose: true,\n });\n // The transformer needs the path to the original AMP document\n // to correctly setup AMP to canonical linking\n const optimizedHtml = await ampOptimizer.transformHtml(originalHtml, {\n ampUrl: ampFile,\n ampRuntimeVersion: ampRuntimeVersion,\n });\n writeFile(allTransformationsFile, optimizedHtml);\n writeFile(validTransformationsFile, validOptimizedHtml);\n // We change the path of the original AMP file to match the new\n // amphtml link and make the canonical link point to the transformed version.\n writeFile(ampFile, originalHtml);\n}", "async transform(chunk, encoding, cb) {\n\n // DRY method for handling each chunk as it comes in\n const do_transform = () => {\n // Write data to our fork stream. If it fails,\n // emit a 'drain' event\n if (!this._fork_stream.write(chunk)) {\n this._fork_stream.once('drain', () => {\n cb(null, chunk);\n });\n } else {\n // Push data back out to whatever is listening (if anything)\n // and let Node know we're ready for more data\n cb(null, chunk);\n }\n };\n\n // DRY method for handling errors when the arise from the\n // ClamAV Socket connection\n const handle_error = (err, is_infected=null, result=null) => {\n this._fork_stream.unpipe();\n this._fork_stream.destroy();\n this._clamav_transform.destroy();\n clear_scan_benchmark();\n\n // Finding an infected file isn't really an error...\n if (is_infected === true) {\n if (_scan_complete === false) {\n _scan_complete = true;\n this.emit('scan-complete', result);\n }\n this.emit('stream-infected', result); // just another way to catch an infected stream\n } else {\n this.emit('error', err);\n }\n };\n\n // If we haven't initialized a socket connection to ClamAV yet,\n // now is the time...\n if (!this._clamav_socket) {\n // We're using a PassThrough stream as a middle man to fork the input\n // into two paths... (1) ClamAV and (2) The final destination.\n this._fork_stream = new PassThrough();\n // Instantiate our custom Transform stream that coddles\n // chunks into the correct format for the ClamAV socket.\n this._clamav_transform = new NodeClamTransform({}, me.settings.debug_mode);\n // Setup an array to collect the responses from ClamAV\n this._clamav_response_chunks = [];\n\n try {\n // Get a connection to the ClamAV Socket\n this._clamav_socket = await me._init_socket('passthrough');\n if (me.settings.debug_mode) console.log(`${me.debug_label}: ClamAV Socket Initialized...`);\n\n // Setup a pipeline that will pass chunks through our custom Tranform and on to ClamAV\n this._fork_stream.pipe(this._clamav_transform).pipe(this._clamav_socket);\n\n // When the CLamAV socket connection is closed (could be after 'end' or because of an error)...\n this._clamav_socket.on('close', hadError => {\n if (me.settings.debug_mode) console.log(`${me.debug_label}: ClamAV socket has been closed! Because of Error:`, hadError);\n })\n // When the ClamAV socket connection ends (receives chunk)\n .on('end', () => {\n if (me.settings.debug_mode) console.log(`${me.debug_label}: ClamAV socket has received the last chunk!`);\n // Process the collected chunks\n const response = Buffer.concat(this._clamav_response_chunks);\n const result = me._process_result(response.toString('utf8'), null);\n this._clamav_response_chunks = [];\n if (me.settings.debug_mode) {\n console.log(`${me.debug_label}: Result of scan:`, result);\n console.log(`${me.debug_label}: It took ${_av_scan_time} seconds to scan the file(s).`);\n clear_scan_benchmark();\n }\n\n // NOTE: \"scan-complete\" could be called by the `handle_error` method.\n // We don't want to to double-emit this message.\n if (_scan_complete === false) {\n _scan_complete = true;\n this.emit('scan-complete', result);\n }\n })\n // If connection timesout.\n .on('timeout', () => {\n this.emit('timeout', new Error('Connection to host/socket has timed out'));\n if (me.settings.debug_mode) console.log(`${me.debug_label}: Connection to host/socket has timed out`);\n })\n // When the ClamAV socket is ready to receive packets (this will probably never fire here)\n .on('ready', () => {\n if (me.settings.debug_mode) console.log(`${me.debug_label}: ClamAV socket ready to receive`);\n })\n // When we are officially connected to the ClamAV socket (probably will never fire here)\n .on('connect', () => {\n if (me.settings.debug_mode) console.log(`${me.debug_label}: Connected to ClamAV socket`);\n })\n // If an error is emitted from the ClamAV socket\n .on('error', err => {\n console.error(`${me.debug_label}: Error emitted from ClamAV socket: `, err);\n handle_error(err);\n })\n // If ClamAV is sending stuff to us (ie, an \"OK\", \"Virus FOUND\", or \"ERROR\")\n .on('data', cv_chunk => {\n // Push this chunk to our results collection array\n this._clamav_response_chunks.push(cv_chunk);\n if (me.settings.debug_mode) console.log(`${me.debug_label}: Got result!`, cv_chunk.toString());\n\n // Parse what we've gotten back from ClamAV so far...\n const response = Buffer.concat(this._clamav_response_chunks);\n const result = me._process_result(response.toString(), null);\n\n // If there's an error supplied or if we detect a virus, stop stream immediately.\n if (result instanceof NodeClamError || (typeof result === 'object' && 'is_infected' in result && result.is_infected === true)) {\n // If a virus is detected...\n if (typeof result === 'object' && 'is_infected' in result && result.is_infected === true) {\n // handle_error(new NodeClamError(result, `Virus(es) found! ${'viruses' in result && Array.isArray(result.viruses) ? `Suspects: ${result.viruses.join(', ')}` : ''}`));\n handle_error(null, true, result);\n }\n // If any other kind of error is detected...\n else {\n handle_error(result);\n }\n }\n // For debugging purposes, spit out what was processed (if anything).\n else {\n if (me.settings.debug_mode) console.log(`${me.debug_label}: Processed Result: `, result, response.toString());\n }\n });\n\n if (me.settings.debug_mode) console.log(`${me.debug_label}: Doing initial transform!`);\n // Handle the chunk\n do_transform();\n } catch (err) {\n // If there's an issue connecting to the ClamAV socket, this is where that's handled\n if (me.settings.debug_mode) console.error(`${me.debug_label}: Error initiating socket to ClamAV: `, err);\n handle_error(err);\n }\n } else {\n //if (me.settings.debug_mode) console.log(`${me.debug_label}: Doing transform: ${++counter}`);\n // Handle the chunk\n do_transform();\n }\n }", "function test_transform() {\n var f = function(x) {\n return Number($(x)) + 1;\n };\n\n\n var plan1 = tasks(\"ns:identity\").plan({\n x: [0, 1]\n });\n\n var plan2 = tasks(\"ns:mult\").plan({\n x: transform(f, plan1),\n y: [3, 5]\n });\n\n // Optimize and run\n // Should be an array of XML values 3, 6, 5, 10\n var result = plan2.run();\n check_array(result, [3, 5, 6, 10]);\n}", "function Transform() { // eslint-disable-line no-unused-vars\n\n var request = new XMLHttpRequest();\n\n setLocalStorageItem('code', cppEditor.getValue());\n setLocalStorageItem('insightsOptions', getInsightsOptions());\n\n request.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n var response = JSON.parse(this.responseText);\n cppOutEditor.setValue(response.stdout);\n stdErrEditor.setValue(response.stderr);\n SetRunListeners();\n } else if (this.readyState == 4 && this.status != 200) {\n stdErrEditor.setValue('Sorry, your request failed');\n SetRunListeners();\n }\n };\n\n stdErrEditor.setValue('Waiting for response...');\n\n var url = buildURL('/api/v1/transform');\n\n request.open('POST', url, true);\n request.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');\n\n var data = {};\n\n data.insightsOptions = getInsightsOptions();\n data.code = cppEditor.getValue();\n\n SetWaitForResultListeners();\n request.send(JSON.stringify(data));\n}", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze();\n assertParser('process', processor.Parser);\n assertCompiler('process', processor.Compiler);\n\n if (!cb) {\n return new Promise(executor);\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n var file = vfile(doc);\n\n pipeline.run(processor, {file: file}, done);\n\n function done(err) {\n if (err) {\n reject(err);\n } else if (resolve) {\n resolve(file);\n } else {\n cb(null, file);\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(error) {\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(error) {\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze();\n assertParser('process', processor.Parser);\n assertCompiler('process', processor.Compiler);\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n var file = vfile(doc);\n\n pipeline.run(processor, {file: file}, done);\n\n function done(error) {\n if (error) {\n reject(error);\n } else if (resolve) {\n resolve(file);\n } else {\n cb(null, file);\n }\n }\n }\n }", "function processSVGImage(i, inputFile, outputFile) {\n console.log(\"processSVGImage:\" + i + \",\" + inputFile + \",output:\" + outputFile);\n\n // pretty print the input file first\n xmlFormat(tempDir + \"/\" + inputFile + \".svg\");\n // var processBg = new transform();\n // processBg._transform = function (data, encoding, cb) {\n // // do transformation\n // cb(null, tools.processData(data,processBgImg));\n // };\n\n var removeBd = new transform();\n removeBd._transform = function (data, encoding, cb) {\n // do transformation\n cb(null, tools.processData(data, removeBdTag));\n };\n var removeXMLSpacePreserve = new transform();\n removeXMLSpacePreserve._transform = function (data, encoding, cb) {\n // do transformation\n cb(null, tools.processData(data, removeXMLSpacePreserveTag));\n };\n var processNt = new transform();\n processNt._transform = function (data, encoding, cb) {\n // do transformation\n cb(null, tools.processData(data, processNtTag));\n };\n\n var processTextLine = new transform();\n processTextLine._transform = function (data, encoding, cb) {\n // do transformation\n cb(null, tools.processData(data, processTextTag));\n };\n\n var processImageLine = new transform();\n processImageLine._transform = function (data, encoding, cb) {\n // do transformation\n cb(null, tools.processData(data, processImageTag));\n };\n\n // var getFonts = new transform();\n // getFonts._transform = function (data, encoding, cb) {\n // // do transformation\n // cb(null, tools.processData(data, getFontsList));\n // };\n var addFonts = new transform();\n addFonts._transform = function (data, encoding, cb) {\n // do transformation\n // console.log(\"transform:\" + fontList[i]);\n cb(null, tools.processData(data, addFontsLine, fontList[i]));\n };\n\n var inputPath = tempDir + \"/\" + inputFile + \".svg\";\n var inputStream1 = fs.createReadStream(inputPath);\n var outputPath = tempDir + \"/\" + outputFile + \".svg\";\n var outputStream1 = fs.createWriteStream(outputPath);\n inputStream1\n .pipe(removeBd)\n .pipe(removeXMLSpacePreserve)\n .pipe(processNt)\n .pipe(processTextLine)\n .pipe(processImageLine)\n .pipe(addFonts)\n .pipe(outputStream1);\n\n setTimeout(function () {\n xmlFormat(outputPath)\n }, 2000);\n // delay 2 seconds for the first round is over\n // setTimeout(function () {\n // console.log(\"start second round\");\n // var inputStream2 = fs.createReadStream(outputPath);\n // outputPath = tempDir + \"/\" + outputFile + \".svg\";\n // var outputStream2 = fs.createWriteStream(outputPath);\n // inputStream2\n // .pipe(addFonts)\n // .pipe(outputStream2);\n // }, 2000);\n\n}", "function transformFile(filename, opts, callback) {\n if (_lodashLangIsFunction2[\"default\"](opts)) {\n callback = opts;\n opts = {};\n }\n\n opts.filename = filename;\n\n _fs2[\"default\"].readFile(filename, function (err, code) {\n if (err) return callback(err);\n\n var result;\n\n try {\n result = _transformation2[\"default\"](code, opts);\n } catch (err) {\n return callback(err);\n }\n\n callback(null, result);\n });\n}", "loadObjects (state, file) {\n const loader = new FileLoader(file)\n loader.loadSync()\n Vue.set(state, file, loader.objects)\n }", "function run(transformer, options) {\n return runFile(process.argv[2], transformer, options);\n}", "function makeTransform(registry) {\n\n return function(filename, options) {\n options = options || {};\n\n var registry = registry || registryFromOptions(options);\n\n return aggregate(function(src) {\n try {\n src = jstransform(src);\n } catch(err) {\n return this.emit('error', err);\n }\n this.queue(src);\n this.queue(null);\n });\n }\n}", "runUserUpload() {\n\t\tconst input = document.createElement(\"input\");\n\t\tinput.type = \"file\";\n\t\tinput.onchange = (evt) => {\n\t\t\tconst reader = new FileReader();\n\t\t\treader.onloadend = (evt) => {\n\t\t\t\tthis.loadStoredCircuit(JSON.parse(evt.target.result));\n\t\t\t};\n\t\t\treader.readAsText(evt.target.files[0]);\n\t\t};\n\t\tinput.click();\n\t}", "function processFile (inputLoc, out, replacements) {\n var file = urlRegex.test(inputLoc) ?\n hyperquest(inputLoc) :\n fs.createReadStream(inputLoc, encoding)\n\n file.pipe(bl(function (err, data) {\n if (err) throw err\n\n data = data.toString()\n replacements.forEach(function (replacement) {\n data = data.replace.apply(data, replacement)\n })\n if (inputLoc.slice(-3) === '.js') {\n const transformed = babel.transform(data, {\n plugins: [\n 'transform-es2015-parameters',\n 'transform-es2015-arrow-functions',\n 'transform-es2015-block-scoping',\n 'transform-es2015-template-literals',\n 'transform-es2015-shorthand-properties',\n 'transform-es2015-for-of',\n 'transform-es2015-destructuring'\n ]\n })\n data = transformed.code\n }\n fs.writeFile(out, data, encoding, function (err) {\n if (err) throw err\n\n console.log('Wrote', out)\n })\n }))\n}", "parseFlsFile(baseFile) {\r\n this.extension.logger.addLogMessage('Parse fls file.');\r\n const rootDir = path.dirname(baseFile);\r\n const outDir = this.getOutDir(baseFile);\r\n const flsFile = path.resolve(rootDir, path.join(outDir, path.basename(baseFile, '.tex') + '.fls'));\r\n if (!fs.existsSync(flsFile)) {\r\n this.extension.logger.addLogMessage(`Cannot find fls file: ${flsFile}`);\r\n return;\r\n }\r\n this.extension.logger.addLogMessage(`Fls file found: ${flsFile}`);\r\n const ioFiles = this.parseFlsContent(fs.readFileSync(flsFile).toString(), rootDir);\r\n ioFiles.input.forEach((inputFile) => {\r\n // Drop files that are also listed as OUTPUT or should be ignored\r\n if (ioFiles.output.includes(inputFile) ||\r\n this.isExcluded(inputFile) ||\r\n !fs.existsSync(inputFile)) {\r\n return;\r\n }\r\n // Drop the current rootFile often listed as INPUT and drop any file that is already in the texFileTree\r\n if (baseFile === inputFile || inputFile in this.cachedContent) {\r\n return;\r\n }\r\n if (path.extname(inputFile) === '.tex') {\r\n // Parse tex files as imported subfiles.\r\n this.cachedContent[baseFile].children.push({\r\n index: Number.MAX_VALUE,\r\n file: inputFile\r\n });\r\n this.parseFileAndSubs(inputFile);\r\n }\r\n else if (this.fileWatcher && !this.filesWatched.includes(inputFile)) {\r\n // Watch non-tex files.\r\n this.fileWatcher.add(inputFile);\r\n this.filesWatched.push(inputFile);\r\n }\r\n });\r\n ioFiles.output.forEach((outputFile) => {\r\n if (path.extname(outputFile) === '.aux' && fs.existsSync(outputFile)) {\r\n this.parseAuxFile(fs.readFileSync(outputFile).toString(), path.dirname(outputFile).replace(outDir, rootDir));\r\n }\r\n });\r\n }", "_updateTransform() {\n this._applyTransform(this._transform)\n this.redraw()\n if (this.callbacks.didUpdateTransform) {\n this.callbacks.didUpdateTransform(this._transform)\n }\n }", "function LGraphTransform()\r\n\t{\r\n\t\tthis.properties = {node_id:\"\"};\r\n\t\tif(LGraphSceneNode._current_node_id)\r\n\t\t\tthis.properties.node_id = LGraphSceneNode._current_node_id;\r\n\t\tthis.addInput(\"Transform\",\"Transform\");\r\n\t\tthis.addOutput(\"Position\",\"vec3\");\r\n\t}", "function process(file, enc, callback) {\n /*jshint validthis:true*/\n\n // Do nothing if no contents\n if (file.isNull()) {\n return callback();\n }\n if (file.isStream()) {\n this.emit(\"error\",\n new gutil.PluginError(PLUGIN_NAME, \"Stream content is not supported\"));\n return callback();\n }\n // check if file.contents is a `Buffer`\n if (file.isBuffer() || file.isFile()) {\n var parser = imagesize.Parser();\n\n var retStatus = parser.parse(file.contents);\n if (imagesize.Parser.DONE === retStatus) {\n var result = parser.getResult();\n result.file = libpath.relative(file.base, file.path)\n list.push(result);\n }\n }\n return callback();\n }", "transformVertices(transformFunction) {\n this.checkVertices();\n var vert = this.verts;\n\n for (let i = 0; i < vert.length; i += 3) {\n let transform = transformFunction(vert[i], vert[i + 1], vert[i + 2]);\n if (transform) {\n vert[i] += transform[0];\n vert[i + 1] += transform[1];\n vert[i + 2] += transform[2];\n }\n }\n this.verts = vert;\n }", "async function handleUploadedFiles() {\n if (!this.files.length) {\n console.log(`no files selected`)\n // fileList.innerHTML = \"<p>No files selected!</p>\";\n } else {\n\n const contents = await this.files[0].text()\n uploadedData = JSON.parse(contents)\n // initializeTree(\"filemodelTree\", uploadedData, \"upload\", (uploadedData) => {\n\n // console.log(`uploaded data has arrived ${JSON.stringify(uploadedData)}`)\n // data.model = Object.assign(data.model, uploadedData.model)\n // data.templates = data.templates.concat(uploadedData.templates)\n // data.viewpoints = data.viewpoints.concat(uploadedData.viewpoints)\n // // set id values on all ratings and objects that currently do not have them\n // // probably temporary function until all data sets have id values\n // // add uuid to objects and ratings - just to be sure\n // data.viewpoints.forEach((viewpoint) => addUUIDtoBlips(viewpoint.blips))\n // if (uploadedData.objects != null && uploadedData.objects.length > 0) {\n // // merge the arrays of uploaded objects in with the existing objects per object type\n // for (let i = 0; i < Object.keys(uploadedData.objects).length; i++) {\n // data.objects[Object.keys(uploadedData.objects)[i]] =\n // uploadedData.objects[Object.keys(uploadedData.objects)[i]].\n // concat(data.objects[Object.keys(uploadedData.objects)[i]])\n\n // data.objects[Object.keys(uploadedData.objects)[i]].forEach((object) => { if (object.id == null) { object.id = uuidv4() } })\n // }\n // }\n\n // publishRefreshRadar()\n // }, data.model)\n // TODO serialize data\n const deserializedData = deserialize(uploadedData)\n data = deserializedData\n calculateDerivedProperties()\n\n publishRefreshRadar()\n\n }\n}", "function run(transformer, options) {\n\t return runFile(process.argv[2], transformer, options);\n\t}", "loadFile(file, module, x, y) {\n var dsp_code;\n var reader = new FileReader();\n var ext = file.name.toString().split('.').pop();\n var filename = file.name.toString().split('.').shift();\n var type;\n if (ext == \"dsp\") {\n type = \"dsp\";\n reader.readAsText(file);\n }\n else if (ext == \"json\") {\n type = \"json\";\n reader.readAsText(file);\n }\n else if (ext == \"jfaust\") {\n type = \"jfaust\";\n reader.readAsText(file);\n }\n else if (ext == \".polydsp\") {\n type = \"poly\";\n reader.readAsText(file);\n }\n else {\n throw new Error(Utilitary.messageRessource.errorObjectNotFaustCompatible);\n }\n reader.onloadend = (e) => {\n dsp_code = \"process = vgroup(\\\"\" + filename + \"\\\",environment{\" + reader.result + \"}.process);\";\n if (!module) {\n if (type == \"dsp\") {\n this.compileFaust({ isMidi: false, name: filename, sourceCode: dsp_code, x: x, y: y, callback: (factory) => { this.createModule(factory); } });\n }\n else if (type == \"jfaust\") {\n Utilitary.currentScene.recallScene(reader.result);\n }\n else if (type == \"poly\") {\n this.compileFaust({ isMidi: true, name: filename, sourceCode: dsp_code, x: x, y: y, callback: (factory) => { this.createModule(factory); } });\n }\n }\n else {\n if (type == \"dsp\") {\n module.isMidi = false;\n module.update(filename, dsp_code);\n }\n else if (type == \"jfaust\") {\n Utilitary.currentScene.recallScene(reader.result);\n }\n else if (type == \"poly\") {\n module.isMidi = true;\n module.update(filename, dsp_code);\n }\n }\n };\n }", "function processEach(params, file, done) {\r\n console.log(\"Parsing file: \", file);\r\n parseUtils\r\n .parseFile(file)\r\n .then(function(parseResult) {\r\n // save the original source code.\r\n params.sourceStore[file] = parseResult.src;\r\n\r\n // adapt our block ID generator for this file.\r\n var blockIDGen = function(blockInfo) {\r\n return params.idGenerator.newID({\r\n script: file,\r\n func: blockInfo.func\r\n });\r\n };\r\n\r\n // instrument the code.\r\n var result = instrument(\r\n parseResult.src,\r\n parseResult.ast,\r\n blockIDGen,\r\n params\r\n );\r\n\r\n // write the modified code back to the original file.\r\n fs.writeFileSync(file, result.result, \"utf8\");\r\n\r\n // just return the block & function data.\r\n done(null, {\r\n blocks: result.blocks,\r\n functions: result.functions\r\n });\r\n })\r\n .catch(function(e) {\r\n // don't kill the whole process.\r\n console.error(\"Problem instrumenting file. \", e, \" in file: \", file);\r\n done(null, { blocks: [], functions: [] });\r\n })\r\n .done();\r\n}", "function transformToUmd(files, dest) {\n return eventStream.merge(files.map((file) => { // eslint-disable-line\n return gulp.src(file)\n .pipe(babel({\n presets: ['es2015'],\n moduleId: `ss.${path.parse(file).name}`,\n plugins: ['transform-es2015-modules-umd'],\n comments: false,\n }))\n .on('error', notify.onError({\n message: 'Error: <%= error.message %>',\n }))\n .pipe(gulp.dest(dest));\n }));\n}", "function fileToObject(file) {\n return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, file, { lastModified: file.lastModified, lastModifiedDate: file.lastModifiedDate, name: file.name, size: file.size, type: file.type, uid: file.uid, percent: 0, originFileObj: file });\n}", "process (filepath) {\n\t\tlet {\n\t\t\tchassis,\n\t\t\tgenerateNamespacedSelector,\n\t\t\tisNamespaced,\n\t\t\tnamespaceSelectors,\n\t\t\tprocessImports,\n\t\t\tprocessNesting,\n\t\t\tprocessAtRules,\n\t\t\tprocessMixins,\n\t\t\tprocessNot,\n\t\t\tprocessFunctions,\n\t\t\tstoreAtRules,\n\t\t\ttypographyEngineIsInitialized\n\t\t} = this\n\n\t\tlet {\n\t\t\tatRules,\n\t\t\tpost,\n\t\t\tsettings,\n\t\t\tutils\n\t\t} = chassis\n\n\t\tlet tasks = new NGN.Tasks()\n\t\tlet sourceMap\n\n\t\ttasks.add('Processing Imports', next => {\n\t\t\tif (typographyEngineIsInitialized) {\n\t\t\t\tthis.tree.walkAtRules('import', atRule => {\n\t\t\t\t\tchassis.imports.push(atRule.params)\n\t\t\t\t\tatRule.remove()\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tprocessImports()\n\t\t\tprocessNesting()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Mixins', next => {\n\t\t\tprocessMixins()\n\t\t\tprocessNot()\n\t\t\tprocessNesting()\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Functions', next => {\n\t\t\tprocessFunctions()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Namespacing Selectors', next => {\n\t\t\tnamespaceSelectors()\n\t\t\tnext()\n\t\t})\n\n\t\tif (typographyEngineIsInitialized) {\n\t\t\ttasks.add('Initializing Typography Engine', next => {\n\t\t\t\tthis.tree = this.core.css.append(this.tree)\n\t\t\t\tnext()\n\t\t\t})\n\t\t}\n\n\t\ttasks.add('Running Post-Processing Routines', next => {\n\t\t\tthis.tree.walkAtRules('chassis-post', atRule => {\n\t\t\t\tlet data = Object.assign({\n\t\t\t\t\troot: this.tree,\n\t\t\t\t\tatRule\n\t\t\t\t}, atRules.getProperties(atRule))\n\n\t\t\t\tpost.process(data)\n\t\t\t})\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing CSS4 Syntax', next => {\n\t\t\tenv.process(this.tree, {from: filepath}, settings.envCfg).then(processed => {\n\t\t\t\tthis.tree = processed.root\n\t\t\t\tnext()\n\t\t\t}, err => console.error(err))\n\t\t})\n\n\t\t// tasks.add('Merging matching adjacent rules...', next => {\n\t\t// \toutput = mergeAdjacentRules.process(output.toString())\n\t\t// \tnext()\n\t\t// })\n\n\t\ttasks.add('Beautifying Output', next => {\n\t\t\tremoveComments.process(this.tree).then(result => {\n\t\t\t\tperfectionist.process(result.css).then(result => {\n\t\t\t\t\tthis.tree = result.root\n\n\t\t\t\t\t// Remove empty rulesets\n\t\t\t\t\tthis.tree.walkRules(rule => {\n\t\t\t\t\t\tif (rule.nodes.length === 0) {\n\t\t\t\t\t\t\trule.remove()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\n\t\t\t\t\tnext()\n\t\t\t\t}, () => {\n\t\t\t\t\tthis.emit('processing.error', new Error('Error Beautifying Output'))\n\t\t\t\t})\n\t\t\t}, () => {\n\t\t\t\tthis.emit('processing.error', new Error('Error Removing Comments'))\n\t\t\t})\n\t\t})\n\n\t\tif (settings.minify) {\n\t\t\tlet minified\n\n\t\t\ttasks.add('Minifying Output', next => {\n\t\t\t\tminified = new CleanCss({\n\t\t\t\t\tsourceMap: settings.sourceMap\n\t\t\t\t}).minify(this.tree.toString())\n\n\t\t\t\tthis.tree = minified.styles\n\t\t\t\tnext()\n\t\t\t})\n\n\t\t\tif (settings.sourceMap) {\n\t\t\t\ttasks.add('Generating source map', next => {\n\t\t\t\t\tsourceMap = minified.sourceMap.toString()\n\t\t\t\t\tnext()\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// tasks.on('taskstart', evt => console.log(`${evt.name}...`))\n\t\t// tasks.on('taskcomplete', evt => console.log('Done.'))\n\n\t\ttasks.on('complete', () => this.emit('processing.complete', {\n\t\t\tcss: this.tree.toString(),\n\t\t\tsourceMap\n\t\t}))\n\n\t\tthis.emit('processing')\n\t\ttasks.run(true)\n\t}" ]
[ "0.64591384", "0.64591384", "0.644205", "0.644205", "0.644205", "0.644205", "0.644205", "0.644205", "0.6432624", "0.61897737", "0.60022", "0.60022", "0.5855565", "0.57527465", "0.5723397", "0.5631104", "0.55550617", "0.5509079", "0.5498221", "0.53799146", "0.5358135", "0.5353105", "0.5353105", "0.5300228", "0.5195237", "0.5164378", "0.5164378", "0.5164378", "0.5164378", "0.5164378", "0.51584375", "0.51484", "0.51195586", "0.5097301", "0.5089339", "0.50611323", "0.5060696", "0.5060696", "0.5052118", "0.50172544", "0.49545974", "0.49545974", "0.49545974", "0.49545974", "0.49545974", "0.49545974", "0.4930656", "0.49089247", "0.49083093", "0.49034876", "0.49034876", "0.48978457", "0.48472115", "0.48472115", "0.4845009", "0.47787443", "0.4774206", "0.4774206", "0.4774206", "0.4774206", "0.4759712", "0.47362143", "0.4720894", "0.46975777", "0.46896222", "0.4682136", "0.46723738", "0.46723738", "0.46723738", "0.46723738", "0.46723738", "0.46723738", "0.4664066", "0.4662419", "0.4662419", "0.46610084", "0.46576053", "0.46539417", "0.46515095", "0.4620561", "0.46125278", "0.4612134", "0.45986372", "0.4588475", "0.45784453", "0.45751292", "0.45641717", "0.45620573", "0.45560178", "0.45505798", "0.45308912", "0.45268404", "0.45255616", "0.4516373", "0.45114374" ]
0.5191977
30
Stringify a Unist node representation of a file (in string or VFile representation) into a string using the `Compiler` on the processor.
function stringify(node, doc) { var file = vfile(doc) var Compiler freeze() Compiler = processor.Compiler assertCompiler('stringify', Compiler) assertNode(node) if (newable(Compiler)) { return new Compiler(node, file).compile() } return Compiler(node, file) // eslint-disable-line new-cap }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stringify(node, doc) {\n var file = vfile(doc)\n var Compiler\n\n freeze()\n Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler, 'compile')) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }", "function stringify(node, doc) {\n var file = vfile(doc)\n var Compiler\n\n freeze()\n Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler, 'compile')) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }", "function stringify(node, doc) {\n var file = vfile(doc)\n var Compiler\n\n freeze()\n Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler, 'compile')) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }", "function stringify(node, doc) {\n var file = vfile(doc);\n var Compiler;\n\n freeze();\n Compiler = processor.Compiler;\n assertCompiler('stringify', Compiler);\n assertNode(node);\n\n if (newable(Compiler, 'compile')) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(node, file) // eslint-disable-line new-cap\n }", "function stringify(node, doc) {\n var file = vfile(doc);\n var Compiler;\n\n freeze();\n Compiler = processor.Compiler;\n assertCompiler('stringify', Compiler);\n assertNode(node);\n\n if (newable(Compiler)) {\n return new Compiler(node, file).compile();\n }\n\n return Compiler(node, file); // eslint-disable-line new-cap\n }", "function _node2string(node) {\n return node.source || stringify(node);\n}", "function nodeToString(typeNode) {\n return LineFeedPrinter_1.lineFeedPrinter.printNode(typescript_1.EmitHint.Unspecified, typeNode, typeNode.getSourceFile());\n}", "toString() {\n return `UnaryOperationNode { this.op = ${TypesRegistar.getUnaryOperationString(this.op)}, param = ${this.param} }`;\n }", "async _serializeGraph(file) {\n const graph = await this.reader.readFileGraph(file);\n const serializer = serializers.find(OUTPUT_TYPE);\n return new Promise((resolve, reject) => {\n let result = '';\n serializer.import(graph.toStream())\n .on('error', reject)\n .on('data', d => { result += d.toString(); })\n .on('end', () => resolve(result));\n });\n }", "dumpTree(filename) {\n const config = this.getConfigFor(filename);\n const resolved = config.resolve();\n const source = resolved.transformFilename(filename);\n const engine = new Engine(resolved, Parser);\n return engine.dumpTree(source);\n }", "function toString(file, options) {\n let contents = file[options.contentProp] || file.content || file.contents;\n const str = contents.toString();\n return options.trim ? str.trim() : str;\n}", "function treeForFile (file) {\n var contents = null\n try {\n contents = fs.readFileSync(file).toString()\n } catch (err) {\n if (err.code === 'ENOENT') {\n logger.error(\"File not found: \"+file)\n process.exit(1)\n }\n throw err\n }\n var name = path.basename(file),\n parser = new Parser()\n\n parser.file = name\n // Parse and type-check the file; catch and report any errors\n try {\n var tree = parser.parse(contents),\n typesystem = new TypeSystem()\n typesystem.walk(tree)\n } catch (err) {\n reportError(err)\n process.exit(1)\n }\n return tree\n}// treeForFile", "function loadFileToString(file) {\n let frawin = Cc[\"@mozilla.org/network/file-input-stream;1\"]\n .createInstance(Ci.nsIFileInputStream);\n frawin.init(file, -1, 0, 0);\n let fin = Cc[\"@mozilla.org/scriptableinputstream;1\"]\n .createInstance(Ci.nsIScriptableInputStream);\n fin.init(frawin);\n let data = \"\";\n let str = fin.read(4096);\n while (str.length > 0) {\n data += str;\n str = fin.read(4096);\n }\n fin.close();\n\n return data;\n}", "function Node(value) {\n this.value = './';\n this.path = undefined;\n this.extension = undefined;\n this.type = undefined;\n this.name = undefined;\n this.sons = [];\n\n if(value !== undefined) {\n this.value = value;\n }\n}", "function stringify(node) {\n let string = '';\n\n while (node) {\n string += node.next === null ? node.val : node.val + ' -> ' ;\n node = node.next;\n }\n\n return string;\n}", "toString() {\n return `NodeMessage<${this.id}>`;\n }", "function toString(file, options) {\n var str = (file.content || file.contents || '').toString();\n return options.trim ? str.trim() : str;\n}", "function emitSerializedTypeReferenceNode(node) {\n var location = node.parent;\n while (ts.isDeclaration(location) || ts.isTypeNode(location)) {\n location = location.parent;\n }\n // Clone the type name and parent it to a location outside of the current declaration.\n var typeName = ts.cloneEntityName(node.typeName, location);\n var result = resolver.getTypeReferenceSerializationKind(typeName);\n switch (result) {\n case ts.TypeReferenceSerializationKind.Unknown:\n var temp = createAndRecordTempVariable(0 /* Auto */);\n write(\"(typeof (\");\n emitNodeWithoutSourceMap(temp);\n write(\" = \");\n emitEntityNameAsExpression(typeName, /*useFallback*/ true);\n write(\") === 'function' && \");\n emitNodeWithoutSourceMap(temp);\n write(\") || Object\");\n break;\n case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue:\n emitEntityNameAsExpression(typeName, /*useFallback*/ false);\n break;\n case ts.TypeReferenceSerializationKind.VoidType:\n write(\"void 0\");\n break;\n case ts.TypeReferenceSerializationKind.BooleanType:\n write(\"Boolean\");\n break;\n case ts.TypeReferenceSerializationKind.NumberLikeType:\n write(\"Number\");\n break;\n case ts.TypeReferenceSerializationKind.StringLikeType:\n write(\"String\");\n break;\n case ts.TypeReferenceSerializationKind.ArrayLikeType:\n write(\"Array\");\n break;\n case ts.TypeReferenceSerializationKind.ESSymbolType:\n if (languageVersion < 2 /* ES6 */) {\n write(\"typeof Symbol === 'function' ? Symbol : Object\");\n }\n else {\n write(\"Symbol\");\n }\n break;\n case ts.TypeReferenceSerializationKind.TypeWithCallSignature:\n write(\"Function\");\n break;\n case ts.TypeReferenceSerializationKind.ObjectType:\n write(\"Object\");\n break;\n }\n }", "function file_to_string(path) {\n const fs = require('fs') \n\treturn fs.readFileSync(path, 'utf8');\n}", "function compileFile(file, basepath) {\n var filepath = path.join(basepath || test_dir, file);\n var ast;\n try {\n ast = RapydScript.parse(fs.readFileSync(filepath, \"utf-8\"), {\n filename: file,\n es6: argv.ecmascript6,\n toplevel: ast,\n readfile: fs.readFileSync,\n basedir: test_dir,\n libdir: path.join(src_path, 'lib'),\n });\n } catch(ex) {\n console.log(file + \":\\t\" + ex + \"\\n\");\n return;\n }\n // generate output\n var output = RapydScript.OutputStream({\n baselib: baselib,\n beautify: true\n });\n ast.print(output);\n return output;\n }", "function printValue(path) {\n if (path.node.start == null) {\n try {\n const nodeCopy = {\n ...path.node,\n };\n // `estree-to-babel` expects the `comments` property to exist on the top-level node\n if (!nodeCopy.comments) {\n nodeCopy.comments = [];\n }\n return (0, generator_1.default)((0, estree_to_babel_1.default)(nodeCopy), {\n comments: false,\n concise: true,\n }).code;\n }\n catch (err) {\n throw new Error(`Cannot print raw value for type '${path.node.type}'. Please report this with an example at https://github.com/reactjs/react-docgen/issues.\n\nOriginal error:\n${err.stack}`);\n }\n }\n const src = getSrcFromAst(path);\n return deindent(src.slice(path.node.start, path.node.end));\n}", "function printValue(path) {\n if (path.node.start == null) {\n try {\n const nodeCopy = { ...path.node\n }; // `estree-to-babel` expects the `comments` property to exist on the top-level node\n\n if (!nodeCopy.comments) {\n nodeCopy.comments = [];\n }\n\n return (0, _generator.default)((0, _estreeToBabel.default)(nodeCopy), {\n comments: false,\n concise: true\n }).code;\n } catch (err) {\n throw new Error(`Cannot print raw value for type '${path.node.type}'. Please report this with an example at https://github.com/reactjs/react-docgen/issues.\n\nOriginal error:\n${err.stack}`);\n }\n }\n\n const src = getSrcFromAst(path);\n return deindent(src.slice(path.node.start, path.node.end));\n}", "function printFile(fileName) {\n if (!fileName) {\n // tslint:disable-next-line\n console.log('Usage:\\n' + green('drcp run @dr-core/ng-app-builder/dist/utils/ts-ast-query --file <ts file>'));\n return;\n }\n new Selector(fs.readFileSync(fileName, 'utf8'), fileName).printAll();\n}", "function parse(src) {\n return new recast.types.NodePath(recast.parse(stringify(src)).program);\n}", "fileString() {\n return this.id + \" \" + this.type + \" \" + this.note + \" \" + this.amount;\n }", "stringify(node) {\n let string = \"\";\n if (!node.getData()) {\n let children = node.getChildren();\n string += \"(\";\n\n for (let i = 0; i < children.length; i++) {\n string += (i != 0) ? \" \" : \"\";\n string += this.stringify(children[i]);\n }\n string += \")\";\n } else {\n string += node.getData().data;\n }\n\n return string;\n }", "toString() {\n return `${ this.constructor.name }<${ \n this.sourceAttribute } -> ${ this.destinationAttribute \n }> {\\n loaded: ${ \n this.loaded \n },\\n host: ${ \n (this.host + '').replace(/\\n/g, '\\n ') \n }\\n}`;\n }", "toString(idt = '', name = this.constructor.name) {\r\n\t\t\t\t\tvar tree;\r\n\t\t\t\t\ttree = '\\n' + idt + name;\r\n\t\t\t\t\tif (this.soak) {\r\n\t\t\t\t\t\ttree += '?';\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.eachChild(function(node) {\r\n\t\t\t\t\t\treturn tree += node.toString(idt + TAB);\r\n\t\t\t\t\t});\r\n\t\t\t\t\treturn tree;\r\n\t\t\t\t}", "function tagFile() {\n\n // TODO: sort by further fields, too\n tags.sort(function(x,y){ return x.name > y.name ? 1 : x.name == y.name ? 0 : -1 });\n\n var tagFile = [];\n\n tagFile.push('!_TAG_FILE_SORTED\\t1\\t');\n tagFile.push('!_TAG_PROGRAM_AUTHOR\\tClaus Reinke\\t');\n tagFile.push('!_TAG_PROGRAM_NAME\\testr\\t');\n tagFile.push('!_TAG_PROGRAM_URL\\thttps://github.com/clausreinke/estr\\t');\n tagFile.push('!_TAG_PROGRAM_VERSION\\t0.0\\t');\n\n function encode_field(fld_str) {\n return fld_str.split('\\t').join(' ');\n }\n\n tags.forEach(function(tag){\n def_symbol = tag.def_symbol ? (\"\\tdef_symbol:\"+tag.def_symbol) : \"\";\n tag_id = tag.tag_id ? (\"\\ttag_id:\"+tag.tag_id) : \"\";\n class_id = tag.class_id ? (\"\\tclass_id:\"+tag.class_id) : \"\";\n children_scope = tag.children_scope ? (\"\\tchildren_scope:\"+tag.children_scope) : \"\"; \n dispinfo = tag.dispinfo ? (\"\\tdispinfo:\"+encode_field(tag.dispinfo)) : \"\";\n tagFile.push(tag.name+\"\\t\"+tag.file+\"\\t\"+tag.addr+\";\\\"\\t\"+tag.kind\n +\"\\tlineno:\"+tag.lineno+\"\\tscope:\"+tag.scope + def_symbol + tag_id + class_id + children_scope + dispinfo);\n });\n\n return tagFile;\n}", "function fileToString(filePath){\n try{\n return fs.readFileSync(filePath, 'utf8');\n }catch(e){\n console.log(colors.bgRed('There was an error reading the file: '+ filePath))\n console.log(color.bgRed(e));\n return \"\";\n }\n}", "dump() {\n let s;\n\n for (let v of this.vertexes) {\n if (v.pos) {\n s = v.value + ' (' + v.pos.x + ',' + v.pos.y + '):';\n } else {\n s = v.value + ':';\n }\n\n for (let e of v.edges) {\n s += ` ${e.destination.value}`;\n }\n console.log(s);\n }\n }", "dump() {\n let s;\n\n for (let v of this.vertexes) {\n if (v.pos) {\n s = v.value + ' (' + v.pos.x + ',' + v.pos.y + '):';\n } else {\n s = v.value + ':';\n }\n\n for (let e of v.edges) {\n s += ` ${e.destination.value}`;\n }\n console.log(s);\n }\n }", "function printFunctionSourceCode(f) {\n return String(f);\n}", "function Compiler(tree, file) {\n this.inLink = false;\n this.inTable = false;\n this.tree = tree;\n this.file = file;\n this.options = xtend(this.options);\n this.setOptions({});\n}", "function print(node) {\n\t if (node.kind === 'Fragment') {\n\t return 'fragment ' + node.name + ' on ' + String(node.type) + printFragmentArgumentDefinitions(node.argumentDefinitions) + printDirectives(node.directives) + printSelections(node, '') + '\\n';\n\t } else if (node.kind === 'Root') {\n\t return node.operation + ' ' + node.name + printArgumentDefinitions(node.argumentDefinitions) + printDirectives(node.directives) + printSelections(node, '') + '\\n';\n\t } else {\n\t __webpack_require__(1)(false, 'RelayPrinter: Unsupported IR node `%s`.', node.kind);\n\t }\n\t}", "function nodePosToString(node) {\n var file = getSourceFileOfNode(node);\n var loc = ts.getLineAndCharacterOfPosition(file, node.pos);\n return file.fileName + \"(\" + (loc.line + 1) + \",\" + (loc.character + 1) + \")\";\n }", "stringify() {\n if (this.value === undefined) {\n const parser = new UCFGParser(this.output);\n\n if (parser.parse() === undefined) {\n throw new SyntaxError();\n }\n\n const out = this.output;\n delete this.output;\n return out;\n } else {\n this.stringifySection (this.value, 0);\n delete this.value;\n return this.output;\n }\n}", "function getObjString() {\n\tlet objString = \"# cube.obj\\r\\n#\\r\\n\\r\\nmtllib \" + fileName + \".mtl\\r\\n\\r\\ng cube\\r\\n\\r\\n\";\n\tfor (let v=0;v<objVertices.length;v++) {\n\t\tlet vert = objVertices[v];\n\t\tobjString += `v ${vert[0]} ${vert[1]} ${vert[2]}\\r\\n`;\n\t}\n\tfor (let m=0;m<objMtl.length;m++)\n\t{\n\t\tobjString += `g ${objMtl[m][1]}\\r\\nusemtl ${objMtl[m][1]}\\r\\n`;\n\t\tfor (let p=0;p<objMtl[m][2].length;p++)\n\t\t{\n\t\t\tlet offset = objMtl[m][2][p];\n\t\t\tfor (let side=0;side<6;side++)\n\t\t\t{\n\t\t\t\tlet face = objFaces[offset+side];\n\t\t\t\tobjString += `f ${face[0]} ${face[1]} ${face[2]} ${face[3]}\\r\\n`;\n\t\t\t}\n\t\t}\n\t}\n\treturn objString;\n}", "function dump(n) {\n strip(n)\n fs.writeFileSync('dump.json', JSON.stringify(n), 'utf8')\n}", "function getNodeAsString()\n\t{\n\t\treturn this.n;\n\t}", "toString(){\n let currentNode = this.head;\n let string = '';\n\n while(currentNode){\n string += `${currentNode.value}`;\n currentNode = currentNode.next;\n }\n return string;\n }", "dumpSource(filename) {\n const config = this.getConfigFor(filename);\n const resolved = config.resolve();\n const sources = resolved.transformFilename(filename);\n return sources.reduce((result, source) => {\n result.push(`Source ${source.filename}@${source.line}:${source.column} (offset: ${source.offset})`);\n if (source.transformedBy) {\n result.push(\"Transformed by:\");\n result = result.concat(source.transformedBy.reverse().map((name) => ` - ${name}`));\n }\n if (source.hooks && Object.keys(source.hooks).length > 0) {\n result.push(\"Hooks\");\n for (const [key, present] of Object.entries(source.hooks)) {\n if (present) {\n result.push(` - ${key}`);\n }\n }\n }\n result.push(\"---\");\n result = result.concat(source.data.split(\"\\n\"));\n result.push(\"---\");\n return result;\n }, []);\n }", "function outSource(x) {\n if (x.toSource) { return x.toSource(); }\n else if (JSON && JSON.stringify) { return JSON.stringify(x); }\n else { return x.toString(); }\n}", "toString()\n\t{\n\t\treturn this.toStringRecursion(this.octree);\n\t}", "function getRootNode(file) {\n return ts.createSourceFile(file, fs.readFileSync(file).toString(), ts.ScriptTarget.Latest, true);\n}", "function print_file_tree(entries)\n{\n (debug?console.log(\"\\n________________________________________\\n\\tgenerateTree\\n\"):null);\n // entries obtained with sakura.apis.operator.get_file_tree()\n // are either:\n // - a directory: { 'name': <dirname>,\n // 'is_dir': true,\n // 'dir_entries': [ <entry>, <entry>, <entry>, ... ]\n // }\n // - a regular file: { 'name': <filename>,\n // 'is_dir': false\n // }\n // recursively, directory entries follow the same format.\n\n // treeHtmlString contains the lines of the tree\n var treeHtmlString = [];\n treeHtmlString.push(\"<div id='tree' class='tree'><ul>\");\n treeHtmlString.push(\"<li data-type='dir' data-path='/' data-jstree=\\\"{ 'opened' : true }\\\">/<ul>\");\n //call the recursive function\n print_dir(entries, treeHtmlString);\n treeHtmlString.push(\"</ul></li>\");\n treeHtmlString.push(\"</ul></li></div>\");\n var str = \"\";\n for(var i = 0 ; i < treeHtmlString.length ; i++) {\n str += treeHtmlString[i];\n }\n (debug?console.log(str):null);\n $(\"#treeDiv\").append(str);\n\n //Creates the jstree using #tree element, sorts alphabetically with folders on top\n setJsTree();\n\n $('#tree').bind('ready.jstree', function() {\n $('#tree').jstree(\"open_all\");\n });\n (debug?console.log(\"________________________________________\\n\"):null);\n}", "function toTNodeTypeAsString(tNodeType) {\n var text = '';\n tNodeType & 1\n /* Text */\n && (text += '|Text');\n tNodeType & 2\n /* Element */\n && (text += '|Element');\n tNodeType & 4\n /* Container */\n && (text += '|Container');\n tNodeType & 8\n /* ElementContainer */\n && (text += '|ElementContainer');\n tNodeType & 16\n /* Projection */\n && (text += '|Projection');\n tNodeType & 32\n /* Icu */\n && (text += '|IcuContainer');\n tNodeType & 64\n /* Placeholder */\n && (text += '|Placeholder');\n return text.length > 0 ? text.substring(1) : text;\n} // Note: This hack is necessary so we don't erroneously get a circular dependency", "toString(showTree=0, label=0) {\n\t\tif (!label) label = (u => this.x2s(u) + ':' + this.key(u));\n\t\tif (!showTree || this.m <= 1) {\n\t\t\tlet s = '[';\n\t\t\tfor (let i = 1; i <= this.m; i++) {\n\t\t\t\tlet lab = label(this.itemAt(i));\n\t\t\t\ts += (i > 1 && lab ? ' ' : '') + lab;\n\t\t\t}\n\t\t\treturn s + ']';\n\t\t}\n\t\tif (this.m == 1) return '[' + label(this.itemAt(1)) + ']';\n\t\tlet f = new Forest(this.n);\n\t\tfor (let x = 2; x <= this.m; x++) {\n\t\t\tf.link(this.itemAt(x),this.itemAt(this.p(x)));\n\t\t}\n\t\treturn f.toString((showTree ? 0x4 : 0), label).slice(1,-1);\n\t}", "dump() {\n\t\tlet s;\n\n\t\tfor (let v of this.vertexes) {\n\t\t\tif (v.pos) {\n\t\t\t\ts = v.value + ' (' + v.pos.x + ',' + v.pos.y + '):';\n\t\t\t} else {\n\t\t\t\ts = v.value + ':';\n\t\t\t}\n\n\t\t\tfor (let e of v.edges) {\n\t\t\t\ts += ` ${e.destination.value}`;\n\t\t\t}\n\t\t\tconsole.log(s);\n\t\t}\n\t}", "function binaryExpressionToString(toParse) {\n switch (toParse['type']) {\n case 'Identifier':\n return toParse['name'];\n case 'Literal':\n return toParse['value'];\n case 'MemberExpression':\n return (\n toParse['object']['name'] +\n `[${binaryExpressionToString(toParse['property'])}]`\n );\n case 'UnaryExpression':\n return (\n toParse['operator'] + binaryExpressionToString(toParse['argument'])\n );\n default:\n return handleBinary(toParse);\n }\n}", "function stringifyNode(node)\n{\n\tvar result = \"<\"+node.nodeName;\n\tvar numAttrs = node.attrs.length;\n\t\n\tfor (var i=0; i<numAttrs; i++)\n\t{\n\t\tresult += \" \"+ node.attrs[i].name +'=\"'+ node.attrs[i].value +'\"';\n\t}\n\t\n\tresult += \">\";\n\t\n\treturn result;\n}", "toStringify() {\n let current = this.head;\n let string = \"\";\n\n while (current) {\n string += current.data + (current.next ? \"\\n\" : \"\");\n current = current.next;\n }\n return string;\n }", "function uglifyString(content) {\n\t\tvar ast = uglifyjs.parse(content);\n\t\tast.figure_out_scope();\n\t\tvar compressor = uglifyjs.Compressor();\n\t\tast = ast.transform(compressor);\n\t\tast.figure_out_scope();\n\t\tast.compute_char_frequency();\n\t\tast.mangle_names();\n\t\treturn ast.print_to_string();\n\t}", "function dump() {\n if ( noDump ) {\n return;\n }\n\n function toStr( node ) {\n if ( node === null ) {\n return \"()\";\n }\n else {\n return \"(\" +\n (node.red ? \"R\" : \"B\") + \" \" +\n node.data +\n ( node.left === null && node.right === null ? \"\" :\n \" \" + toStr(node.left) + \" \" + toStr(node.right) ) +\n \")\";\n }\n }\n\n console.log(\"CMP \" + toStr(tree._root))\n}", "function CallSiteToString() {\n var fileName;\n var fileLocation = \"\";\n if (this.isNative()) {\n fileLocation = \"native\";\n } else {\n fileName = this.getScriptNameOrSourceURL();\n if (!fileName && this.isEval()) {\n fileLocation = this.getEvalOrigin();\n fileLocation += \", \"; // Expecting source position to follow.\n }\n\n if (fileName) {\n fileLocation += fileName;\n } else {\n // Source code does not originate from a file and is not native, but we\n // can still get the source position inside the source string, e.g. in\n // an eval string.\n fileLocation += \"<anonymous>\";\n }\n var lineNumber = this.getLineNumber();\n if (lineNumber != null) {\n fileLocation += \":\" + lineNumber;\n var columnNumber = this.getColumnNumber();\n if (columnNumber) {\n fileLocation += \":\" + columnNumber;\n }\n }\n }\n\n var line = \"\";\n var functionName = this.getFunctionName();\n var addSuffix = true;\n var isConstructor = this.isConstructor();\n var isMethodCall = !(this.isToplevel() || isConstructor);\n if (isMethodCall) {\n var typeName = this.getTypeName();\n // Fixes shim to be backward compatable with Node v0 to v4\n if (typeName === \"[object Object]\") {\n typeName = \"null\";\n }\n var methodName = this.getMethodName();\n if (functionName) {\n if (typeName && functionName.indexOf(typeName) != 0) {\n line += typeName + \".\";\n }\n line += functionName;\n if (methodName && functionName.indexOf(\".\" + methodName) != functionName.length - methodName.length - 1) {\n line += \" [as \" + methodName + \"]\";\n }\n } else {\n line += typeName + \".\" + (methodName || \"<anonymous>\");\n }\n } else if (isConstructor) {\n line += \"new \" + (functionName || \"<anonymous>\");\n } else if (functionName) {\n line += functionName;\n } else {\n line += fileLocation;\n addSuffix = false;\n }\n if (addSuffix) {\n line += \" (\" + fileLocation + \")\";\n }\n return line;\n}", "function CallSiteToString() {\n var fileName;\n var fileLocation = \"\";\n if (this.isNative()) {\n fileLocation = \"native\";\n } else {\n fileName = this.getScriptNameOrSourceURL();\n if (!fileName && this.isEval()) {\n fileLocation = this.getEvalOrigin();\n fileLocation += \", \"; // Expecting source position to follow.\n }\n\n if (fileName) {\n fileLocation += fileName;\n } else {\n // Source code does not originate from a file and is not native, but we\n // can still get the source position inside the source string, e.g. in\n // an eval string.\n fileLocation += \"<anonymous>\";\n }\n var lineNumber = this.getLineNumber();\n if (lineNumber != null) {\n fileLocation += \":\" + lineNumber;\n var columnNumber = this.getColumnNumber();\n if (columnNumber) {\n fileLocation += \":\" + columnNumber;\n }\n }\n }\n\n var line = \"\";\n var functionName = this.getFunctionName();\n var addSuffix = true;\n var isConstructor = this.isConstructor();\n var isMethodCall = !(this.isToplevel() || isConstructor);\n if (isMethodCall) {\n var typeName = this.getTypeName();\n // Fixes shim to be backward compatable with Node v0 to v4\n if (typeName === \"[object Object]\") {\n typeName = \"null\";\n }\n var methodName = this.getMethodName();\n if (functionName) {\n if (typeName && functionName.indexOf(typeName) != 0) {\n line += typeName + \".\";\n }\n line += functionName;\n if (methodName && functionName.indexOf(\".\" + methodName) != functionName.length - methodName.length - 1) {\n line += \" [as \" + methodName + \"]\";\n }\n } else {\n line += typeName + \".\" + (methodName || \"<anonymous>\");\n }\n } else if (isConstructor) {\n line += \"new \" + (functionName || \"<anonymous>\");\n } else if (functionName) {\n line += functionName;\n } else {\n line += fileLocation;\n addSuffix = false;\n }\n if (addSuffix) {\n line += \" (\" + fileLocation + \")\";\n }\n return line;\n}", "function CallSiteToString() {\n var fileName;\n var fileLocation = \"\";\n if (this.isNative()) {\n fileLocation = \"native\";\n } else {\n fileName = this.getScriptNameOrSourceURL();\n if (!fileName && this.isEval()) {\n fileLocation = this.getEvalOrigin();\n fileLocation += \", \"; // Expecting source position to follow.\n }\n\n if (fileName) {\n fileLocation += fileName;\n } else {\n // Source code does not originate from a file and is not native, but we\n // can still get the source position inside the source string, e.g. in\n // an eval string.\n fileLocation += \"<anonymous>\";\n }\n var lineNumber = this.getLineNumber();\n if (lineNumber != null) {\n fileLocation += \":\" + lineNumber;\n var columnNumber = this.getColumnNumber();\n if (columnNumber) {\n fileLocation += \":\" + columnNumber;\n }\n }\n }\n\n var line = \"\";\n var functionName = this.getFunctionName();\n var addSuffix = true;\n var isConstructor = this.isConstructor();\n var isMethodCall = !(this.isToplevel() || isConstructor);\n if (isMethodCall) {\n var typeName = this.getTypeName();\n // Fixes shim to be backward compatable with Node v0 to v4\n if (typeName === \"[object Object]\") {\n typeName = \"null\";\n }\n var methodName = this.getMethodName();\n if (functionName) {\n if (typeName && functionName.indexOf(typeName) != 0) {\n line += typeName + \".\";\n }\n line += functionName;\n if (methodName && functionName.indexOf(\".\" + methodName) != functionName.length - methodName.length - 1) {\n line += \" [as \" + methodName + \"]\";\n }\n } else {\n line += typeName + \".\" + (methodName || \"<anonymous>\");\n }\n } else if (isConstructor) {\n line += \"new \" + (functionName || \"<anonymous>\");\n } else if (functionName) {\n line += functionName;\n } else {\n line += fileLocation;\n addSuffix = false;\n }\n if (addSuffix) {\n line += \" (\" + fileLocation + \")\";\n }\n return line;\n}", "function CallSiteToString() {\n var fileName;\n var fileLocation = \"\";\n if (this.isNative()) {\n fileLocation = \"native\";\n } else {\n fileName = this.getScriptNameOrSourceURL();\n if (!fileName && this.isEval()) {\n fileLocation = this.getEvalOrigin();\n fileLocation += \", \"; // Expecting source position to follow.\n }\n\n if (fileName) {\n fileLocation += fileName;\n } else {\n // Source code does not originate from a file and is not native, but we\n // can still get the source position inside the source string, e.g. in\n // an eval string.\n fileLocation += \"<anonymous>\";\n }\n var lineNumber = this.getLineNumber();\n if (lineNumber != null) {\n fileLocation += \":\" + lineNumber;\n var columnNumber = this.getColumnNumber();\n if (columnNumber) {\n fileLocation += \":\" + columnNumber;\n }\n }\n }\n\n var line = \"\";\n var functionName = this.getFunctionName();\n var addSuffix = true;\n var isConstructor = this.isConstructor();\n var isMethodCall = !(this.isToplevel() || isConstructor);\n if (isMethodCall) {\n var typeName = this.getTypeName();\n // Fixes shim to be backward compatable with Node v0 to v4\n if (typeName === \"[object Object]\") {\n typeName = \"null\";\n }\n var methodName = this.getMethodName();\n if (functionName) {\n if (typeName && functionName.indexOf(typeName) != 0) {\n line += typeName + \".\";\n }\n line += functionName;\n if (methodName && functionName.indexOf(\".\" + methodName) != functionName.length - methodName.length - 1) {\n line += \" [as \" + methodName + \"]\";\n }\n } else {\n line += typeName + \".\" + (methodName || \"<anonymous>\");\n }\n } else if (isConstructor) {\n line += \"new \" + (functionName || \"<anonymous>\");\n } else if (functionName) {\n line += functionName;\n } else {\n line += fileLocation;\n addSuffix = false;\n }\n if (addSuffix) {\n line += \" (\" + fileLocation + \")\";\n }\n return line;\n}", "function CallSiteToString() {\n var fileName;\n var fileLocation = \"\";\n if (this.isNative()) {\n fileLocation = \"native\";\n } else {\n fileName = this.getScriptNameOrSourceURL();\n if (!fileName && this.isEval()) {\n fileLocation = this.getEvalOrigin();\n fileLocation += \", \"; // Expecting source position to follow.\n }\n\n if (fileName) {\n fileLocation += fileName;\n } else {\n // Source code does not originate from a file and is not native, but we\n // can still get the source position inside the source string, e.g. in\n // an eval string.\n fileLocation += \"<anonymous>\";\n }\n var lineNumber = this.getLineNumber();\n if (lineNumber != null) {\n fileLocation += \":\" + lineNumber;\n var columnNumber = this.getColumnNumber();\n if (columnNumber) {\n fileLocation += \":\" + columnNumber;\n }\n }\n }\n\n var line = \"\";\n var functionName = this.getFunctionName();\n var addSuffix = true;\n var isConstructor = this.isConstructor();\n var isMethodCall = !(this.isToplevel() || isConstructor);\n if (isMethodCall) {\n var typeName = this.getTypeName();\n // Fixes shim to be backward compatable with Node v0 to v4\n if (typeName === \"[object Object]\") {\n typeName = \"null\";\n }\n var methodName = this.getMethodName();\n if (functionName) {\n if (typeName && functionName.indexOf(typeName) != 0) {\n line += typeName + \".\";\n }\n line += functionName;\n if (methodName && functionName.indexOf(\".\" + methodName) != functionName.length - methodName.length - 1) {\n line += \" [as \" + methodName + \"]\";\n }\n } else {\n line += typeName + \".\" + (methodName || \"<anonymous>\");\n }\n } else if (isConstructor) {\n line += \"new \" + (functionName || \"<anonymous>\");\n } else if (functionName) {\n line += functionName;\n } else {\n line += fileLocation;\n addSuffix = false;\n }\n if (addSuffix) {\n line += \" (\" + fileLocation + \")\";\n }\n return line;\n}", "function string_src(filename, str) {\n\tvar src = require(\"stream\").Readable({ objectMode: true });\n\n\tsrc._read = function () {\n\t\tthis.push(new gutil.File({ cwd: \"\", base: \"\", path: filename, contents: new Buffer(str) }));\n\t\tthis.push(null);\n\t};\n\n\treturn src;\n}", "toString() {\n return fast_safe_stringify_1.default(this.serialize(), stringifyReplacer, 2);\n }", "function repr(value)\n{\n if (typeof value === 'string')\n return \"'\" + value + \"'\";\n else if (typeof value === 'undefined')\n return 'undefined';\n else if (value === null)\n return 'null';\n else if (typeof value === 'object') {\n if (isState(value))\n return \"state<\" + value.toString() + \">\";\n else if (isSymbol(value))\n return \"symbol<\" + value.toString() + \">\";\n else if (isMotion(value))\n return \"motion<\" + value.toString() + \">\";\n else if (isInstrTuple(value))\n return \"instruction<\" + value.toString() + \">\";\n else if (isPosition(value))\n return \"position<\" + value.toString() + \">\";\n else if (value.isProgram)\n return \"program<count=\" + value.count() + \">\";\n else if (value.isTape)\n return \"tape<\" + value.toHumanString() + \">\";\n else {\n var count_props = 0;\n for (var prop in value)\n count_props += 1;\n if (count_props < 5)\n return \"object<\" + JSON.stringify(value) + \">\";\n else if (!value.toString().match(/Object/))\n return \"object<\" + value.toString() + \">\";\n else\n return \"object\";\n }\n }\n else if (typeof value === 'boolean')\n return \"bool<\" + value + \">\";\n else if (typeof value === 'number')\n return \"\" + value;\n else if (typeof value === 'symbol')\n return \"symbol<\" + value + \">\";\n else if (typeof value === 'function') {\n if (value.name === \"\")\n return \"anonymous function\";\n else\n return \"function<\" + value.name + \">\";\n } else\n return \"unknown value: \" + value;\n}", "static async compileFile (fromFileRelative, toDirRelative, data, options) {\n const { name, dir } = path.parse(fromFileRelative)\n let subDir = options.base ? dir.split(options.base).pop() : ''\n subDir = subDir.startsWith('/') ? subDir.slice(1) : subDir\n const toFileAbsolute = path.resolve(toDirRelative, subDir, name + options.ext)\n const fromFileAbsolute = path.resolve(fromFileRelative)\n const result = await CompileEjsTask.renderFile(fromFileAbsolute, data, options)\n fs.outputFileSync(toFileAbsolute, result)\n }", "function makeFile(info) {\n const { comment, upstream, config } = info\n return (\n `// ${comment}\\n` +\n '//\\n' +\n `// Auto-generated by ${packageJson.name}\\n` +\n `// based on rules from ${upstream}\\n` +\n '\\n' +\n '\"use strict\";\\n' +\n '\\n' +\n `module.exports = ${JSON.stringify(sortJson(config), null, 2)};\\n`\n )\n}", "function toTNodeTypeAsString(tNodeType) {\n var text = '';\n tNodeType & 1\n /* Text */\n && (text += '|Text');\n tNodeType & 2\n /* Element */\n && (text += '|Element');\n tNodeType & 4\n /* Container */\n && (text += '|Container');\n tNodeType & 8\n /* ElementContainer */\n && (text += '|ElementContainer');\n tNodeType & 16\n /* Projection */\n && (text += '|Projection');\n tNodeType & 32\n /* Icu */\n && (text += '|IcuContainer');\n tNodeType & 64\n /* Placeholder */\n && (text += '|Placeholder');\n return text.length > 0 ? text.substring(1) : text;\n } // Note: This hack is necessary so we don't erroneously get a circular dependency", "function rfs(file) {\n return fs.readFileSync(path.join(__dirname, file), 'utf-8').replace(/\\r\\n/g, '\\n');\n}", "function generateFile(data) {\n FileReader.writeFile(\"compiled.js\", data, (err) => {\n if (err) {\n console.log(\"File write err\");\n }\n });\n}", "function compile_fun() {\n exec(\"mi \" + sourceFile + ' > ' + __dirname +'/webpage/js/data-source.js', (error, stdout, stderr) => {\n\tif (error) {\n\t fs.readFile(__dirname +'/webpage/js/data-source.js', function(err, buf) {\n\t\tfs.writeFile(__dirname +'/webpage/js/data-source.js',\n\t\t\t \"let inputModel = '\" + buf.toString().replace(/(\\r\\n|\\n|\\r)/gm, \"\")\n\t\t\t + \"';\" , function (err) {if (err) return console.log(err);});});return;}\n\tif (stderr) {\n console.log(`stderr: ${stderr}`);\n return;\n\t}\n });\n}", "toString() {\n this.path\n }", "function toNlcst(tree, file, Parser) {\n var parser\n var location\n var results\n var doc\n\n // Warn for invalid parameters.\n if (!tree || !tree.type) {\n throw new Error('hast-util-to-nlcst expected node')\n }\n\n if (!file || !file.messages) {\n throw new Error('hast-util-to-nlcst expected file')\n }\n\n // Construct parser.\n if (!Parser) {\n throw new Error('hast-util-to-nlcst expected parser')\n }\n\n if (!position.start(tree).line || !position.start(tree).column) {\n throw new Error('hast-util-to-nlcst expected position on nodes')\n }\n\n doc = String(file)\n location = vfileLocation(doc)\n parser = 'parse' in Parser ? Parser : new Parser()\n\n // Transform hast to nlcst, and pass these into `parser.parse` to insert\n // sentences, paragraphs where needed.\n results = []\n\n find(tree)\n\n return {\n type: 'RootNode',\n children: results,\n position: {start: location.toPoint(0), end: location.toPoint(doc.length)}\n }\n\n function find(node) {\n if (node.type === 'root') {\n findAll(node.children)\n } else if (node.type === 'element' && !ignore(node)) {\n if (explicit(node)) {\n // Explicit paragraph.\n add(node)\n } else if (flowAccepting(node)) {\n // Slightly simplified version of: <https://html.spec.whatwg.org/#paragraphs>.\n implicit(flattenAll(node.children))\n } else {\n // Dig deeper.\n findAll(node.children)\n }\n }\n }\n\n function findAll(children) {\n var index = -1\n\n while (++index < children.length) {\n find(children[index])\n }\n }\n\n function flattenAll(children) {\n var results = []\n var index = -1\n\n while (++index < children.length) {\n if (unravelInParagraph(children[index])) {\n push.apply(results, flattenAll(children[index].children))\n } else {\n results.push(children[index])\n }\n }\n\n return results\n }\n\n function add(node) {\n var result = ('length' in node ? all : one)(node)\n\n if (result.length) {\n results.push(parser.tokenizeParagraph(result))\n }\n }\n\n function implicit(children) {\n var index = -1\n var start = -1\n var viable\n var child\n\n while (++index <= children.length) {\n child = children[index]\n\n if (child && phrasing(child)) {\n if (start === -1) start = index\n\n if (!viable && !embedded(child) && !whitespace(child)) {\n viable = true\n }\n } else if (child && start === -1) {\n find(child)\n start = index + 1\n } else if (start !== -1) {\n ;(viable ? add : findAll)(children.slice(start, index))\n\n if (child) {\n find(child)\n }\n\n viable = null\n start = -1\n }\n }\n }\n\n // Convert `node` (hast) to nlcst.\n function one(node) {\n var replacement\n var change\n\n if (node.type === 'text') {\n replacement = parser.tokenize(node.value)\n change = true\n } else if (node.type === 'element' && !ignore(node)) {\n if (node.tagName === 'wbr') {\n replacement = [parser.tokenizeWhiteSpace(' ')]\n change = true\n } else if (node.tagName === 'br') {\n replacement = [parser.tokenizeWhiteSpace('\\n')]\n change = true\n } else if (source(node)) {\n replacement = [parser.tokenizeSource(textContent(node))]\n change = true\n } else {\n replacement = all(node.children)\n }\n }\n\n return change\n ? patch(replacement, location, location.toOffset(position.start(node)))\n : replacement\n }\n\n // Convert all `children` (hast) to nlcst.\n function all(children) {\n var results = []\n var index = -1\n\n while (++index < children.length) {\n push.apply(results, one(children[index]) || [])\n }\n\n return results\n }\n\n // Patch a position on each node in `nodes`.\n // `offset` is the offset in `file` this run of content starts at.\n //\n // Note that nlcst nodes are concrete, meaning that their starting and ending\n // positions can be inferred from their content.\n function patch(nodes, location, offset) {\n var index = -1\n var start = offset\n var end\n var node\n\n while (++index < nodes.length) {\n node = nodes[index]\n\n if (node.children) {\n patch(node.children, location, start)\n }\n\n end = start + toString(node).length\n\n node.position = {\n start: location.toPoint(start),\n end: location.toPoint(end)\n }\n\n start = end\n }\n\n return nodes\n }\n}", "function dump(obj, filename){\n let data_str = JSON.stringify(obj);\n fs.writeFileSync(filename, data_str)\n}", "dumpTokens(filename) {\n const config = this.getConfigFor(filename);\n const resolved = config.resolve();\n const source = resolved.transformFilename(filename);\n const engine = new Engine(resolved, Parser);\n return engine.dumpTokens(source);\n }", "function makeText(node, stat) {\n switch (typeof node) {\n case 'object':\n //return JSON.stringify(node);\n //node = removeNumberedIndices(node);\n return breakout(node, stat);\n break;\n case 'undefined':\n return '0';\n break;\n default:\n return node.toString();\n }\n }", "function buildTargetString(_member){\n var filename = '';\n var target = null;\n var targetString = '';\n for(var file in _member.targets){\n filename = file;\n\n if(_member.targets[file].add == true){\n targetString += filename;\n \n if(_member.targets[file].compress == false){\n targetString += '-u';\n }\n \n targetString += ',';\n \n }\n \n \n }\n /*cut off trailing comma*/\n if(targetString != '')\n targetString = targetString.substr(0, targetString.length - 1);\n \n console.log('TARGET STRING: ' + targetString);\n return targetString;\n }", "convert(node) {\n let result = this._write_node(node);\n\n if (!result.startsWith('\\n\\n')) result = this.escape_block(result);\n\n return result.replace(/^\\n+|\\n+$/g, '') + '\\n';\n }", "getHeader() {\n return `/**\n * IN2 Logic Tree File\n *\n * This file has been generated by an IN2 compiler.\n */\\n/*eslint-disable-line*/function run(isDryRun){\\n/* global player, core, engine */\nconst files = {};\nconst scope = {};\nconst CURRENT_NODE_VAR = '${CURRENT_NODE_VAR}';\nconst CURRENT_FILE_VAR = '${CURRENT_FILE_VAR}';\nconst LAST_FILE_VAR = '${LAST_FILE_VAR}';`;\n }", "function serializeText(nodeStr, funName, text)\n {\n // Try to keep \"document.write\" in inline-script from being preserved,\n // because document.write blows away the document in other contexts.\n text = text.replace(/document\\.write/g, \"tnemucod.write\");\n\n if (!splitTextNodes) {\n cs.push(nodeStr + \" = document.\" + funName + \"(\" + simpleSource(text) + \");\");\n } else {\n cs.push(nodeStr + \" = document.\" + funName + \"(\\\"\\\");\");\n for (var i = 0; i < text.length; ++i) {\n cs.push(nodeStr + \".data += \" + simpleSource(text[i]) + \";\");\n }\n }\n }", "function renderToString($, indent, level) {\n let attrs = getAttrs($.node.props);\n let s1 = `<${$.node.type}${renderAttrsToString(attrs)}>`;\n if (Tools.isVoidElement($.node.type)) {\n return Tools.format(s1, indent, level);\n }\n let s3 = `</${$.node.type}>`;\n if ($.node.children.length === 0) {\n return Tools.format(s1 + s3, indent, level);\n }\n let s2;\n if ($.node.children.length === 1 && $.node.children[0].type === \"#\") {\n s2 = $.childWraps[0].renderToString(0, 0);\n return Tools.format(s1 + s2 + s3, indent, level);\n }\n s1 = Tools.format(s1, indent, level);\n s2 = $.childWraps.map(x => x.renderToString(indent, level + 1)).join(\"\");\n s3 = Tools.format(s3, indent, level);\n return s1 + s2 + s3;\n}", "function church_ast_to_string(ast) {\n\tif (util.is_leaf(ast)) {\n\t\treturn ast.text;\n\t} else {\n\t\treturn \"(\" + ast.children.map(function(x) {return church_ast_to_string(x)}).join(\" \") + \")\"\n\t}\n}", "function compileFile(filename, options) {\n fs.readFile(filename, \"utf-8\", (error, sourceCode) => {\n if (error) {\n console.error(error);\n return;\n }\n console.log(compile(sourceCode, options));\n });\n}", "toString(callback) {\n return this.toArray((node) => node.toString(callback)).toString();\n }", "vlist2string(vlist, label) {\n\t\tlet s = '';\n\t\tfor (let u of vlist) {\n\t\t\tif (s.length > 0) s += ' ';\n\t\t\ts += this.x2s(e, label);\n\t\t}\n\t\treturn '[' + s + ']';\n\t}", "function toTNodeTypeAsString(tNodeType) {\n let text = '';\n (tNodeType & 1 /* Text */) && (text += '|Text');\n (tNodeType & 2 /* Element */) && (text += '|Element');\n (tNodeType & 4 /* Container */) && (text += '|Container');\n (tNodeType & 8 /* ElementContainer */) && (text += '|ElementContainer');\n (tNodeType & 16 /* Projection */) && (text += '|Projection');\n (tNodeType & 32 /* Icu */) && (text += '|IcuContainer');\n (tNodeType & 64 /* Placeholder */) && (text += '|Placeholder');\n return text.length > 0 ? text.substring(1) : text;\n}", "function toTNodeTypeAsString(tNodeType) {\n let text = '';\n (tNodeType & 1 /* Text */) && (text += '|Text');\n (tNodeType & 2 /* Element */) && (text += '|Element');\n (tNodeType & 4 /* Container */) && (text += '|Container');\n (tNodeType & 8 /* ElementContainer */) && (text += '|ElementContainer');\n (tNodeType & 16 /* Projection */) && (text += '|Projection');\n (tNodeType & 32 /* Icu */) && (text += '|IcuContainer');\n (tNodeType & 64 /* Placeholder */) && (text += '|Placeholder');\n return text.length > 0 ? text.substring(1) : text;\n}", "function toTNodeTypeAsString(tNodeType) {\n let text = '';\n (tNodeType & 1 /* Text */) && (text += '|Text');\n (tNodeType & 2 /* Element */) && (text += '|Element');\n (tNodeType & 4 /* Container */) && (text += '|Container');\n (tNodeType & 8 /* ElementContainer */) && (text += '|ElementContainer');\n (tNodeType & 16 /* Projection */) && (text += '|Projection');\n (tNodeType & 32 /* Icu */) && (text += '|IcuContainer');\n (tNodeType & 64 /* Placeholder */) && (text += '|Placeholder');\n return text.length > 0 ? text.substring(1) : text;\n}", "function toTNodeTypeAsString(tNodeType) {\n let text = '';\n (tNodeType & 1 /* Text */) && (text += '|Text');\n (tNodeType & 2 /* Element */) && (text += '|Element');\n (tNodeType & 4 /* Container */) && (text += '|Container');\n (tNodeType & 8 /* ElementContainer */) && (text += '|ElementContainer');\n (tNodeType & 16 /* Projection */) && (text += '|Projection');\n (tNodeType & 32 /* Icu */) && (text += '|IcuContainer');\n (tNodeType & 64 /* Placeholder */) && (text += '|Placeholder');\n return text.length > 0 ? text.substring(1) : text;\n}", "function toTNodeTypeAsString(tNodeType) {\n let text = '';\n (tNodeType & 1 /* Text */) && (text += '|Text');\n (tNodeType & 2 /* Element */) && (text += '|Element');\n (tNodeType & 4 /* Container */) && (text += '|Container');\n (tNodeType & 8 /* ElementContainer */) && (text += '|ElementContainer');\n (tNodeType & 16 /* Projection */) && (text += '|Projection');\n (tNodeType & 32 /* Icu */) && (text += '|IcuContainer');\n (tNodeType & 64 /* Placeholder */) && (text += '|Placeholder');\n return text.length > 0 ? text.substring(1) : text;\n}", "function toTNodeTypeAsString(tNodeType) {\n let text = '';\n (tNodeType & 1 /* Text */) && (text += '|Text');\n (tNodeType & 2 /* Element */) && (text += '|Element');\n (tNodeType & 4 /* Container */) && (text += '|Container');\n (tNodeType & 8 /* ElementContainer */) && (text += '|ElementContainer');\n (tNodeType & 16 /* Projection */) && (text += '|Projection');\n (tNodeType & 32 /* Icu */) && (text += '|IcuContainer');\n (tNodeType & 64 /* Placeholder */) && (text += '|Placeholder');\n return text.length > 0 ? text.substring(1) : text;\n}", "function to_s(ast) {\n return Serializer.to_s(ast);\n}", "function toString$9(encoding) {\n return (this.contents || '').toString(encoding)\n}", "toString() {\n let result = 'root';\n let current = this.root;\n while(current) {\n result += ' -> ' + current.value;\n current = current.next;\n }\n return result + ' -> null';\n }", "function nomoduleloaderTranspiler() {\n // var allExports = {};\n // return through2.obj(function (file, enc, cb) {\n // var content = file.contents.toString();\n // var newContent = '';\n\n // var arr = content.split('\\n');\n // // abandon 'define' scope\n // var result = /function \\(require, exports(,\\s(\\w+?))*\\)/.exec(arr[0]);\n\n // for (var i = 1; i < arr.length - 1; i++) {\n // if (i == 2) continue;\n // arr[i] = arr[i].substr(4, arr[i].length - 4);\n // if (!arr[i].startsWith('exports.')) {\n // if (result[2] == undefined) {\n // newContent += arr[i] + '\\n';\n // }\n // else {\n // var exports = usedExports(result, arr[i]);\n // var s = arr[i];\n // exports.forEach(v => {\n // s = s.replace(v + '.', '');\n // });\n // newContent += s + '\\n';\n // }\n // }\n // }\n\n // file.contents = Buffer.from(newContent);\n // console.log(newContent);\n // console.log(content);\n // this.push(file);\n // cb();\n // });\n}", "function toString$6(encoding) {\n return (this.contents || '').toString(encoding)\n}", "function tnfToString(tnf) {\n var value = tnf;\n\n switch (tnf) {\n case ndef.TNF_EMPTY:\n value = \"Empty\";\n break;\n case ndef.TNF_WELL_KNOWN:\n value = \"Well Known\";\n break;\n case ndef.TNF_MIME_MEDIA:\n value = \"Mime Media\";\n break;\n case ndef.TNF_ABSOLUTE_URI:\n value = \"Absolute URI\";\n break;\n case ndef.TNF_EXTERNAL_TYPE:\n value = \"External\";\n break;\n case ndef.TNF_UNKNOWN:\n value = \"Unknown\";\n break;\n case ndef.TNF_UNCHANGED:\n value = \"Unchanged\";\n break;\n case ndef.TNF_RESERVED:\n value = \"Reserved\";\n break;\n }\n return value;\n}", "function icuCreateOpCodesToString(opcodes) {\n var parser = new OpCodeParser(opcodes || (Array.isArray(this) ? this : []));\n var lines = [];\n\n function consumeOpCode(opCode) {\n var parent = getParentFromIcuCreateOpCode(opCode);\n var ref = getRefFromIcuCreateOpCode(opCode);\n\n switch (getInstructionFromIcuCreateOpCode(opCode)) {\n case 0\n /* AppendChild */\n :\n return \"(lView[\".concat(parent, \"] as Element).appendChild(lView[\").concat(lastRef, \"])\");\n\n case 1\n /* Attr */\n :\n return \"(lView[\".concat(ref, \"] as Element).setAttribute(\\\"\").concat(parser.consumeString(), \"\\\", \\\"\").concat(parser.consumeString(), \"\\\")\");\n }\n\n throw new Error('Unexpected OpCode: ' + getInstructionFromIcuCreateOpCode(opCode));\n }\n\n var lastRef = -1;\n\n while (parser.hasMore()) {\n var value = parser.consumeNumberStringOrMarker();\n\n if (value === ICU_MARKER) {\n var text = parser.consumeString();\n lastRef = parser.consumeNumber();\n lines.push(\"lView[\".concat(lastRef, \"] = document.createComment(\\\"\").concat(text, \"\\\")\"));\n } else if (value === ELEMENT_MARKER) {\n var _text = parser.consumeString();\n\n lastRef = parser.consumeNumber();\n lines.push(\"lView[\".concat(lastRef, \"] = document.createElement(\\\"\").concat(_text, \"\\\")\"));\n } else if (typeof value === 'string') {\n lastRef = parser.consumeNumber();\n lines.push(\"lView[\".concat(lastRef, \"] = document.createTextNode(\\\"\").concat(value, \"\\\")\"));\n } else if (typeof value === 'number') {\n var line = consumeOpCode(value);\n line && lines.push(line);\n } else {\n throw new Error('Unexpected value');\n }\n }\n\n return lines;\n}", "function toString(encoding) {\n return (this.contents || '').toString(encoding)\n}" ]
[ "0.5808293", "0.5808293", "0.5808293", "0.58024395", "0.5792998", "0.57217157", "0.55632764", "0.5119388", "0.49445158", "0.49397016", "0.49352276", "0.48916024", "0.4888284", "0.47806638", "0.47707263", "0.47499153", "0.47473553", "0.46570024", "0.4651487", "0.46407887", "0.46281573", "0.46267343", "0.46197426", "0.45832902", "0.45789856", "0.45742202", "0.45687315", "0.45569164", "0.4553861", "0.45049706", "0.44969603", "0.44969603", "0.4493867", "0.44874376", "0.447388", "0.44619673", "0.44406047", "0.44170856", "0.43993676", "0.43966648", "0.43899232", "0.43664464", "0.43633714", "0.43558288", "0.43481764", "0.4328792", "0.43107092", "0.43101355", "0.43094566", "0.4293588", "0.4282685", "0.42667422", "0.42659438", "0.42640457", "0.42492688", "0.42492688", "0.42492688", "0.42492688", "0.42492688", "0.42402783", "0.42336243", "0.42247", "0.42118543", "0.42088327", "0.42017257", "0.41954303", "0.41913453", "0.4183357", "0.41774616", "0.41752663", "0.41751364", "0.41736218", "0.4167593", "0.41657978", "0.41650486", "0.41381398", "0.41309065", "0.4129424", "0.41239285", "0.41233376", "0.41156635", "0.4108869", "0.41030493", "0.41030493", "0.41030493", "0.41030493", "0.41030493", "0.41030493", "0.4101493", "0.40963835", "0.40894848", "0.40856493", "0.4083906", "0.4082738", "0.40802363", "0.40800822" ]
0.5798637
7
Parse a file (in string or VFile representation) into a Unist node using the `Parser` on the processor, then run transforms on that node, and compile the resulting node using the `Compiler` on the processor, and store that result on the VFile.
function process(doc, cb) { freeze() assertParser('process', processor.Parser) assertCompiler('process', processor.Compiler) if (!cb) { return new Promise(executor) } executor(null, cb) function executor(resolve, reject) { var file = vfile(doc) pipeline.run(processor, {file: file}, done) function done(err) { if (err) { reject(err) } else if (resolve) { resolve(file) } else { cb(null, file) } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(error, tree, file) {\n tree = tree || node\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(error, tree, file) {\n tree = tree || node\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done)\n\n function done(err, tree, file) {\n tree = tree || node\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(tree)\n } else {\n cb(null, tree, file)\n }\n }\n }\n }", "function run(node, file, cb) {\n assertNode(node);\n freeze();\n\n if (!cb && typeof file === 'function') {\n cb = file;\n file = null;\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done);\n\n function done(error, tree, file) {\n tree = tree || node;\n if (error) {\n reject(error);\n } else if (resolve) {\n resolve(tree);\n } else {\n cb(null, tree, file);\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(error) {\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(error) {\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze();\n assertParser('process', processor.Parser);\n assertCompiler('process', processor.Compiler);\n\n if (!cb) {\n return new Promise(executor);\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n var file = vfile(doc);\n\n pipeline.run(processor, {file: file}, done);\n\n function done(err) {\n if (err) {\n reject(err);\n } else if (resolve) {\n resolve(file);\n } else {\n cb(null, file);\n }\n }\n }\n }", "function process(doc, cb) {\n freeze();\n assertParser('process', processor.Parser);\n assertCompiler('process', processor.Compiler);\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n var file = vfile(doc);\n\n pipeline.run(processor, {file: file}, done);\n\n function done(error) {\n if (error) {\n reject(error);\n } else if (resolve) {\n resolve(file);\n } else {\n cb(null, file);\n }\n }\n }\n }", "function transform(context, file, fileSet, next) {\n if (stats(file).fatal) {\n next()\n } else {\n debug('Transforming document `%s`', file.path)\n context.processor.run(context.tree, file, onrun)\n }\n\n function onrun(error, node) {\n debug('Transformed document (error: %s)', error)\n context.tree = node\n next(error)\n }\n}", "function run(node, file, cb) {\n assertNode(node);\n freeze();\n\n if (!cb && func(file)) {\n cb = file;\n file = null;\n }\n\n if (!cb) {\n return new Promise(executor);\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n transformers.run(node, vfile(file), done);\n\n function done(err, tree, file) {\n tree = tree || node;\n if (err) {\n reject(err);\n } else if (resolve) {\n resolve(tree);\n } else {\n cb(null, tree, file);\n }\n }\n }\n }", "function parse( file ) {\n\t\treturn __awaiter( this, void 0, void 0, function () {\n\t\t\treturn __generator( this, function ( _a ) {\n\t\t\t\treturn [\n\t\t\t\t\t2,\n\t\t\t\t\t/*return*/\n\t\t\t\t\tnew Promise( function ( resolve, reject ) {\n\t\t\t\t\t\tfs.readFile( file, 'utf8', function ( err, data ) {\n\t\t\t\t\t\t\tif ( err ) {\n\t\t\t\t\t\t\t\treject( err );\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tresolve( parseString( data ) );\n\t\t\t\t\t\t} );\n\t\t\t\t\t} ),\n\t\t\t\t];\n\t\t\t} );\n\t\t} );\n\t}", "function parse(file) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2\n /*return*/\n , new Promise(function (resolve, reject) {\n fs.readFile(file, 'utf8', function (err, data) {\n if (err) {\n reject(err);\n return;\n }\n\n resolve(parseString(data));\n });\n })];\n });\n });\n }", "function parse(file: string): ParserReturn {\n if (file.match(/\\.tsx?$/)) {\n return TypeScriptParser.parse(file);\n } else {\n return babylonParser(file);\n }\n}", "function treeForFile (file) {\n var contents = null\n try {\n contents = fs.readFileSync(file).toString()\n } catch (err) {\n if (err.code === 'ENOENT') {\n logger.error(\"File not found: \"+file)\n process.exit(1)\n }\n throw err\n }\n var name = path.basename(file),\n parser = new Parser()\n\n parser.file = name\n // Parse and type-check the file; catch and report any errors\n try {\n var tree = parser.parse(contents),\n typesystem = new TypeSystem()\n typesystem.walk(tree)\n } catch (err) {\n reportError(err)\n process.exit(1)\n }\n return tree\n}// treeForFile", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function transform(file, cb) {\n gutil.log('Preprocessing:', file.path);\n // read and modify file contents\n var fileContents = String(file.contents);\n fileContents = fileContents.replace(/^\\s*(import .*?)(?:;|$)/gm,\n function(str, group1) {\n return 'jsio(\"' + group1 + '\");';\n });\n file.contents = new Buffer(fileContents);\n\n // if there was some error, just pass as the first parameter here\n cb(null, file);\n }", "function parse(doc) {\n var file = vfile(doc);\n var Parser;\n\n freeze();\n Parser = processor.Parser;\n assertParser('parse', Parser);\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "process (filepath) {\n\t\tlet {\n\t\t\tchassis,\n\t\t\tgenerateNamespacedSelector,\n\t\t\tisNamespaced,\n\t\t\tnamespaceSelectors,\n\t\t\tprocessImports,\n\t\t\tprocessNesting,\n\t\t\tprocessAtRules,\n\t\t\tprocessMixins,\n\t\t\tprocessNot,\n\t\t\tprocessFunctions,\n\t\t\tstoreAtRules,\n\t\t\ttypographyEngineIsInitialized\n\t\t} = this\n\n\t\tlet {\n\t\t\tatRules,\n\t\t\tpost,\n\t\t\tsettings,\n\t\t\tutils\n\t\t} = chassis\n\n\t\tlet tasks = new NGN.Tasks()\n\t\tlet sourceMap\n\n\t\ttasks.add('Processing Imports', next => {\n\t\t\tif (typographyEngineIsInitialized) {\n\t\t\t\tthis.tree.walkAtRules('import', atRule => {\n\t\t\t\t\tchassis.imports.push(atRule.params)\n\t\t\t\t\tatRule.remove()\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tprocessImports()\n\t\t\tprocessNesting()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Mixins', next => {\n\t\t\tprocessMixins()\n\t\t\tprocessNot()\n\t\t\tprocessNesting()\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Functions', next => {\n\t\t\tprocessFunctions()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Namespacing Selectors', next => {\n\t\t\tnamespaceSelectors()\n\t\t\tnext()\n\t\t})\n\n\t\tif (typographyEngineIsInitialized) {\n\t\t\ttasks.add('Initializing Typography Engine', next => {\n\t\t\t\tthis.tree = this.core.css.append(this.tree)\n\t\t\t\tnext()\n\t\t\t})\n\t\t}\n\n\t\ttasks.add('Running Post-Processing Routines', next => {\n\t\t\tthis.tree.walkAtRules('chassis-post', atRule => {\n\t\t\t\tlet data = Object.assign({\n\t\t\t\t\troot: this.tree,\n\t\t\t\t\tatRule\n\t\t\t\t}, atRules.getProperties(atRule))\n\n\t\t\t\tpost.process(data)\n\t\t\t})\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing CSS4 Syntax', next => {\n\t\t\tenv.process(this.tree, {from: filepath}, settings.envCfg).then(processed => {\n\t\t\t\tthis.tree = processed.root\n\t\t\t\tnext()\n\t\t\t}, err => console.error(err))\n\t\t})\n\n\t\t// tasks.add('Merging matching adjacent rules...', next => {\n\t\t// \toutput = mergeAdjacentRules.process(output.toString())\n\t\t// \tnext()\n\t\t// })\n\n\t\ttasks.add('Beautifying Output', next => {\n\t\t\tremoveComments.process(this.tree).then(result => {\n\t\t\t\tperfectionist.process(result.css).then(result => {\n\t\t\t\t\tthis.tree = result.root\n\n\t\t\t\t\t// Remove empty rulesets\n\t\t\t\t\tthis.tree.walkRules(rule => {\n\t\t\t\t\t\tif (rule.nodes.length === 0) {\n\t\t\t\t\t\t\trule.remove()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\n\t\t\t\t\tnext()\n\t\t\t\t}, () => {\n\t\t\t\t\tthis.emit('processing.error', new Error('Error Beautifying Output'))\n\t\t\t\t})\n\t\t\t}, () => {\n\t\t\t\tthis.emit('processing.error', new Error('Error Removing Comments'))\n\t\t\t})\n\t\t})\n\n\t\tif (settings.minify) {\n\t\t\tlet minified\n\n\t\t\ttasks.add('Minifying Output', next => {\n\t\t\t\tminified = new CleanCss({\n\t\t\t\t\tsourceMap: settings.sourceMap\n\t\t\t\t}).minify(this.tree.toString())\n\n\t\t\t\tthis.tree = minified.styles\n\t\t\t\tnext()\n\t\t\t})\n\n\t\t\tif (settings.sourceMap) {\n\t\t\t\ttasks.add('Generating source map', next => {\n\t\t\t\t\tsourceMap = minified.sourceMap.toString()\n\t\t\t\t\tnext()\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// tasks.on('taskstart', evt => console.log(`${evt.name}...`))\n\t\t// tasks.on('taskcomplete', evt => console.log('Done.'))\n\n\t\ttasks.on('complete', () => this.emit('processing.complete', {\n\t\t\tcss: this.tree.toString(),\n\t\t\tsourceMap\n\t\t}))\n\n\t\tthis.emit('processing')\n\t\ttasks.run(true)\n\t}", "function parse(context, file) {\n var message\n\n if (stats(file).fatal) {\n return\n }\n\n if (context.treeIn) {\n debug('Not parsing already parsed document')\n\n try {\n context.tree = json(file.toString())\n } catch (error) {\n message = file.message(\n new Error('Cannot read file as JSON\\n' + error.message)\n )\n message.fatal = true\n }\n\n // Add the preferred extension to ensure the file, when serialized, is\n // correctly recognised.\n // Only add it if there is a path — not if the file is for example stdin.\n if (file.path) {\n file.extname = context.extensions[0]\n }\n\n file.contents = ''\n\n return\n }\n\n debug('Parsing `%s`', file.path)\n\n context.tree = context.processor.parse(file)\n\n debug('Parsed document')\n}", "function parse(doc) {\n var file = vfile(doc);\n var Parser;\n\n freeze();\n Parser = processor.Parser;\n assertParser('parse', Parser);\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse();\n }\n\n return Parser(String(file), file); // eslint-disable-line new-cap\n }", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this\n var value = String(self.file)\n var start = {line: 1, column: 1, offset: 0}\n var content = xtend(start)\n var node\n\n // Clean non-unix newlines: `\\r\\n` and `\\r` are all changed to `\\n`.\n // This should not affect positional information.\n value = value.replace(lineBreaksExpression, lineFeed)\n\n // BOM.\n if (value.charCodeAt(0) === 0xfeff) {\n value = value.slice(1)\n\n content.column++\n content.offset++\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {start: start, end: self.eof || xtend(start)}\n }\n\n if (!self.options.position) {\n removePosition(node, true)\n }\n\n return node\n}", "function processEach(params, file, done) {\r\n console.log(\"Parsing file: \", file);\r\n parseUtils\r\n .parseFile(file)\r\n .then(function(parseResult) {\r\n // save the original source code.\r\n params.sourceStore[file] = parseResult.src;\r\n\r\n // adapt our block ID generator for this file.\r\n var blockIDGen = function(blockInfo) {\r\n return params.idGenerator.newID({\r\n script: file,\r\n func: blockInfo.func\r\n });\r\n };\r\n\r\n // instrument the code.\r\n var result = instrument(\r\n parseResult.src,\r\n parseResult.ast,\r\n blockIDGen,\r\n params\r\n );\r\n\r\n // write the modified code back to the original file.\r\n fs.writeFileSync(file, result.result, \"utf8\");\r\n\r\n // just return the block & function data.\r\n done(null, {\r\n blocks: result.blocks,\r\n functions: result.functions\r\n });\r\n })\r\n .catch(function(e) {\r\n // don't kill the whole process.\r\n console.error(\"Problem instrumenting file. \", e, \" in file: \", file);\r\n done(null, { blocks: [], functions: [] });\r\n })\r\n .done();\r\n}", "async function transform(file, dir = 'lib') {\n const dest = file.replace('/src/', `/${dir}/`)\n await fs.ensureDir(path.dirname(dest))\n\n if (fs.statSync(file).isDirectory()) return\n\n if (file.endsWith('.svelte')) {\n const source = await fs.readFile(file, 'utf8')\n const item = await preprocess(\n source,\n autoprocessor({\n typescript: {\n tsconfigFile: path.resolve(rootDir, 'tsconfig-base.json'),\n },\n // https://github.com/sveltejs/svelte/issues/189#issuecomment-586142198\n replace: [\n [/(>)[\\s]*([<{])/g, '$1$2'],\n [/({[/:][a-z]+})[\\s]*([<{])/g, '$1$2'],\n [/({[#:][a-z]+ .+?})[\\s]*([<{])/g, '$1$2'],\n [/([>}])[\\s]+(<|{[/#:][a-z][^}]*})/g, '$1$2'],\n ],\n }),\n {\n filename: file,\n }\n )\n await fs.writeFile(\n dest,\n item.code.replace('<script lang=\"ts\">', '<script>')\n )\n } else {\n await fs.copyFile(file, dest)\n }\n}", "function compileFile(file, basepath) {\n var filepath = path.join(basepath || test_dir, file);\n var ast;\n try {\n ast = RapydScript.parse(fs.readFileSync(filepath, \"utf-8\"), {\n filename: file,\n es6: argv.ecmascript6,\n toplevel: ast,\n readfile: fs.readFileSync,\n basedir: test_dir,\n libdir: path.join(src_path, 'lib'),\n });\n } catch(ex) {\n console.log(file + \":\\t\" + ex + \"\\n\");\n return;\n }\n // generate output\n var output = RapydScript.OutputStream({\n baselib: baselib,\n beautify: true\n });\n ast.print(output);\n return output;\n }", "function Parser(doc, file) {\n this.file = file;\n this.offset = {};\n this.options = xtend(this.options);\n this.setOptions({});\n\n this.inList = false;\n this.inBlock = false;\n this.inLink = false;\n this.atStart = true;\n\n this.toOffset = vfileLocation(file).toOffset;\n this.unescape = unescape(this, 'escape');\n this.decode = decode(this);\n}", "function transform$5(context, file, fileSet, next) {\n if (stats$4(file).fatal) {\n next();\n } else {\n debug$7('Transforming document `%s`', file.path);\n context.processor.run(context.tree, file, onrun);\n }\n\n function onrun(error, node) {\n debug$7('Transformed document (error: %s)', error);\n context.tree = node;\n next(error);\n }\n}", "parseFlsFile(baseFile) {\r\n this.extension.logger.addLogMessage('Parse fls file.');\r\n const rootDir = path.dirname(baseFile);\r\n const outDir = this.getOutDir(baseFile);\r\n const flsFile = path.resolve(rootDir, path.join(outDir, path.basename(baseFile, '.tex') + '.fls'));\r\n if (!fs.existsSync(flsFile)) {\r\n this.extension.logger.addLogMessage(`Cannot find fls file: ${flsFile}`);\r\n return;\r\n }\r\n this.extension.logger.addLogMessage(`Fls file found: ${flsFile}`);\r\n const ioFiles = this.parseFlsContent(fs.readFileSync(flsFile).toString(), rootDir);\r\n ioFiles.input.forEach((inputFile) => {\r\n // Drop files that are also listed as OUTPUT or should be ignored\r\n if (ioFiles.output.includes(inputFile) ||\r\n this.isExcluded(inputFile) ||\r\n !fs.existsSync(inputFile)) {\r\n return;\r\n }\r\n // Drop the current rootFile often listed as INPUT and drop any file that is already in the texFileTree\r\n if (baseFile === inputFile || inputFile in this.cachedContent) {\r\n return;\r\n }\r\n if (path.extname(inputFile) === '.tex') {\r\n // Parse tex files as imported subfiles.\r\n this.cachedContent[baseFile].children.push({\r\n index: Number.MAX_VALUE,\r\n file: inputFile\r\n });\r\n this.parseFileAndSubs(inputFile);\r\n }\r\n else if (this.fileWatcher && !this.filesWatched.includes(inputFile)) {\r\n // Watch non-tex files.\r\n this.fileWatcher.add(inputFile);\r\n this.filesWatched.push(inputFile);\r\n }\r\n });\r\n ioFiles.output.forEach((outputFile) => {\r\n if (path.extname(outputFile) === '.aux' && fs.existsSync(outputFile)) {\r\n this.parseAuxFile(fs.readFileSync(outputFile).toString(), path.dirname(outputFile).replace(outDir, rootDir));\r\n }\r\n });\r\n }", "function tjs_gulp_transformFile(file) {\n\t// console.log(file)\n\treturn `gulp.task('${file.file}', function() {\n\tlet pipe = gulp.src('${file.file}', { base: __dirname })\n\n\t// pre-piping\n\tif (typeof __t.start == 'function')\n\t\tpipe = pipe.pipe(__t.start.bind(pipe)())\n\n\t${file.transforms.length == 0 ? `if (typeof __t.blank == 'function') pipe = __t.blank.bind(pipe)()` : ''}\n\n\t${file.transforms.map(t => `// pipe setup for ${t.name}\n\tpipe = __t.${t.name}.bind(pipe)${t.argsTuple}\n\tif (typeof __t.each == 'function') pipe = pipe.pipe(__t.each.bind(pipe)())`).join('\\n\\t')}\n\n\t// post-piping\n\tif (typeof __t.finish == 'function')\n\t\tpipe = pipe.pipe(__t.finish.bind(pipe)())\n\t\n\treturn pipe\n})`\n}", "function parse$a(context, file) {\n var message;\n\n if (stats$5(file).fatal) {\n return\n }\n\n if (context.treeIn) {\n debug$8('Not parsing already parsed document');\n\n try {\n context.tree = json$1(file.toString());\n } catch (error) {\n message = file.message(\n new Error('Cannot read file as JSON\\n' + error.message)\n );\n message.fatal = true;\n }\n\n // Add the preferred extension to ensure the file, when serialized, is\n // correctly recognised.\n // Only add it if there is a path — not if the file is for example stdin.\n if (file.path) {\n file.extname = context.extensions[0];\n }\n\n file.contents = '';\n\n return\n }\n\n debug$8('Parsing `%s`', file.path);\n\n context.tree = context.processor.parse(file);\n\n debug$8('Parsed document');\n}", "async function preprocessSvelte(filePath) {\n const srcCode = await fs.readFile(filePath, { encoding: \"utf-8\" });\n let { code } = await svelte.preprocess(\n srcCode,\n sveltePreprocess({\n // unfortunately, sourcemap on .svelte files sometimes comments out the </script> tag\n // so we need to disable sourcemapping for them\n sourceMap: false,\n typescript: {\n compilerOptions: {\n sourceMap: false,\n },\n },\n }),\n {\n filename: filePath,\n }\n );\n\n // remove lang=ts from processed .svelte files\n code = code.replace(/script lang=\"ts\"/g, \"script\");\n\n const relativePath = filePath.split(srcPath)[1];\n const destination = path.join(distPath, filePath.split(srcPath)[1]);\n\n // write preprocessed svelte file to /dist\n await fs.ensureFile(destination);\n await fs.writeFile(destination, code, { encoding: \"utf-8\" });\n\n // write the unprocessed svelte component to /dist/ts/ so we can have correct types for ts users\n const tsDest = path.join(distPath, \"ts\", relativePath);\n await fs.ensureFile(tsDest);\n await fs.writeFile(tsDest, srcCode, {\n encoding: \"utf-8\",\n });\n}", "async parse(options = {}) {\n if (!this.file.path) {\n throw new Error(`Missing underlying file component with a path.`)\n }\n\n const { code, ast, meta } = await require('@skypager/helpers-mdx')(this.content, {\n filePath: this.file.path,\n ...options,\n rehypePlugins: [\n () => tree => {\n this.state.set('rehypeAst', tree)\n return tree\n },\n ],\n babel: false,\n })\n\n this.state.set('parsed', true)\n this.state.set('parsedContent', code)\n\n return { ast, code, meta }\n }", "transformFile(data, filePath) {\n this.updateBabelConfig(filePath);\n return babel.transformSync(data, this.babelConfig.options);\n }", "function transformFile(filename, opts, callback) {\n\t if (_lodashLangIsFunction2[\"default\"](opts)) {\n\t callback = opts;\n\t opts = {};\n\t }\n\n\t opts.filename = filename;\n\n\t _fs2[\"default\"].readFile(filename, function (err, code) {\n\t if (err) return callback(err);\n\n\t var result;\n\n\t try {\n\t result = _transformation2[\"default\"](code, opts);\n\t } catch (err) {\n\t return callback(err);\n\t }\n\n\t callback(null, result);\n\t });\n\t}", "function transformFile(filename, opts, callback) {\n\t if (_lodashLangIsFunction2[\"default\"](opts)) {\n\t callback = opts;\n\t opts = {};\n\t }\n\n\t opts.filename = filename;\n\n\t _fs2[\"default\"].readFile(filename, function (err, code) {\n\t if (err) return callback(err);\n\n\t var result;\n\n\t try {\n\t result = _transformation2[\"default\"](code, opts);\n\t } catch (err) {\n\t return callback(err);\n\t }\n\n\t callback(null, result);\n\t });\n\t}", "async processXmlFile(xmlFile) {\n const response = await fetch(xmlFile);\n const xmlData = await response.text();\n\n const parser = new DOMParser();\n const doc = parser.parseFromString(xmlData, \"text/xml\");\n\n this.processDoc(xmlFile, doc);\n }", "loadFile(file, module, x, y) {\n var dsp_code;\n var reader = new FileReader();\n var ext = file.name.toString().split('.').pop();\n var filename = file.name.toString().split('.').shift();\n var type;\n if (ext == \"dsp\") {\n type = \"dsp\";\n reader.readAsText(file);\n }\n else if (ext == \"json\") {\n type = \"json\";\n reader.readAsText(file);\n }\n else if (ext == \"jfaust\") {\n type = \"jfaust\";\n reader.readAsText(file);\n }\n else if (ext == \".polydsp\") {\n type = \"poly\";\n reader.readAsText(file);\n }\n else {\n throw new Error(Utilitary.messageRessource.errorObjectNotFaustCompatible);\n }\n reader.onloadend = (e) => {\n dsp_code = \"process = vgroup(\\\"\" + filename + \"\\\",environment{\" + reader.result + \"}.process);\";\n if (!module) {\n if (type == \"dsp\") {\n this.compileFaust({ isMidi: false, name: filename, sourceCode: dsp_code, x: x, y: y, callback: (factory) => { this.createModule(factory); } });\n }\n else if (type == \"jfaust\") {\n Utilitary.currentScene.recallScene(reader.result);\n }\n else if (type == \"poly\") {\n this.compileFaust({ isMidi: true, name: filename, sourceCode: dsp_code, x: x, y: y, callback: (factory) => { this.createModule(factory); } });\n }\n }\n else {\n if (type == \"dsp\") {\n module.isMidi = false;\n module.update(filename, dsp_code);\n }\n else if (type == \"jfaust\") {\n Utilitary.currentScene.recallScene(reader.result);\n }\n else if (type == \"poly\") {\n module.isMidi = true;\n module.update(filename, dsp_code);\n }\n }\n };\n }", "function processFile (inputLoc, out, replacements) {\n var file = urlRegex.test(inputLoc) ?\n hyperquest(inputLoc) :\n fs.createReadStream(inputLoc, encoding)\n\n file.pipe(bl(function (err, data) {\n if (err) throw err\n\n data = data.toString()\n replacements.forEach(function (replacement) {\n data = data.replace.apply(data, replacement)\n })\n if (inputLoc.slice(-3) === '.js') {\n const transformed = babel.transform(data, {\n plugins: [\n 'transform-es2015-parameters',\n 'transform-es2015-arrow-functions',\n 'transform-es2015-block-scoping',\n 'transform-es2015-template-literals',\n 'transform-es2015-shorthand-properties',\n 'transform-es2015-for-of',\n 'transform-es2015-destructuring'\n ]\n })\n data = transformed.code\n }\n fs.writeFile(out, data, encoding, function (err) {\n if (err) throw err\n\n console.log('Wrote', out)\n })\n }))\n}", "async compile(statement, filename) {\n if (this.tsCompiler) {\n statement = await this.compileTypescript(statement, filename);\n }\n return this.processAwait(statement);\n }", "function parseQML(src, file) {\n loadParser();\n QmlWeb.parse.nowParsingFile = file;\n var parsetree = QmlWeb.parse(src, QmlWeb.parse.QmlDocument);\n return convertToEngine(parsetree);\n}", "function file_load(file, callback) {\n\tif (!file) return; // No file found.\n\n\tlet reader = new FileReader();\n\n\treader.onload = event => callback(sched_parse(\n\t\tevent.target.result\n\t), file.path);\n\n\treader.readAsText(file);\n}", "function gulpPlugin(options) {\n\toptions = options || {};\n\toptions.metadata = options.metadata === undefined ? true : options.metadata;\n\toptions.warning_as_error = options.warning_as_error === undefined ? true : options.warning_as_error;\n const filepaths = options.stylesheet === undefined ? [] : [options.stylesheet];\n\tlet processor = xsltproc(options);\n function XsltProcPlugin(file, encoding, done) {\n\t\tif (file.contents.indexOf('xml-stylesheet') === -1 && !options.stylesheet) {\n\t\t\tconsole.log('skipping', file.path);\n\t\t\treturn done();\n\t\t}\n\t\tconst processorFilepaths = filepaths.concat(file.path);\n\t\tprocessor.transform(processorFilepaths, options)\n\t\t.then((data) => {\n\t\t\tfile.contents = Buffer.from(data.result);\n\t\t\tif (options.warning_as_error && data.metadata !== undefined && data.metadata.message !== '') {\n\t\t\t\tthis.emit('error', new PluginError({\n\t\t\t\t\tplugin: 'XsltProc',\n\t\t\t\t\tmessage: `warning transforming ${file.path}\\n${data.metadata.message}`\n\t\t\t\t}));\n\t\t\t\treturn done();\n\t\t\t}\n\t\t\tdata.file = path.relative(file.base, file.path);\n\t\t\tthis.push(file); // don't move this line higher in the code as value of file changes after that line\n\t\t\tif (options.metadata) {\n let metadata = new Vinyl({\n base: file.base,\n path: `${file.path}.json`,\n contents: Buffer.from(JSON.stringify(data.metadata))\n });\n\t\t\t\tthis.push(metadata);\n\t\t\t}\n\t\t\treturn done();\n\t\t})\n\t\t.catch((error) => {\n\t\t\tconsole.error(error);\n\t\t\tthis.emit('error', new PluginError({\n\t\t\t\tplugin: 'XsltProc',\n\t\t\t\tmessage: `error transforming ${file.path}\\n${error.message}`\n\t\t\t}));\n\t\t\treturn done();\n\t\t});\n\t}\n\treturn through.obj(XsltProcPlugin);\n}", "function runFile (inFile, outFile) {\n const currentTest = new NameParser(inFile, outFile)\n currentTest.uniqueFullNameCount()\n currentTest.uniqueLastNameCount()\n currentTest.uniqueFirstNameCount()\n currentTest.commonLastNames()\n currentTest.commonFirstNames()\n currentTest.modifiedNames(25)\n}", "function parseFile(err, contents) {\r\n const output = parse(contents, {\r\n columns: true,\r\n skip_empty_lines: true\r\n });\r\n\r\n // Call build function. Interpret and construct Org Chart\r\n buildOutput(output);\r\n}", "function process(file, enc, callback) {\n /*jshint validthis:true*/\n\n // Do nothing if no contents\n if (file.isNull()) {\n return callback();\n }\n if (file.isStream()) {\n this.emit(\"error\",\n new gutil.PluginError(PLUGIN_NAME, \"Stream content is not supported\"));\n return callback();\n }\n // check if file.contents is a `Buffer`\n if (file.isBuffer() || file.isFile()) {\n var parser = imagesize.Parser();\n\n var retStatus = parser.parse(file.contents);\n if (imagesize.Parser.DONE === retStatus) {\n var result = parser.getResult();\n result.file = libpath.relative(file.base, file.path)\n list.push(result);\n }\n }\n return callback();\n }", "_parseFile(requireName, filepath, cache, ifStoreSrc, fakeCode, coreModules) {\n let code, e;\n if (filepath in cache) { return cache[filepath]; }\n const isCore = (coreModules && (Array.from(coreModules).includes(requireName))) || !/[\\\\\\/]/.test(filepath);\n const isBinary = /\\.node$/i.test(filepath);\n const unit = {\n isCore, // built-in nodejs modules\n isBinary, // binary modules, \".node\" extension\n fpath: isCore ? requireName : filepath, // the file path\n mpath: '', // the path of module that contains this file\n mname: '', // the module name\n src: \"\",\n requires: [], // array of dependencies, each element is {node, unit}\n // node is the parded ast tree node\n // unit is another unit\n warnings: [],\n // if set, then this file is the \"main\" file of a node module, as defined by nodejs\n package: undefined,\n };\n cache[filepath] = unit;\n if (isCore || isBinary) { return unit; }\n if (path.extname(filepath).toLowerCase() === \".json\") {\n if (ifStoreSrc) { unit.src = fs.readFileSync(filepath).toString(); }\n return unit;\n }\n\n // determine if parameter filepath itself represents a module, if so, mark the module by setting the\n // package member\n (function() {\n const detail = bna.identify(filepath);\n\n unit.mname = detail.mname;\n unit.mpath = detail.mpath;\n unit._detailPackage = detail.package;\n const mainfiles = [path.join(detail.mpath, \"index.js\"), path.join(detail.mpath, \"index.node\")];\n if (detail.package) {\n detail.package.name = detail.mname; // ensure correct package name\n if (detail.package.main) {\n const main = path.resolve(detail.mpath, detail.package.main);\n mainfiles.push(main);\n // append .js .node variations as well\n if (path.extname(main) === '') { mainfiles.push(...Array.from([`${main}.js`, `${main}.node`] || [])); }\n }\n }\n if (Array.from(mainfiles).includes(unit.fpath)) {\n return unit.package = detail.package || { name: detail.mname, version: 'x' }; // construct default package if no package.json\n }\n })();\n\n // do first pass without parsing location info (makes parsing 3x slower), if bad require is detected,\n // then we do another pass with location info, for user-friendly warnings\n try {\n let src;\n if (fakeCode) {\n src = fakeCode;\n } else { src = fs.readFileSync(filepath).toString().replace(/^#![^\\n]*\\n/, ''); } // remove shell script marker\n\n if (ifStoreSrc) { unit.src = src; }\n code = jsParse(src);\n } catch (error) {\n e = error;\n log((`Ignoring ${filepath}, failed to parse due to: ${e}`));\n return unit;\n }\n // 1st pass, traverse ast tree, resolve all const-string requires if possible\n const dynLocs = []; // store dynamic require locations\n ast.traverse(code, [ast.isRequire], function(node) {\n if (!node.loc) {\n node.loc = { file: filepath, line: '?' };\n } else {\n node.loc.file = filepath;\n node.loc.line = node.loc.start.line;\n }\n const arg = node.arguments[0];\n if (arg && (arg.type === 'Literal')) { // require a string\n let fullpath;\n const modulename = arg.value;\n\n e = undefined;\n try {\n fullpath = resolver.sync(modulename, {\n extensions: ['.js', '.node', '.json'],\n basedir: path.dirname(filepath)\n });\n } catch (error1) {\n e = error1;\n unit.warnings.push({\n node,\n reason: \"resolve\"\n });\n }\n\n if (!e) {\n const runit = bna._parseFile(modulename, fullpath, cache, ifStoreSrc, null, coreModules);\n return unit.requires.push({\n name: modulename,\n node,\n unit: runit\n });\n }\n } else {\n return dynLocs.push(node.loc);\n }\n });\n\n // resolving dynamic require trick: evaluate js once, record all required modules....\n if (dynLocs.length > 0) {\n (() => {\n let dynamicModules = bna.detectDynamicRequires(unit);\n // filter out already required string modules, and nulls\n dynamicModules = (Array.from(dynamicModules).filter((m) => m && !_(unit.requires).find(e => e.name === m)).map((m) => m));\n\n for (let modulename of Array.from(dynamicModules)) {\n // filter out required modules that are already parsed\n var node;\n e = undefined;\n let fullpath = ''; // catch block needs this too\n try {\n fullpath = resolver.sync(modulename, {\n extensions: ['.js', '.node', '.json'],\n basedir: path.dirname(filepath)\n });\n // only if resolved ok\n node = { loc: { file: fullpath, line: '?' } }; //\n const runit = bna._parseFile(modulename, fullpath, cache, ifStoreSrc, null, coreModules);\n unit.requires.push({\n name: modulename,\n node,\n unit: runit\n });\n } catch (error1) {\n e = error1;\n unit.warnings.push({\n node: { loc: { file: filepath, line: '?' } },\n reason: \"dynamicResolveError\",\n error: e\n });\n }\n }\n\n return unit.warnings.push({\n locs: dynLocs,\n modules: dynamicModules,\n reason: \"nonconst\"\n });\n })();\n }\n\n return unit;\n }", "function compile() {\n fs.readFile(src, 'utf8', function(err, str){\n if (err) {\n next(err);\n } else {\n compiler.compile(str, function(err, str){\n if (err) {\n next(err);\n } else {\n fs.writeFile(dest, str, 'utf8', function(err){\n next(err);\n });\n }\n });\n }\n });\n }", "parse(parser) {\n this._processor = this._process(parser);\n this._processor.next();\n }", "function transformFile(filename, opts, callback) {\n if (_lodashLangIsFunction2[\"default\"](opts)) {\n callback = opts;\n opts = {};\n }\n\n opts.filename = filename;\n\n _fs2[\"default\"].readFile(filename, function (err, code) {\n if (err) return callback(err);\n\n var result;\n\n try {\n result = _transformation2[\"default\"](code, opts);\n } catch (err) {\n return callback(err);\n }\n\n callback(null, result);\n });\n}", "parseFileAndSubs(file, onChange = false) {\r\n if (this.isExcluded(file)) {\r\n this.extension.logger.addLogMessage(`Ignoring ${file}`);\r\n return;\r\n }\r\n this.extension.logger.addLogMessage(`Parsing ${file}`);\r\n if (this.fileWatcher && !this.filesWatched.includes(file)) {\r\n // The file is first time considered by the extension.\r\n this.fileWatcher.add(file);\r\n this.filesWatched.push(file);\r\n }\r\n const content = this.getDirtyContent(file, onChange);\r\n this.cachedContent[file].children = [];\r\n this.cachedContent[file].bibs = [];\r\n this.cachedFullContent = undefined;\r\n this.parseInputFiles(content, file);\r\n this.parseBibFiles(content, file);\r\n // We need to parse the fls to discover file dependencies when defined by TeX macro\r\n // It happens a lot with subfiles, https://tex.stackexchange.com/questions/289450/path-of-figures-in-different-directories-with-subfile-latex\r\n this.parseFlsFile(file);\r\n }", "_readAndParseCompileResultOrNull(filename) {\n const raw = this._readFileOrNull(filename);\n return this.parseCompileResult(raw);\n }", "async function main() {\n const resolvedPaths = globby.sync(files as string[])\n const transformationModule = loadTransformationModule(transformationName)\n\n log(`Processing ${resolvedPaths.length} files…`)\n\n for (const p of resolvedPaths) {\n debug(`Processing ${p}…`)\n const fileInfo = {\n path: p,\n source: fs.readFileSync(p).toString(),\n }\n try {\n const result = runTransformation(\n fileInfo,\n transformationModule,\n params as object\n )\n fs.writeFileSync(p, result)\n } catch (e) {\n console.error(e)\n }\n }\n}", "function transform(filename) {\n if (shouldStub(filename)) {\n return reactStub;\n } else {\n var content = fs.readFileSync(filename, 'utf8');\n return ReactTools.transform(content, {harmony: true});\n }\n}", "transform(program) {\n var options = AsxFormatter.options(this.file.ast);\n //DefaultFormatter.prototype.transform.apply(this, arguments);\n\n var locals = [];\n var definitions = [];\n var body = [];\n program.body.forEach(item=>{\n switch(item.type){\n case 'ExpressionStatement':\n var exp = item.expression;\n if(exp.type=='Literal' && exp.value.toLowerCase()=='use strict'){\n return;\n }\n break;\n case 'VariableDeclaration':\n item.declarations.forEach(d=>{\n locals.push(d.id);\n });\n break;\n case 'FunctionDeclaration':\n if(item.id.name=='module'){\n item.body.body.forEach(s=>{\n body.push(s);\n })\n return;\n }else\n if(item._class){\n item.id =t.identifier('c$'+item._class);\n body.push(t.expressionStatement(t.callExpression(\n t.memberExpression(\n t.identifier('asx'),\n t.identifier('c$')\n ),[item])));\n return;\n }else{\n locals.push(item.id);\n }\n break;\n }\n body.push(item);\n });\n\n var definer = [];\n\n\n\n if(Object.keys(this.imports).length){\n\n Object.keys(this.imports).forEach(key=>{\n var items = this.imports[key];\n if(items['*'] && typeof items['*']=='string'){\n this.imports[key]=items['*'];\n }\n });\n definer.push(t.property('init',\n t.identifier('imports'),\n t.valueToNode(this.imports)\n ))\n }\n var exports;\n if(this.exports['*']){\n exports = this.exports['*'];\n delete this.exports['*'];\n }\n if(Object.keys(this.exports).length){\n definer.push(t.property('init',\n t.identifier('exports'),\n t.valueToNode(this.exports)\n ))\n }\n if(body.length){\n if(exports){\n var ret = [];\n Object.keys(exports).forEach(key=>{\n var val = exports[key];\n if(typeof val=='string') {\n ret.push(t.property('init',\n t.literal(key), t.identifier(val == '*' ? key : val)\n ))\n }else{\n ret.push(t.property('init',\n t.literal(key), val\n ))\n }\n });\n body.push(t.returnStatement(\n t.objectExpression(ret)\n ));\n }\n var initializer = t.functionExpression(null, [t.identifier('asx')], t.blockStatement(body));\n definer.push(t.property('init',\n t.identifier('execute'),\n initializer\n ))\n }\n definitions.forEach(item=>{\n\n if(item._class){\n definer.push(t.property('init',\n t.literal('.'+item._class),\n item\n ))\n }else{\n definer.push(t.property('init',\n t.literal(':'+item.id.name),\n item\n ))\n }\n\n })\n definer = t.objectExpression(definer);\n\n\n\n /*\n var definer = t.functionExpression(null, [t.identifier(\"module\")], t.blockStatement(body));\n if(options.bind){\n definer = t.callExpression(\n t.memberExpression(\n definer,\n t.identifier(\"bind\")\n ),[\n t.callExpression(t.identifier(\"eval\"),[t.literal(\"this.global=this\")])\n ]\n );\n }*/\n var body = [];\n var definer = util.template(\"asx-module\",{\n MODULE_NAME: t.literal(this.getModuleName()),\n MODULE_BODY: definer\n });\n if(options.runtime){\n var rt = util.template(\"asx-runtime\")\n //rt._compact = true;\n body.push(t.expressionStatement(rt));\n }\n body.push(t.expressionStatement(definer))\n program.body = body;\n }", "function transformIvySourceFile(compilation, context, file) {\n var importManager = new translator_1.ImportManager();\n // Recursively scan through the AST and perform any updates requested by the IvyCompilation.\n var sf = visitNode(file);\n // Generate the import statements to prepend.\n var imports = importManager.getAllImports().map(function (i) { return ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(ts.createIdentifier(i.as))), ts.createLiteral(i.name)); });\n // Prepend imports if needed.\n if (imports.length > 0) {\n sf.statements = ts.createNodeArray(tslib_1.__spread(imports, sf.statements));\n }\n return sf;\n // Helper function to process a class declaration.\n function visitClassDeclaration(node) {\n // Determine if this class has an Ivy field that needs to be added, and compile the field\n // to an expression if so.\n var res = compilation.compileIvyFieldFor(node);\n if (res !== undefined) {\n // There is a field to add. Translate the initializer for the field into TS nodes.\n var exprNode = translator_1.translateExpression(res.initializer, importManager);\n // Create a static property declaration for the new field.\n var property = ts.createProperty(undefined, [ts.createToken(ts.SyntaxKind.StaticKeyword)], res.field, undefined, undefined, exprNode);\n // Replace the class declaration with an updated version.\n node = ts.updateClassDeclaration(node, \n // Remove the decorator which triggered this compilation, leaving the others alone.\n maybeFilterDecorator(node.decorators, compilation.ivyDecoratorFor(node)), node.modifiers, node.name, node.typeParameters, node.heritageClauses || [], tslib_1.__spread(node.members, [property]));\n }\n // Recurse into the class declaration in case there are nested class declarations.\n return ts.visitEachChild(node, function (child) { return visitNode(child); }, context);\n }\n function visitNode(node) {\n if (ts.isClassDeclaration(node)) {\n return visitClassDeclaration(node);\n }\n else {\n return ts.visitEachChild(node, function (child) { return visitNode(child); }, context);\n }\n }\n }", "function transformFileSync(filename) {\n\t var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n\t opts.filename = filename;\n\t return _transformation2[\"default\"](_fs2[\"default\"].readFileSync(filename, \"utf8\"), opts);\n\t}", "function transformFileSync(filename) {\n\t var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n\t opts.filename = filename;\n\t return _transformation2[\"default\"](_fs2[\"default\"].readFileSync(filename, \"utf8\"), opts);\n\t}", "function Compiler(tree, file) {\n this.inLink = false;\n this.inTable = false;\n this.tree = tree;\n this.file = file;\n this.options = xtend(this.options);\n this.setOptions({});\n}", "static fromFile(file){\n return new IteratorFlow(FlowFactory.createIteratorFromFileSystem(file));\n }", "function build(files, options, callback) {\n if (!Array.isArray(files) || files.length === 0) {\n return callback(new Error('missing input files'))\n }\n\n // make the options argument optional\n if (typeof options === 'function') {\n callback = options\n options = {}\n }\n\n options.scan = options.scan || scan\n options.load = options.load || load\n options.minify = options.minify || false\n\n // validate the input, and calculate each file's hash\n for (var i = 0; i < files.length; i++) {\n var file = files[i]\n if (file.src == null) {\n return callback(new Error('missing file source'))\n }\n\n file.src = file.src.toString('utf8')\n file.hash = sha1(file.src)\n }\n\n // walk over the input files\n walk(files, options, function (err, files) {\n if (err != null) {\n return callback(err)\n }\n\n if (!(files = sort(files))) {\n return callback(new Error('input contains circular dependency'))\n }\n\n var payload = pack(files)\n\n // minify the output if we've been asked to\n if (options.minify) {\n try {\n payload = uglify.minify(payload, { fromString: true }).code\n } catch (err) {\n return callback(err)\n }\n }\n\n callback(null, payload)\n })\n}", "function processSync(doc) {\n var file;\n var complete;\n\n freeze();\n assertParser('processSync', processor.Parser);\n assertCompiler('processSync', processor.Compiler);\n file = vfile(doc);\n\n process(file, done);\n\n assertDone('processSync', 'process', complete);\n\n return file\n\n function done(error) {\n complete = true;\n bail(error);\n }\n }", "async traverse(filePath, context, callback) {\n let tempContext = context;\n if (!tempContext) tempContext = new TraverseContext();\n if (tempContext.metFiles.has(filePath)) return;\n tempContext.metFiles.add(filePath);\n let file = this.getFile(filePath);\n\n if (file.cacheIsUpToDate()) {\n tempContext.cachedEntriesLoaded++;\n } else {\n tempContext.rebuiltEntries++;\n }\n\n if (callback) {\n let result = callback(filePath, file, context);\n\n if (result instanceof Promise) {\n await result;\n }\n } // getDependencies method tries to use the most\n // efficient method to fetch file dependencies,\n // but it will rebuild each modified file\n // automatically. See getDependencies\n // documentation\n\n\n for (let [name, absolute] of Object.entries(file.getDependencies())) {\n if (!this.shouldWalkFile(name)) continue;\n if (tempContext.onlyCompilableFiles && !this.getFile(absolute).shouldBeCompiled) continue;\n await this.traverse(absolute, tempContext, callback);\n }\n\n return tempContext;\n }", "function index () {\r\n return {\r\n name: 'transform-import-meta',\r\n visitor: {\r\n Program: function (path) {\r\n var metas = [];\r\n path.traverse({\r\n MemberExpression: function (memberExpPath) {\r\n var node = memberExpPath.node;\r\n if (node.object.type === 'MetaProperty' &&\r\n node.object.meta.name === 'import' &&\r\n node.object.property.name === 'meta' &&\r\n node.property.type === 'Identifier' &&\r\n node.property.name === 'url') {\r\n metas.push(memberExpPath);\r\n }\r\n }\r\n });\r\n if (metas.length === 0) {\r\n return;\r\n }\r\n for (var _i = 0, metas_1 = metas; _i < metas_1.length; _i++) {\r\n var meta = metas_1[_i];\r\n meta.replaceWith(ast(templateObject_1 || (templateObject_1 = __makeTemplateObject([\"require('url').pathToFileURL(__filename).toString()\"], [\"require('url').pathToFileURL(__filename).toString()\"]))));\r\n }\r\n }\r\n }\r\n };\r\n}", "function transmorph( xslSrc, file, filterKey, filterValue )\r\n{\r\n var result = transform( xslSrc, filterKey, filterValue );\r\n saveFile( result, file );\r\n}", "function compileFile(filename, options) {\n fs.readFile(filename, \"utf-8\", (error, sourceCode) => {\n if (error) {\n console.error(error);\n return;\n }\n console.log(compile(sourceCode, options));\n });\n}", "async function compile(filename) {\n const basename = path.basename(filename);\n const filenameAbs = path.join(config.source, filename);\n\n const code = await fs.readFileAsync(path.join(config.source, filename), 'utf8');\n\n await Promise.all(config.builds.map(async function (build) {\n const outFilenameAbs = path.join(build.dir, filename);\n const outDirname = path.dirname(outFilenameAbs);\n\n let result;\n const options = assign({\n ast: false,\n sourceMap: true,\n sourceMapName: basename,\n sourceFileName: filename,\n sourceRoot: path.relative(outDirname, config.source),\n }, build.options);\n\n try {\n result = transform(code, options);\n }\n catch (err) {\n console.error('Multiform: Failed to compile file', filenameAbs);\n console.error('to', outFilenameAbs);\n console.error('with options', options);\n throw err;\n }\n\n const output = result.code + '\\n\\n//# sourceMappingURL=' + basename + '.map\\n';\n\n delete result.map.names;\n delete result.map.sourcesContent;\n\n\n // save the output file and sourcemap\n await cleaned;\n await ensureDirExists(outDirname);\n await Promise.all([\n fs.writeFileAsync(outFilenameAbs, output),\n fs.writeFileAsync(outFilenameAbs + '.map', JSON.stringify(result.map, null, 2)),\n ]);\n }));\n}", "function process(filename, source) {\n try {\n if (util.isString(source) && source.charAt(0) === \"{\")\n source = JSON.parse(source);\n if (!util.isString(source))\n self.setOptions(source.options).addJSON(source.nested);\n else {\n parse.filename = filename;\n var parsed = parse(source, self, options),\n resolved,\n i = 0;\n if (parsed.imports)\n for (; i < parsed.imports.length; ++i)\n if (resolved = self.resolvePath(filename, parsed.imports[i]))\n fetch(resolved);\n if (parsed.weakImports)\n for (i = 0; i < parsed.weakImports.length; ++i)\n if (resolved = self.resolvePath(filename, parsed.weakImports[i]))\n fetch(resolved, true);\n }\n } catch (err) {\n finish(err);\n }\n if (!sync && !queued)\n finish(null, self); // only once anyway\n }", "function process(filename, source) {\n try {\n if (util.isString(source) && source.charAt(0) === \"{\")\n source = JSON.parse(source);\n if (!util.isString(source))\n self.setOptions(source.options).addJSON(source.nested);\n else {\n parse.filename = filename;\n var parsed = parse(source, self, options),\n resolved,\n i = 0;\n if (parsed.imports)\n for (; i < parsed.imports.length; ++i)\n if (resolved = self.resolvePath(filename, parsed.imports[i]))\n fetch(resolved);\n if (parsed.weakImports)\n for (i = 0; i < parsed.weakImports.length; ++i)\n if (resolved = self.resolvePath(filename, parsed.weakImports[i]))\n fetch(resolved, true);\n }\n } catch (err) {\n finish(err);\n }\n if (!sync && !queued)\n finish(null, self); // only once anyway\n }", "static process_file(filename)\r\n {\r\n if (fs === null)\r\n {\r\n throw new Error(\"Not in node.js : module fs not defined. Aborting.\");\r\n }\r\n if (DEBUG)\r\n {\r\n console.log('Processing file:', filename);\r\n console.log('--------------------------------------------------------------------------');\r\n }\r\n let data = Hamill.read_file(filename);\r\n let doc = this.process_string(data);\r\n doc.set_name(filename);\r\n return doc;\r\n }", "function processFile(content, cpu, onComplete) {\n // Pointer to the memory address in the CPU that we're\n // loading a value into:\n let curAddr = 0;\n \n // Split the lines of the content up by newline\n const lines = content.split('\\n');\n\n // Loop through each line of machine code\n\n for (let line of lines) {\n const comment = line.indexOf('#');\n\n // If we found one, cut off everything after\n if (comment != -1) {\n line = line.substr(0, comment);\n }\n\n // Remove whitespace from either end\n line = line.trim();\n\n if (line === '') {\n // Line was blank or only a comment\n continue;\n }\n\n // At this point, the line should just be the 1s and 0s\n\n // Convert from binary string to number\n const binValue = parseInt(line, 2); // Base 2 == binary\n\n // Check to see if the parsing failed\n if (isNaN(binValue)) {\n console.error('Invalid binary number: ' + line);\n process.exit(1);\n }\n\n // Ok, we have a good value, so store it into memory:\n //console.log(`storing ${binValue}, ${line}`);\n cpu.poke(curAddr, binValue);\n \n curAddr++;\n }\n\n onComplete(cpu);\n}", "function process(filename, source) {\n try {\n if (util.isString(source) && source.charAt(0) === \"{\")\n source = JSON.parse(source);\n if (!util.isString(source))\n self.setOptions(source.options).addJSON(source.nested);\n else {\n parse.filename = filename;\n var parsed = parse(source, self, options),\n resolved,\n i = 0;\n if (parsed.imports)\n for (; i < parsed.imports.length; ++i)\n if (resolved = getBundledFileName(parsed.imports[i]) || self.resolvePath(filename, parsed.imports[i]))\n fetch(resolved);\n if (parsed.weakImports)\n for (i = 0; i < parsed.weakImports.length; ++i)\n if (resolved = getBundledFileName(parsed.weakImports[i]) || self.resolvePath(filename, parsed.weakImports[i]))\n fetch(resolved, true);\n }\n } catch (err) {\n finish(err);\n }\n if (!sync && !queued)\n finish(null, self); // only once anyway\n }", "function process(filename, source) {\n try {\n if (util.isString(source) && source.charAt(0) === \"{\")\n source = JSON.parse(source);\n if (!util.isString(source))\n self.setOptions(source.options).addJSON(source.nested);\n else {\n parse.filename = filename;\n var parsed = parse(source, self, options),\n resolved,\n i = 0;\n if (parsed.imports)\n for (; i < parsed.imports.length; ++i)\n if (resolved = getBundledFileName(parsed.imports[i]) || self.resolvePath(filename, parsed.imports[i]))\n fetch(resolved);\n if (parsed.weakImports)\n for (i = 0; i < parsed.weakImports.length; ++i)\n if (resolved = getBundledFileName(parsed.weakImports[i]) || self.resolvePath(filename, parsed.weakImports[i]))\n fetch(resolved, true);\n }\n } catch (err) {\n finish(err);\n }\n if (!sync && !queued)\n finish(null, self); // only once anyway\n }", "static async compileFile (fromFileRelative, toDirRelative, data, options) {\n const { name, dir } = path.parse(fromFileRelative)\n let subDir = options.base ? dir.split(options.base).pop() : ''\n subDir = subDir.startsWith('/') ? subDir.slice(1) : subDir\n const toFileAbsolute = path.resolve(toDirRelative, subDir, name + options.ext)\n const fromFileAbsolute = path.resolve(fromFileRelative)\n const result = await CompileEjsTask.renderFile(fromFileAbsolute, data, options)\n fs.outputFileSync(toFileAbsolute, result)\n }", "function transformFileSync(filename) {\n var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n opts.filename = filename;\n return _transformation2[\"default\"](_fs2[\"default\"].readFileSync(filename, \"utf8\"), opts);\n}", "function loadTest (filename) {\n var content = fs.readFileSync(filename) + '';\n var parts = content.split(/\\n-----*\\n/);\n\n return {\n source: parts[0],\n compiled: parts[1],\n ast: parts[2],\n transformed: parts[3]\n };\n}", "function Parser(f) {\n this.parse = f;\n }", "function processSync(doc) {\n var file\n var complete\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(error) {\n complete = true\n bail(error)\n }\n }", "function processSync(doc) {\n var file\n var complete\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(error) {\n complete = true\n bail(error)\n }\n }" ]
[ "0.5783369", "0.5783369", "0.57678044", "0.57678044", "0.57678044", "0.57678044", "0.57678044", "0.57678044", "0.573477", "0.5524739", "0.5524739", "0.55166644", "0.5511736", "0.54946756", "0.5463103", "0.5417252", "0.5406631", "0.53526235", "0.53465986", "0.5324869", "0.5324869", "0.5324869", "0.5301031", "0.5301031", "0.5301031", "0.5301031", "0.5301031", "0.5282941", "0.52399576", "0.52099574", "0.5200457", "0.51893026", "0.5185214", "0.5185214", "0.5185214", "0.5185214", "0.5185214", "0.5185214", "0.51678807", "0.5130203", "0.5124421", "0.5123969", "0.5110482", "0.50694954", "0.49728358", "0.49689153", "0.49390972", "0.49357706", "0.48945954", "0.48725012", "0.48496065", "0.48496065", "0.48334795", "0.48090634", "0.48027483", "0.47972474", "0.47808385", "0.47493434", "0.4737406", "0.4733438", "0.47271353", "0.47020957", "0.4700035", "0.46923685", "0.46783045", "0.4673817", "0.46680513", "0.46591526", "0.46407276", "0.4622669", "0.4599877", "0.45890224", "0.45842406", "0.45842406", "0.45800477", "0.4570359", "0.4568246", "0.4564585", "0.4558768", "0.4556415", "0.45531422", "0.4547579", "0.45428467", "0.45421442", "0.45421442", "0.45372036", "0.45331725", "0.45315725", "0.45315725", "0.45246142", "0.4521156", "0.4511479", "0.4507583", "0.4506486", "0.4506486" ]
0.55421233
14
Process the given document (in string or VFile representation), sync.
function processSync(doc) { var complete = false var file freeze() assertParser('processSync', processor.Parser) assertCompiler('processSync', processor.Compiler) file = vfile(doc) process(file, done) assertDone('processSync', 'process', complete) return file function done(err) { complete = true bail(err) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processSync(doc) {\n var file;\n var complete;\n\n freeze();\n assertParser('processSync', processor.Parser);\n assertCompiler('processSync', processor.Compiler);\n file = vfile(doc);\n\n process(file, done);\n\n assertDone('processSync', 'process', complete);\n\n return file\n\n function done(error) {\n complete = true;\n bail(error);\n }\n }", "function processSync(doc) {\n var complete = false;\n var file;\n\n freeze();\n assertParser('processSync', processor.Parser);\n assertCompiler('processSync', processor.Compiler);\n file = vfile(doc);\n\n process(file, done);\n\n assertDone('processSync', 'process', complete);\n\n return file;\n\n function done(err) {\n complete = true;\n bail(err);\n }\n }", "function processSync(doc) {\n var file\n var complete\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(error) {\n complete = true\n bail(error)\n }\n }", "function processSync(doc) {\n var file\n var complete\n\n freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n file = vfile(doc)\n\n process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n function done(error) {\n complete = true\n bail(error)\n }\n }", "function process(doc, cb) {\n freeze();\n assertParser('process', processor.Parser);\n assertCompiler('process', processor.Compiler);\n\n if (!cb) {\n return new Promise(executor);\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n var file = vfile(doc);\n\n pipeline.run(processor, {file: file}, done);\n\n function done(err) {\n if (err) {\n reject(err);\n } else if (resolve) {\n resolve(file);\n } else {\n cb(null, file);\n }\n }\n }\n }", "function process(doc, cb) {\n freeze();\n assertParser('process', processor.Parser);\n assertCompiler('process', processor.Compiler);\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb);\n\n function executor(resolve, reject) {\n var file = vfile(doc);\n\n pipeline.run(processor, {file: file}, done);\n\n function done(error) {\n if (error) {\n reject(error);\n } else if (resolve) {\n resolve(file);\n } else {\n cb(null, file);\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(err) {\n if (err) {\n reject(err)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(error) {\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process(doc, cb) {\n freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n var file = vfile(doc)\n\n pipeline.run(processor, {file: file}, done)\n\n function done(error) {\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n cb(null, file)\n }\n }\n }\n }", "function process () {\n if (!processed) {\n var editor = EditorManager.getCurrentFullEditor();\n var currentDocument = editor.document;\n var originalText = currentDocument.getText();\n var processedText = Processor.process(originalText);\n var cursorPos = editor.getCursorPos();\n var scrollPos = editor.getScrollPos();\n\n // Bail if processing was unsuccessful.\n if (processedText === false) {\n return;\n }\n\n // Replace text.\n currentDocument.setText(processedText);\n\n // Restore cursor and scroll positons.\n editor.setCursorPos(cursorPos);\n editor.setScrollPos(scrollPos.x, scrollPos.y);\n\n // Save file.\n CommandManager.execute(Commands.FILE_SAVE);\n\n // Prevent file from being processed multiple times.\n processed = true;\n } else {\n processed = false;\n }\n }", "async parseDocument(doc)\n {\n // dumb helper function \n function isString (obj) {\n return (Object.prototype.toString.call(obj) === '[object String]');\n }\n\n if (isString(doc))\n doc = JSON.parse(doc)\n \n if (doc.hasOwnProperty('text_snippet') && \n doc.text_snippet.hasOwnProperty('content'))\n {\n var splitOptions = {\n SeparatorParser: {\n // separatorCharacters: ['\\n','.','?','!']\n }\n }\n \n console.log(\"*****Reparsing data from file****\")\n // first split the sentence\n let sentencesSplit = split(doc.text_snippet.content, splitOptions)\n let actualSplit = []\n\n // next we need to get the child nodes if any and flatten. basically we are cleaning up a funky artifact of sentence-splitter library\n // when you use split options, things come out in sentencesSplit[i].children\n for(var i =0;i<sentencesSplit.length;i++) {\n if (sentencesSplit[i].children) {\n actualSplit.push(...sentencesSplit[i].children)\n } else {\n actualSplit.push(sentencesSplit[i])\n }\n }\n console.log(actualSplit)\n \n // Now we have these wierd punctuation nodes seperate from our sentance.\n // if punctuation is not the first token in the document, \n // then append the punctuation to the previous token, and update the offsets.\n // this has the effect of creating a overlapping token so we will need to ignore \n // the punctionation token later on in RenderSentence::render()\n for(var i =0 ; i<actualSplit.length ; i++) {\n var sentence = actualSplit[i];\n\n if (sentence.type == \"Punctuation\" && i>0) {\n actualSplit[i-1].range[1]=sentence.range[1]\n actualSplit[i-1].value+= sentence.value\n actualSplit[i-1].raw+= sentence.raw\n }\n }\n \n return {\n documentData: doc,\n sentenceData: actualSplit \n }\n }\n else\n throw new Error(\"Schema Validation Error: \"+ JSON.stringify(doc).substr(0,500)+\" ... \");\n }", "function processDocument() {\n // process the document.\n let body = DocumentApp.getActiveDocument().getBody();\n let bodyText = body.editAsText();\n let text = body.editAsText().getText();\n\n // store all distinct words found in the doc\n let wordList = {};\n\n let words = getWords(text);\n let totalWords = words.length;\n let sentences = getSentences(text);\n let totalSentences = sentences.length;\n let totalSyllables = getNumSyllables(text);\n\n let avgSentenceLength = totalWords / totalSentences;\n let avgSyllablesWord = totalSyllables / totalWords;\n\n // count the number of distinct words\n words.forEach((word) => {\n if(!wordList[word]) {\n wordList[word] = 1;\n }\n })\n\n let distinctWords = Object.keys(wordList).length;\n\n let freqResult = getFrequencies(bodyText, words);\n\n underlineSentences(bodyText, sentences);\n\n let kincaid = 0.39 * (avgSentenceLength) + 11.8 * (avgSyllablesWord) - 15.59;\n\n let reading = 206.835 - 1.015 * (avgSentenceLength) - 84.6 * (avgSyllablesWord);\n\n let output = {\n word_count: totalWords,\n original_doc: text,\n sentence_count: totalSentences,\n syllable_count: totalSyllables,\n syllables_word: avgSyllablesWord,\n flesch_kincaid: kincaid,\n flesch_reading: reading,\n type_token: distinctWords / totalWords,\n frequencies: freqResult.frequency,\n avg_sentence: avgSentenceLength\n }\n return output;\n\n // optional code for testing\n \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 processDoc(object, mimeType, root) {\r\n var doc;\r\n\r\n // clueless? assume HTML\r\n if(!mimeType) {\r\n mimeType=\"text/html\";\r\n }\r\n\r\n // dispatch to requested representor \r\n switch(mimeType.toLowerCase()) {\r\n case \"application/json\":\r\n doc = json(object, root);\r\n break;\r\n case \"application/hal+json\":\r\n doc = halj(object, root);\r\n break;\r\n case \"text/html\":\r\n case \"application/html\":\r\n default:\r\n doc = html(object, root);\r\n break;\r\n }\r\n\r\n return doc;\r\n}", "onDocumentOpenOrContentChanged(document) {\n if (!this.startDataLoaded) {\n return;\n }\n // No need to handle file opening because we have preloaded all the files.\n // Open and changed event will be distinguished by document version later.\n if (this.shouldTrackFile(vscode_uri_1.URI.parse(document.uri).fsPath)) {\n this.trackOpenedDocument(document);\n }\n }", "async function extractDocumentFile(input, output) {\n input.text = (await mammoth.extractRawText({\n arrayBuffer: input.arrayBuffer\n })).value;\n}", "function processFileTXT(doc){\n content = doc.body;\n // FILTER: remove tabs\n content = content.replace(/\\t/g, ' ');\n // FILTER: fix smart quotes and m dash with unicode\n content = textPretty(content);\n // FILTER replace meta blocks with comments\n content = content.replace(/=================================/, '<!--');\n content = content.replace(/=================================/, '-->');\n // FILTER replace old page markers <p#> and <c:#>\n content = content.replace(/<p([0-9]+)>/g, \"<span id='pg_$1'></span>\");\n // FILTER: markdown\n md.setOptions({\n gfm: false, tables: false, breaks: false, pedantic: false,\n sanitize: false, smartLists: false, smartypants: false\n });\n content = md(content);\n content = content.replace(/<\\/p>/g, \"\\n\\n\");\n // FILTER add consistent header\n doc.header = HTMLHeaderTemplate(doc.meta);\n // FILTER: Number Paragraphs\n content = numberPars(content, doc.meta);\n doc.body = content;\n // FILTER: HTML5 template into HTML document\n doc.html = HTML5Template(doc);\n return doc;\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 }", "static process_file(filename)\r\n {\r\n if (fs === null)\r\n {\r\n throw new Error(\"Not in node.js : module fs not defined. Aborting.\");\r\n }\r\n if (DEBUG)\r\n {\r\n console.log('Processing file:', filename);\r\n console.log('--------------------------------------------------------------------------');\r\n }\r\n let data = Hamill.read_file(filename);\r\n let doc = this.process_string(data);\r\n doc.set_name(filename);\r\n return doc;\r\n }", "function processFileHTML(doc){\n // parse out into blocks\n // re-assemble with new paragraph numbering\n // add style sheet\n // move assets to the assets folder\n return doc;\n}", "textDocumentDidSave(params) {\n return __awaiter(this, void 0, void 0, function* () {\n const uri = util_1.normalizeUri(params.textDocument.uri);\n // Ensure files needed to suggest completions are fetched\n yield this.projectManager.ensureReferencedFiles(uri).toPromise();\n this.projectManager.didSave(uri);\n });\n }", "function main()\n{\n\n var nodeRef = json.get(\"nodeRef\");\n var version = json.get(\"version\");\n var majorVersion = json.get(\"majorVersion\") == \"true\";\n var description = json.get(\"description\");\n\n // allow for content to be loaded from id\n if (nodeRef != null && version != null)\n {\n\n var workingCopy = search.findNode(nodeRef);\n\n var versions = null;\n if (workingCopy != null)\n {\n if (workingCopy.isLocked)\n {\n // We cannot revert a locked document\n status.code = 404;\n status.message = \"error.nodeLocked\";\n status.redirect = true;\n return;\n }\n\n versions = [];\n var versionHistory = workingCopy.versionHistory;\n if (versionHistory != null)\n {\n for (i = 0; i < versionHistory.length; i++)\n {\n var v = versionHistory[i];\n if (v.label.equals(version))\n { \n if (!workingCopy.hasAspect(\"cm:workingcopy\"))\n {\n // Ensure the original file is versionable - may have been uploaded via different route\n if (!workingCopy.hasAspect(\"cm:versionable\"))\n {\n // We cannot revert a non versionable document\n status.code = 404;\n status.message = \"error.nodeNotVersionable\";\n status.redirect = true;\n return;\n }\n\n // It's not a working copy, do a check out to get the actual working copy\n workingCopy = workingCopy.checkout();\n }\n\n // Update the working copy content\n workingCopy.properties.content.write(v.node.properties.content);\n workingCopy.properties.content.mimetype = v.node.properties.content.mimetype;\n workingCopy.properties.content.encoding = v.node.properties.content.encoding;\n\n // check it in again, with supplied version history note\n workingCopy = workingCopy.checkin(description, majorVersion);\n\n model.document = workingCopy;\n return;\n }\n }\n }\n\n // Could not find the version\n status.code = 404;\n status.message = \"error.versionNotFound\";\n status.redirect = true;\n return;\n }\n else\n {\n // Could not find a document for the nodeRef\n status.code = 404;\n status.message = \"error.nodeNotFound\";\n status.redirect = true;\n return;\n }\n }\n}", "function acceptDocument(data) {\n var names = documentNames\n names.push(data.name)\n setDocumentNames(names)\n\n var uris = documentURIs\n uris.push(data.uri)\n setDocumentURIs(uris)\n\n confirmData(classification, orderTask, ontologyTask, commentTask, comment, uris, names)\n }", "parseDocument(doc) {\n // split the document to words\n const words = normalize(doc);\n // process each word individually\n words.map(word => {\n if (this.stopWords.find(stopWord => word === stopWord) !== undefined) {\n // do nothing, it's a stop word, and it doesn't add any meaning\n } else if (this.dictionary[word] !== undefined) {\n this.dictionary[word].push(this.documentCount)\n } else {\n this.dictionary[word] = [this.documentCount];\n }\n })\n this.documentCount++\n this.docs.push(doc)\n }", "populateDocument(_docId, event) {\n event.preventDefault();\n const { contractInst } = this.props;\n //condition for docid\n if (_docId) {\n //calling blockchain method to find document by id\n contractInst.methods.findById(_docId).call()\n .then(res => {\n if (res) {\n res.size = FORMATBYTES(parseInt(res.size), 2);\n this.setState({ document: res, show: true });\n }\n }).catch(err => {\n console.error(\"---Error while populating document---\".err);\n });\n\n }\n }", "documentUpload(e) {\n let file = e.target.files[0];\n let fileSize = file.size / 1024 / 1024;\n let fileType = file.type;\n let fileName = file.name;\n let validDocFormat = false;\n let docFormat = fileName.split('.')[1];\n if(docFormat === 'doc'|| docFormat === 'docx' || docFormat === 'xls' || docFormat === 'xlsx'|| docFormat === 'pdf')validDocFormat= true;\n this.setState({ fileType: file.type, fileName: file.name, fileSize: fileSize });\n this.getCentralLibrary();\n if (this.state.totalLibrarySize < 50) {\n let fileExists = this.checkIfFileAlreadyExists(file.name, \"document\");\n let typeShouldBe = _.compact(fileType.split('/'));\n if (file && typeShouldBe && typeShouldBe[0] !== \"image\" && typeShouldBe[0] !== \"video\" && validDocFormat) {\n if (!fileExists) {\n let data = { moduleName: \"PROFILE\", actionName: \"UPDATE\" }\n let response = multipartASyncFormHandler(data, file, 'registration', this.onFileUploadCallBack.bind(this, \"document\"));\n } else {\n toastr.error(\"Document with the same file name already exists in your library\")\n }\n } else {\n toastr.error(\"Please select a Document Format\")\n }\n } else {\n toastr.error(\"Allotted library limit exceeded\");\n }\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}", "parseDocument(doc) {\n // split the document to words\n const words = normalize(doc);\n // process each word individually\n words.map(word => {\n if (this.stopWords.find(stopWord => word === stopWord) !== undefined) {\n\t // do nothing, it's a stop word, and it doesn't add any meaning\n } else if (this.dictionary[word] !== undefined) {\n this.dictionary[word].push(this.documentCount)\n } else {\n this.dictionary[word] = [this.documentCount];\n\t\t\t}\n })\n this.documentCount++\n this.docs.push(doc)\n }", "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 }", "async loadDocumentContent (documentPath) {\n const doc = await this.fetch(`/load_document?d=${documentPath}`) \n return this.parseDocument(doc);\n }", "function processDataFromDocusky() {\n\tparseDocInfo();\n\ttoolSetting();\n}", "function parse(doc) {\n var file = vfile(doc);\n var Parser;\n\n freeze();\n Parser = processor.Parser;\n assertParser('parse', Parser);\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function indexDocument(document) {\n\t\tvar text = document[me.indexField];\n\t\tvar docId = document[me.objectStore.keyPath];\n\n\t\t// tokenize string\n\t\tvar tokens = Object.keys(Lucy.tokenize(text, {disableStemming: true}).tokens);\n\t\t\n\t\tif (me.mode == \"suffix\") {\n\t\t\ttokens = tokens.map(function (token) { return reverse(token); });\n\t\t}\n\t\t\n\t\ttokens.forEach(function(token) {\n\t\t\tvar child = null;\n\t\t\t\n\t\t\t// Add prefixes for every letter in the token\n\t\t\t// We start from the entire token and progressively chop off its last character\n\t\t\twhile (token.length > 0) {\n\t\t\t\taddNode(token, docId, child);\n\t\t\t\t\n\t\t\t\tchild = token[token.length - 1];\n\t\t\t\ttoken = token.slice(0, token.length - 1);\n\t\t\t}\n\t\t});\n\t}", "listen(connection) {\r\n connection.__textDocumentSync = vscode_languageserver_protocol_1.TextDocumentSyncKind.Full;\r\n connection.onDidOpenTextDocument((event) => {\r\n let td = event.textDocument;\r\n let document = this._configuration.create(td.uri, td.languageId, td.version, td.text);\r\n this._documents[td.uri] = document;\r\n let toFire = Object.freeze({ document });\r\n this._onDidOpen.fire(toFire);\r\n this._onDidChangeContent.fire(toFire);\r\n });\r\n connection.onDidChangeTextDocument((event) => {\r\n let td = event.textDocument;\r\n let changes = event.contentChanges;\r\n if (changes.length === 0) {\r\n return;\r\n }\r\n let document = this._documents[td.uri];\r\n const { version } = td;\r\n if (version === null || version === void 0) {\r\n throw new Error(`Received document change event for ${td.uri} without valid version identifier`);\r\n }\r\n document = this._configuration.update(document, changes, version);\r\n this._documents[td.uri] = document;\r\n this._onDidChangeContent.fire(Object.freeze({ document }));\r\n });\r\n connection.onDidCloseTextDocument((event) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document) {\r\n delete this._documents[event.textDocument.uri];\r\n this._onDidClose.fire(Object.freeze({ document }));\r\n }\r\n });\r\n connection.onWillSaveTextDocument((event) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document) {\r\n this._onWillSave.fire(Object.freeze({ document, reason: event.reason }));\r\n }\r\n });\r\n connection.onWillSaveTextDocumentWaitUntil((event, token) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document && this._willSaveWaitUntil) {\r\n return this._willSaveWaitUntil(Object.freeze({ document, reason: event.reason }), token);\r\n }\r\n else {\r\n return [];\r\n }\r\n });\r\n connection.onDidSaveTextDocument((event) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document) {\r\n this._onDidSave.fire(Object.freeze({ document }));\r\n }\r\n });\r\n }", "listen(connection) {\r\n connection.__textDocumentSync = vscode_languageserver_protocol_1.TextDocumentSyncKind.Full;\r\n connection.onDidOpenTextDocument((event) => {\r\n let td = event.textDocument;\r\n let document = this._configuration.create(td.uri, td.languageId, td.version, td.text);\r\n this._documents[td.uri] = document;\r\n let toFire = Object.freeze({ document });\r\n this._onDidOpen.fire(toFire);\r\n this._onDidChangeContent.fire(toFire);\r\n });\r\n connection.onDidChangeTextDocument((event) => {\r\n let td = event.textDocument;\r\n let changes = event.contentChanges;\r\n if (changes.length === 0) {\r\n return;\r\n }\r\n let document = this._documents[td.uri];\r\n const { version } = td;\r\n if (version === null || version === void 0) {\r\n throw new Error(`Received document change event for ${td.uri} without valid version identifier`);\r\n }\r\n document = this._configuration.update(document, changes, version);\r\n this._documents[td.uri] = document;\r\n this._onDidChangeContent.fire(Object.freeze({ document }));\r\n });\r\n connection.onDidCloseTextDocument((event) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document) {\r\n delete this._documents[event.textDocument.uri];\r\n this._onDidClose.fire(Object.freeze({ document }));\r\n }\r\n });\r\n connection.onWillSaveTextDocument((event) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document) {\r\n this._onWillSave.fire(Object.freeze({ document, reason: event.reason }));\r\n }\r\n });\r\n connection.onWillSaveTextDocumentWaitUntil((event, token) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document && this._willSaveWaitUntil) {\r\n return this._willSaveWaitUntil(Object.freeze({ document, reason: event.reason }), token);\r\n }\r\n else {\r\n return [];\r\n }\r\n });\r\n connection.onDidSaveTextDocument((event) => {\r\n let document = this._documents[event.textDocument.uri];\r\n if (document) {\r\n this._onDidSave.fire(Object.freeze({ document }));\r\n }\r\n });\r\n }", "function parse(doc) {\n var file = vfile(doc);\n var Parser;\n\n freeze();\n Parser = processor.Parser;\n assertParser('parse', Parser);\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse();\n }\n\n return Parser(String(file), file); // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "parseWordDocxFile(files) {\n\n this.setState({ converting: true });\n var current = this;\n //console.log(files);\n var file = files[0];\n\n var reader = new FileReader();\n reader.onloadend = function (event) {\n var arrayBuffer = reader.result;\n\n mammoth.convertToHtml({ arrayBuffer: arrayBuffer }).then(\n function (resultObject) {\n \n const newDoc = document.implementation.createHTMLDocument('title');\n newDoc.body.innerHTML = resultObject.value;\n const converting = setTimeout(() => {\n current.setState({ html: resultObject.value, newFile: { name: file.name, file: newDoc }, converting: false });\n }, 2000);\n\n return () => clearTimeout(converting);\n\n\n });\n };\n reader.readAsArrayBuffer(file);\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 parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\n }", "function parse(doc) {\n var file = vfile(doc)\n var Parser\n\n freeze()\n Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser)) {\n return new Parser(String(file), file).parse()\n }\n\n return Parser(String(file), file) // eslint-disable-line new-cap\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 _uploadDocument(req, res) {\n if (req && req.file) {\n var absolutePath = path.join(path.dirname(require.main.filename), req.file.path);\n req.file.absolutePath = absolutePath;\n var saveDocument = new Document({\n docPath: absolutePath,\n docName: req.file.filename\n });\n saveDocument.save(function(err, docs) {\n if (err) {\n resultObj.status = FAIL;\n resultObj.result = err;\n res.send(resultObj);\n } else {\n resultObj.status = OK;\n resultObj.result = docs;\n res.send(resultObj);\n }\n });\n } else {\n resultObj.status = FAIL;\n resultObj.result = 'Server Error';\n res.send(resultObj);\n }\n}", "async function jobCallback(id, task, con) {\n info(`Processing vdoc resource ${id}`);\n const vdocpath = `/resources/${id}`;\n let vdoc = false;\n let vdocmeta = false;\n try {\n let r = await con.get({ path: vdocpath });\n vdoc = _.cloneDeep(r.data);\n // Get our own meta to make sure we don't mess with our own parent's vdoc link\n // (i.e. when recursing through the `unmask` key)\n r = await con.get({ path: `${vdocpath}/_meta` });\n vdocmeta = _.cloneDeep(r.data);\n } catch (e) {\n error(`Could not retrieve vdoc ${vdocpath} or it's _meta, err = %O`, e);\n throw new Error(`Could not retrieve vdoc ${vdocpath}`);\n }\n if (!vdoc) {\n warn(`WARNING: vdoc for ${vdocpath} was empty!`);\n return; // nothing to do, but not really an error\n }\n // save the _meta in the vdoc for recursiveAddVdocLinksToKeys\n vdoc._meta = vdocmeta;\n\n // Recurse through all keys\n // if any key has an _id, it is a link, so put ourselves at it's vdoc.\n // This recursion will handle top-level links in the vdoc as well as things like audits/*\n await recursiveAddVdocLinksToKeys(vdoc,vdocpath, vdoc, con);\n return { success: true };\n}", "function main() {\n\n // Sets AsciiDoc file from url query string \n const params = new URLSearchParams(location.search);\n let aDocName = params.get('aDoc');\n if (aDocName === null || aDocName === '') {\n aDocName = 'indice';\n }\n aDoc = aDocs.find(aDoc => aDoc.name === aDocName);\n \n // Updates UI with HTML content from AsciiDoc file\n updateDocContents(aDoc);\n}", "function read_in_document_text()\n{\n var content = fs.readFileSync(\"filtered_merged_file.json\");\n content = JSON.parse(content);\n var count = 0;\n \n for(var i = 0; i < content.length; i++)\n {\n var current = content[i];\n for(var j = 0; j < current.length; j++)\n {\n var this_doc = current[j];\n var data = {};\n data.date = this_doc[\"date\"];\n data.text = this_doc[\"body\"];\n data.url = this_doc[\"link\"];\n data.title = this_doc[\"title\"];\n document_text[count] = data;\n count++;\n }\n }\n}", "scanFile(document) {\n if (document.languageId === 'sass') {\n const text = document.getText();\n const pathBasename = path_1.basename(document.fileName);\n let variables = {};\n variables = this.scanFileHandleGetVars(text, pathBasename, variables);\n variables = this.scanFileHandleGetMixin(text, pathBasename, variables);\n this.context.workspaceState.update(path_1.normalize(document.fileName), variables);\n }\n }", "function validateTextDocument(textDocument) {\n return __awaiter(this, void 0, void 0, function* () {\n const pathStr = path.resolve(fileUriToPath_1.default(textDocument.uri));\n const folder = pathStr.substring(0, pathStr.lastIndexOf(\"/\") + 1);\n const parentDir = path.resolve(`${folder}../`);\n let thisTemplateLogic = templateLogics[parentDir];\n if (!thisTemplateLogic) {\n thisTemplateLogic = new ergo_compiler_1.TemplateLogic('cicero');\n templateLogics[parentDir] = thisTemplateLogic;\n }\n const thisModelManager = thisTemplateLogic.getModelManager();\n let diagnostics = [];\n try {\n // Find all cto files in ./ relative to this file or in the parent director\n // if this is a Cicero template.\n let newModels = false;\n const modelFiles = glob_1.glob.sync(`{${folder},${parentDir}/models/}**/*.cto`);\n for (const file of modelFiles) {\n connection.console.log(file);\n const contents = fs.readFileSync(file, 'utf8');\n const modelFile = new composer_concerto_1.ModelFile(thisModelManager, contents, file);\n if (!thisModelManager.getModelFile(modelFile.getNamespace())) {\n // only add if not existing\n thisModelManager.addModelFile(contents, file, true);\n newModels = true;\n }\n }\n // Only pull external models if a new file was added to the model manager\n if (newModels) {\n yield thisModelManager.updateExternalModels();\n }\n try {\n // Find all ergo files in ./ relative to this file\n const ergoFiles = glob_1.glob.sync(`{${folder},${parentDir}/lib/}**/*.ergo`);\n for (const file of ergoFiles) {\n if (file === pathStr) {\n // Update the current file being edited\n thisTemplateLogic.updateLogic(textDocument.getText(), pathStr);\n }\n else {\n connection.console.log(file);\n const contents = fs.readFileSync(file, 'utf8');\n thisTemplateLogic.updateLogic(contents, file);\n }\n }\n const compiled = yield thisTemplateLogic.compileLogic(true);\n }\n catch (error) {\n const descriptor = error.descriptor;\n if (descriptor.kind === 'CompilationError' || descriptor.kind === 'TypeError') {\n const range = {\n start: { line: 0, character: 0 },\n end: { line: 0, character: 0 },\n };\n if (descriptor.locstart.line > 0) {\n range.start = { line: descriptor.locstart.line - 1, character: descriptor.locstart.character };\n range.end = range.start;\n }\n if (descriptor.locend.line > 0) {\n range.end = { line: descriptor.locend.line - 1, character: descriptor.locend.character };\n }\n diagnostics.push({\n severity: vscode_languageserver_1.DiagnosticSeverity.Error,\n range,\n message: descriptor.message,\n source: 'ergo'\n });\n }\n else {\n diagnostics.push({\n severity: vscode_languageserver_1.DiagnosticSeverity.Error,\n range: {\n start: { line: descriptor.locstart.line - 1, character: descriptor.locstart.character },\n end: { line: descriptor.locend.line - 1, character: descriptor.locend.character },\n },\n message: descriptor.message,\n source: 'ergo'\n });\n }\n }\n }\n catch (error) {\n connection.console.error(error.message);\n connection.console.error(error.stack);\n }\n connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });\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}", "async uploadDocumentToIPFS() {\n const formData = new FormData();\n const files = Array.from(document.querySelector(\"#document\").files);\n if (files.length > 0) {\n if (this.approveFileType(files[0])) {\n formData.set(\"document\", files[0]);\n const { IpfsHash } = await fetch(\"http://localhost:3000/upload\", {\n method: \"POST\",\n body: formData,\n }).then((response) => response.json());\n return IpfsHash;\n } else {\n new Alert(\n \"#alert-container\",\n \"alert\",\n \"danger\",\n \"File type is not approved\"\n );\n }\n } else {\n return \"\";\n }\n }", "function editAndCommit(oDocument, sContent, sCommitMessage) {\n\t\t\treturn oDocument.setContent(sContent).then(function () {\n\t\t\t\treturn oDocument.save().then(function () {\n\t\t\t\t\treturn stageFilesAndCommit([oDocument.getEntity().getName()], sCommitMessage);\n\t\t\t\t});\n\t\t\t});\n\t\t}", "processDoc(xmlFile, xmlDoc) {\n\n const work = {\n url: new URL(xmlFile, window.location),\n xmlDoc,\n title: \"\",\n descr: \"\",\n versions: [],\n facsimiles: []\n };\n\n\n try {\n work.title = this.runXPath(xmlDoc, \"/tei:teiCorpus/tei:teiHeader//tei:title\", xmlDoc).iterateNext().textContent;\n } catch (e) {\n console.error(\"No teiCorpus found!\");\n return;\n }\n\n // get more descriptive metadata from TEI header\n\n try {\n work.descr = this.runXPath(xmlDoc, \"/tei:teiCorpus/tei:teiHeader//tei:sourceDesc\", xmlDoc).iterateNext().innerHTML;\n } catch (e) {\n work.descr = \"info to be added\"\n }\n\n const teiResult = this.runXPath(xmlDoc, \"/tei:teiCorpus/tei:TEI\", xmlDoc);\n for (let a = teiResult.iterateNext(); a; a = teiResult.iterateNext()) {\n work.versions.push(a);\n\n const language = this.runXPath(xmlDoc, \".//tei:language\", a).iterateNext().textContent;\n const facsimileResult = this.runXPath(xmlDoc, \".//tei:facsimile//tei:graphic\", a);\n const facsimile = { language, images: [] };\n for (let i = facsimileResult.iterateNext(); i; i = facsimileResult.iterateNext()) {\n facsimile.images.push(i.getAttribute(\"url\"));\n }\n work.facsimiles.push(facsimile);\n }\n\n this.works.push(work);\n }", "function doDocument() {\n\n // This function is called when the document is ready by\n // virtue of $(document).ready call right at the bottom\n // of this script. We call Crimson's default handler,\n // bind the input button, and start the tag update process.\n\n doSession();\n\n $(\"#commit\").on(\"click\", function (e) { submitData(); });\n\n sendRead();\n}", "static async find(directory, document, filename, edit = false) {\n\n\t\tlet path = `${config.api}/directories/${directory}/documents/${document}/files/${filename}`;\n\n\t\t// if we need the uncompiled markdown (for loading the editor), amend '/edit' to the path\n\t\tif (edit) {\n\t\t\tpath = [path, \"edit\"].join(\"/\");\n\t\t};\n\n\t\tlet response = await fetch(path, {headers: store.state.auth.authHeader()})\n\n\t\tif (!checkResponse(response.status)) {\n\t\t\tconsole.error(\"Document cannot be retrieved\", response);\n\t\t\treturn;\n\t\t}\n\n\t\tlet file = await response.json()\n\t\tlet doc = new CMSFile(file);\n\t\tstore.state.activeDocument = doc;\n\n\t\tawait store.commit(\"setLatestRevision\", file.repository_info.latest_revision);\n\n\t\tdoc.fetchAttachments();\n\t\treturn doc;\n\n\t}", "function postDoc(username,fileName, fileType, doc){\n UserAccountService.postDoc(username, fileName, fileType, doc)\n .then(\n function(d) {\n vm.cancelModal();\n },\n function(errResponse){\n console.error('Error while updating doc');\n }\n );\n }", "function processPDF() {\n\t// lock process and prevent user resubmission\n\tprocessing = true;\n\tvar progress = $(\"#progressDisplay\");\n\t$(\"#uploadPDFDiv\").addClass(\"disableButtons\");\n\t\n\t// convert file to text\n\tvar file = document.getElementById(\"pdfInput\").files[0];\n\tif(file == null || !(\"name\" in file) || !file.name.endsWith(\".pdf\")) {\n\t\tprogress.text(\"No file selected or invalid format\");\n\t}\n\tprogress.text(\"Converting file to text\");\n\tPdf2TextClass().convertPDF(file, function(page, total) {}, function(pages) {\n\t\t// called when the pdf is fully converted to text. Finds all unique words\n\t\t\n\t\tprogress.text(\"finding unique words and chapters\");\n\t\tvar start = $(\"#startPageNumber\").val();\n\t\tvar end = $(\"#endPageNumber\").val();\n\t\tvar auto = $(\"#autoChidCheck\").prop(\"checked\");\n\t\tvar prefix = $(\"#prefixInput\").val();\n\t\t\n\t\t// check for bad ch_id prefix\n\t\tif(!prefix.match(/^([1-8]((M|N|S|SS|EN)([0-9][0-9]\\.)?([0-9][0-9])?)?)?$/)) {\n\t\t\tprogress.text(\"chapter prefix isn't formatted correctly\");\n\t\t\tfinishProcessingPDF();\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t\n\t\tvar words = findUniqueWordsFromString(pages, auto, $(\"#chapInput\").val(), prefix,\n\t\t\t\t\t\t\t\t\t\t\tstart, end);\n\t\tif(words === false) {\n\t\t\tprogress.text(\"You can't autogenerate ch_ids if you specify 'start' and 'end'\");\n\t\t\tfinishProcessingPDF();\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tupdateContext(pages, start, end);\n\t\t\n\t\t\n\t\tprogress.text(\"uploading...\");\n\t\t\n\t\tmaxProgress = 0;\n\t\t// uploads the words to the backend to be added to the dictionary\n\t\t$.post(\"backend.php\",\n\t\t\t\t{'loginInfo': {\"allowed\": true, 'user': 'me'},\n\t\t\t\t'wordList': JSON.stringify(words)},\n\t\t\t\tfunction(data, status, jqXHR) {\n\t\t\t\t\t// called when the post request returns (whether successful or not)\n\t\t\t\t\tif('status' in data && data['status']['type'] == 'error') {\n\t\t\t\t\t\t// after a non-fatal error\n\t\t\t\t\t\tprogress.text(\"Failed with error: \" + data['status']['value']);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tprogress.html(\"Done!<br>Success: \" + (data['success'] || \"\")\n\t\t\t\t\t\t\t+ \"<br>Fully skipped for unknown reason: \" + (data['fullSkip'] || \"\")\n\t\t\t\t\t\t\t+ \"<br>Some definitions skipped for unknown reason: \" + (data['partSkip'] || \"\")\n\t\t\t\t\t\t\t+ \"<br>Some definitions missing vital data: \" + (data['partMissing'] || \"\")\n\t\t\t\t\t\t\t+ \"<br>Already Existed: \" + (data['exists'] || \"\")\n\t\t\t\t\t\t\t+ \"<br>Connection error: \" + (data[\"noCon\"] || \"\")\n\t\t\t\t\t\t\t+ \"<br>Canceled: \" + (data['canceled'] || \"\"));\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// show the first instance of the word in context\n\t\t\t\t\tmoveContext(0);\n\t\t\t\t\t\n\t\t\t\t\tfinishProcessingPDF();\n\t\t\t\t\t\n\t\t\t\t}, \"json\").fail(function(){\n\t\t\t\t\t\t// called after a fatal error\n\t\t\t\t\t\tprogress.text(\"Network or Internal Error while connecting to server. Check with the developers!\");\n\t\t\t\t\t\tfinishProcessingPDF();\n\t\t\t\t\t});\n\t\t\n\t\t// start allowing cancelation\n\t\t$(\"#cancelUploadButton\").show();\n\t\t\n\t\t// start updating the progress bar\n\t\tprogressTimer = setInterval(function() {\n\t\t\t$.get(\"backend.php\",\n\t\t\t\t\t{'loginInfo': {\"allowed\": true, 'user': 'me'}, \"progress\": true},\n\t\t\t\t\tfunction(data, status, jqXHR) {\n\t\t\t\t\t\tvar output = data['progress'];\n\t\t\t\t\t\tif(!output || output[\"position\"] < maxProgress) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmaxProgress = output[\"position\"];\n\t\t\t\t\t\tprogress.text(\"Adding definition: \" + output[\"position\"] + \" / \" + output['length']);\n\t\t\t\t\t}, \"json\");\n\t\t}, 1000);\n\t});\n}", "static mapDocument(document) {\n if (!document.exists) {\n return null;\n }\n\n const item = Object.assign({}, document.data(), {\n id: document.id,\n });\n\n this.replaceAllTimestampToDate(item);\n\n return item;\n }", "function onDocumentSaved(event, document) {\n\n\t\t// check if the document was truly saved\n\t\tif (document.file.isDirty) {\n\t\t\treturn;\n\t\t}\n\n\t\t// check if it was a .less document\n\t\tvar path = document.file.fullPath;\n\t\tif (path.substr(path.length - 5, 5) === \".less\") {\n\n\t\t\t// connect to the node server\n\t\t\tloadNodeModule(\"LessCompiler\", function (err, compiler) {\n\t\t\t\tif (err) {\n\t\t\t\t\tconsole.error(err);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcompiler.compile(path).done(onCompileSuccess).fail(onCompileError);\n\t\t\t});\n\n\t\t}\n\t}", "function enqueueDocument(doc, cb) {\n var message = {\n \"requestType\": constants.queues.action.GET_DOCUMENT,\n \"data\": {\n \"docId\": doc.docId,\n \"sourceId\": doc.sourceId\n }\n };\n\n return queueOut.sendMessage(message, function (err) {\n if (error) {\n console.error('There was an error queuing a document.');\n return cb(err);\n }\n\n // Test Dependency:\n // The following message is used as part of E2E testing\n console.info('Queued document %s from source %s', doc.docId, doc.sourceId)\n return cb();\n });\n }", "function parseDoc(doc, newEdits) {\n\n var nRevNum;\n var newRevId;\n var revInfo;\n var opts = {status: 'available'};\n if (doc._deleted) {\n opts.deleted = true;\n }\n\n if (newEdits) {\n if (!doc._id) {\n doc._id = uuid();\n }\n newRevId = uuid(32, 16).toLowerCase();\n if (doc._rev) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n doc._rev_tree = [{\n pos: revInfo.prefix,\n ids: [revInfo.id, {status: 'missing'}, [[newRevId, opts, []]]]\n }];\n nRevNum = revInfo.prefix + 1;\n } else {\n doc._rev_tree = [{\n pos: 1,\n ids : [newRevId, opts, []]\n }];\n nRevNum = 1;\n }\n } else {\n if (doc._revisions) {\n doc._rev_tree = makeRevTreeFromRevisions(doc._revisions, opts);\n nRevNum = doc._revisions.start;\n newRevId = doc._revisions.ids[0];\n }\n if (!doc._rev_tree) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n nRevNum = revInfo.prefix;\n newRevId = revInfo.id;\n doc._rev_tree = [{\n pos: nRevNum,\n ids: [newRevId, opts, []]\n }];\n }\n }\n\n invalidIdError(doc._id);\n\n doc._rev = nRevNum + '-' + newRevId;\n\n var result = {metadata : {}, data : {}};\n for (var key in doc) {\n /* istanbul ignore else */\n if (Object.prototype.hasOwnProperty.call(doc, key)) {\n var specialKey = key[0] === '_';\n if (specialKey && !reservedWords[key]) {\n var error = createError(DOC_VALIDATION, key);\n error.message = DOC_VALIDATION.message + ': ' + key;\n throw error;\n } else if (specialKey && !dataWords[key]) {\n result.metadata[key.slice(1)] = doc[key];\n } else {\n result.data[key] = doc[key];\n }\n }\n }\n return result;\n}", "function parseDoc(doc, newEdits) {\n\n var nRevNum;\n var newRevId;\n var revInfo;\n var opts = {status: 'available'};\n if (doc._deleted) {\n opts.deleted = true;\n }\n\n if (newEdits) {\n if (!doc._id) {\n doc._id = uuid();\n }\n newRevId = uuid(32, 16).toLowerCase();\n if (doc._rev) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n doc._rev_tree = [{\n pos: revInfo.prefix,\n ids: [revInfo.id, {status: 'missing'}, [[newRevId, opts, []]]]\n }];\n nRevNum = revInfo.prefix + 1;\n } else {\n doc._rev_tree = [{\n pos: 1,\n ids : [newRevId, opts, []]\n }];\n nRevNum = 1;\n }\n } else {\n if (doc._revisions) {\n doc._rev_tree = makeRevTreeFromRevisions(doc._revisions, opts);\n nRevNum = doc._revisions.start;\n newRevId = doc._revisions.ids[0];\n }\n if (!doc._rev_tree) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n nRevNum = revInfo.prefix;\n newRevId = revInfo.id;\n doc._rev_tree = [{\n pos: nRevNum,\n ids: [newRevId, opts, []]\n }];\n }\n }\n\n invalidIdError(doc._id);\n\n doc._rev = nRevNum + '-' + newRevId;\n\n var result = {metadata : {}, data : {}};\n for (var key in doc) {\n /* istanbul ignore else */\n if (Object.prototype.hasOwnProperty.call(doc, key)) {\n var specialKey = key[0] === '_';\n if (specialKey && !reservedWords[key]) {\n var error = createError(DOC_VALIDATION, key);\n error.message = DOC_VALIDATION.message + ': ' + key;\n throw error;\n } else if (specialKey && !dataWords[key]) {\n result.metadata[key.slice(1)] = doc[key];\n } else {\n result.data[key] = doc[key];\n }\n }\n }\n return result;\n}", "function parseDoc(doc, newEdits) {\n\n var nRevNum;\n var newRevId;\n var revInfo;\n var opts = {status: 'available'};\n if (doc._deleted) {\n opts.deleted = true;\n }\n\n if (newEdits) {\n if (!doc._id) {\n doc._id = uuid();\n }\n newRevId = uuid(32, 16).toLowerCase();\n if (doc._rev) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n doc._rev_tree = [{\n pos: revInfo.prefix,\n ids: [revInfo.id, {status: 'missing'}, [[newRevId, opts, []]]]\n }];\n nRevNum = revInfo.prefix + 1;\n } else {\n doc._rev_tree = [{\n pos: 1,\n ids : [newRevId, opts, []]\n }];\n nRevNum = 1;\n }\n } else {\n if (doc._revisions) {\n doc._rev_tree = makeRevTreeFromRevisions(doc._revisions, opts);\n nRevNum = doc._revisions.start;\n newRevId = doc._revisions.ids[0];\n }\n if (!doc._rev_tree) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n nRevNum = revInfo.prefix;\n newRevId = revInfo.id;\n doc._rev_tree = [{\n pos: nRevNum,\n ids: [newRevId, opts, []]\n }];\n }\n }\n\n invalidIdError(doc._id);\n\n doc._rev = nRevNum + '-' + newRevId;\n\n var result = {metadata : {}, data : {}};\n for (var key in doc) {\n /* istanbul ignore else */\n if (Object.prototype.hasOwnProperty.call(doc, key)) {\n var specialKey = key[0] === '_';\n if (specialKey && !reservedWords[key]) {\n var error = createError(DOC_VALIDATION, key);\n error.message = DOC_VALIDATION.message + ': ' + key;\n throw error;\n } else if (specialKey && !dataWords[key]) {\n result.metadata[key.slice(1)] = doc[key];\n } else {\n result.data[key] = doc[key];\n }\n }\n }\n return result;\n}", "function parseDoc(doc, newEdits) {\n\n var nRevNum;\n var newRevId;\n var revInfo;\n var opts = {status: 'available'};\n if (doc._deleted) {\n opts.deleted = true;\n }\n\n if (newEdits) {\n if (!doc._id) {\n doc._id = uuid();\n }\n newRevId = uuid(32, 16).toLowerCase();\n if (doc._rev) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n doc._rev_tree = [{\n pos: revInfo.prefix,\n ids: [revInfo.id, {status: 'missing'}, [[newRevId, opts, []]]]\n }];\n nRevNum = revInfo.prefix + 1;\n } else {\n doc._rev_tree = [{\n pos: 1,\n ids : [newRevId, opts, []]\n }];\n nRevNum = 1;\n }\n } else {\n if (doc._revisions) {\n doc._rev_tree = makeRevTreeFromRevisions(doc._revisions, opts);\n nRevNum = doc._revisions.start;\n newRevId = doc._revisions.ids[0];\n }\n if (!doc._rev_tree) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n nRevNum = revInfo.prefix;\n newRevId = revInfo.id;\n doc._rev_tree = [{\n pos: nRevNum,\n ids: [newRevId, opts, []]\n }];\n }\n }\n\n invalidIdError(doc._id);\n\n doc._rev = nRevNum + '-' + newRevId;\n\n var result = {metadata : {}, data : {}};\n for (var key in doc) {\n /* istanbul ignore else */\n if (Object.prototype.hasOwnProperty.call(doc, key)) {\n var specialKey = key[0] === '_';\n if (specialKey && !reservedWords[key]) {\n var error = createError(DOC_VALIDATION, key);\n error.message = DOC_VALIDATION.message + ': ' + key;\n throw error;\n } else if (specialKey && !dataWords[key]) {\n result.metadata[key.slice(1)] = doc[key];\n } else {\n result.data[key] = doc[key];\n }\n }\n }\n return result;\n}", "function parseDoc(doc, newEdits) {\n\n var nRevNum;\n var newRevId;\n var revInfo;\n var opts = {status: 'available'};\n if (doc._deleted) {\n opts.deleted = true;\n }\n\n if (newEdits) {\n if (!doc._id) {\n doc._id = uuid();\n }\n newRevId = uuid(32, 16).toLowerCase();\n if (doc._rev) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n doc._rev_tree = [{\n pos: revInfo.prefix,\n ids: [revInfo.id, {status: 'missing'}, [[newRevId, opts, []]]]\n }];\n nRevNum = revInfo.prefix + 1;\n } else {\n doc._rev_tree = [{\n pos: 1,\n ids : [newRevId, opts, []]\n }];\n nRevNum = 1;\n }\n } else {\n if (doc._revisions) {\n doc._rev_tree = makeRevTreeFromRevisions(doc._revisions, opts);\n nRevNum = doc._revisions.start;\n newRevId = doc._revisions.ids[0];\n }\n if (!doc._rev_tree) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n nRevNum = revInfo.prefix;\n newRevId = revInfo.id;\n doc._rev_tree = [{\n pos: nRevNum,\n ids: [newRevId, opts, []]\n }];\n }\n }\n\n invalidIdError(doc._id);\n\n doc._rev = nRevNum + '-' + newRevId;\n\n var result = {metadata : {}, data : {}};\n for (var key in doc) {\n /* istanbul ignore else */\n if (Object.prototype.hasOwnProperty.call(doc, key)) {\n var specialKey = key[0] === '_';\n if (specialKey && !reservedWords[key]) {\n var error = createError(DOC_VALIDATION, key);\n error.message = DOC_VALIDATION.message + ': ' + key;\n throw error;\n } else if (specialKey && !dataWords[key]) {\n result.metadata[key.slice(1)] = doc[key];\n } else {\n result.data[key] = doc[key];\n }\n }\n }\n return result;\n}", "function parseDoc(doc, newEdits) {\n\n var nRevNum;\n var newRevId;\n var revInfo;\n var opts = {status: 'available'};\n if (doc._deleted) {\n opts.deleted = true;\n }\n\n if (newEdits) {\n if (!doc._id) {\n doc._id = uuid();\n }\n newRevId = uuid(32, 16).toLowerCase();\n if (doc._rev) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n doc._rev_tree = [{\n pos: revInfo.prefix,\n ids: [revInfo.id, {status: 'missing'}, [[newRevId, opts, []]]]\n }];\n nRevNum = revInfo.prefix + 1;\n } else {\n doc._rev_tree = [{\n pos: 1,\n ids : [newRevId, opts, []]\n }];\n nRevNum = 1;\n }\n } else {\n if (doc._revisions) {\n doc._rev_tree = makeRevTreeFromRevisions(doc._revisions, opts);\n nRevNum = doc._revisions.start;\n newRevId = doc._revisions.ids[0];\n }\n if (!doc._rev_tree) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n nRevNum = revInfo.prefix;\n newRevId = revInfo.id;\n doc._rev_tree = [{\n pos: nRevNum,\n ids: [newRevId, opts, []]\n }];\n }\n }\n\n invalidIdError(doc._id);\n\n doc._rev = nRevNum + '-' + newRevId;\n\n var result = {metadata : {}, data : {}};\n for (var key in doc) {\n /* istanbul ignore else */\n if (Object.prototype.hasOwnProperty.call(doc, key)) {\n var specialKey = key[0] === '_';\n if (specialKey && !reservedWords[key]) {\n var error = createError(DOC_VALIDATION, key);\n error.message = DOC_VALIDATION.message + ': ' + key;\n throw error;\n } else if (specialKey && !dataWords[key]) {\n result.metadata[key.slice(1)] = doc[key];\n } else {\n result.data[key] = doc[key];\n }\n }\n }\n return result;\n}", "function DbRemoteDocument(\n /**\r\n * Set to an instance of DbUnknownDocument if the data for a document is\r\n * not known, but it is known that a document exists at the specified\r\n * version (e.g. it had a successful update applied to it)\r\n */\n unknownDocument,\n /**\r\n * Set to an instance of a DbNoDocument if it is known that no document\r\n * exists.\r\n */\n noDocument,\n /**\r\n * Set to an instance of a Document if there's a cached version of the\r\n * document.\r\n */\n document,\n /**\r\n * Documents that were written to the remote document store based on\r\n * a write acknowledgment are marked with `hasCommittedMutations`. These\r\n * documents are potentially inconsistent with the backend's copy and use\r\n * the write's commit version as their document version.\r\n */\n hasCommittedMutations,\n /**\r\n * When the document was read from the backend. Undefined for data written\r\n * prior to schema version 9.\r\n */\n readTime,\n /**\r\n * The path of the collection this document is part of. Undefined for data\r\n * written prior to schema version 9.\r\n */\n parentPath) {\n this.unknownDocument = unknownDocument;\n this.noDocument = noDocument;\n this.document = document;\n this.hasCommittedMutations = hasCommittedMutations;\n this.readTime = readTime;\n this.parentPath = parentPath;\n }", "function sync() {\n syncDocuments({\n uri: {\n fsPath: path.join(rootPath, dir)\n }\n });\n }", "function DocumentCreated(doc) {\n ReceiveUpdate(doc);\n}", "static createDocumentWithBlob(parentDoc, docParams, file) {\n\n let properties = this.properties;\n\n return new Promise(\n function(resolve, reject) {\n\n let uploadedBlob = null;\n\n // If file not empty, process blob and upload\n if (file) {\n let blob = new Nuxeo.Blob({\n content: file,\n name: file.name,\n mimeType: file.type,\n size: file.size\n });\n\n properties.client\n .batchUpload()\n .upload(blob)\n .then((res) => {\n if (res) {\n // Create document\n properties.client\n .operation('Document.Create')\n .params(docParams)\n .input(parentDoc)\n .execute()\n .then((newDoc) => {\n // If blob uploaded, attach to created document\n if (res != null) {\n properties.client.operation('Blob.AttachOnDocument')\n .param('document', newDoc.uid)\n .input(res.blob)\n .execute({ schemas: ['dublincore', 'file']});\n\n // Finally, resolve create document\n resolve(newDoc);\n }\n })\n .catch((error) => { reject('Could not create document.'); } );\n } else {\n reject('No ' + type +' found');\n }\n }).catch((error) => { reject('Could not upload file.'); } );\n }\n });\n }", "function vlerDasDocumentToVPR(document, fullHtml, vlerDocType, requestStampTime, compressed) {\n var vprVlerDocument = {};\n vprVlerDocument.kind = vlerDocType;\n vprVlerDocument.name = _.get(document, 'resource.description');\n vprVlerDocument.uid = document.uid;\n vprVlerDocument.summary = _.get(document, 'resource.description');\n vprVlerDocument.pid = document.pid;\n vprVlerDocument.documentUniqueId = _.get(document, 'resource.masterIdentifier.Value');\n vprVlerDocument.homeCommunityId = _.get(document, 'resource.masterIdentifier.system');\n vprVlerDocument.stampTime = requestStampTime;\n vprVlerDocument.fullHtml = fullHtml;\n if (compressed) {\n vprVlerDocument.compressed = compressed;\n }\n\n //Drop timezone offset from creationTime\n let creationTimeWithOffset = _.get(document, 'resource.created', '');\n vprVlerDocument.creationTime = moment(creationTimeWithOffset, 'YYYYMMDDHHmmss[ZZ]').format('YYYYMMDDHHmmss');\n\n vprVlerDocument.authorList = getAuthorListFromFHIRContainedResources(document);\n\n return vprVlerDocument;\n}", "function docTrack() {\n var response = {};\n // If a new doc is loaded\n if (getFileId() != currentDoc) {\n currentDoc = getFileId();\n currentTags = getTags();\n response['doc_load'] = true;\n response['status'] = getTags();\n response['file_id'] = getFileId();\n response['timestamp'] = new Date().getTime();\n response['project_id'] = getProjectId();\n } else {\n // If there is no change in the doc tags\n if (currentTags === getTags()) {\n // do nothing if tags don't change\n } else {\n // Else the document is the same but the tags have changed\n\n // variables to store tag changes\n var tag_added = [];\n var tag_removed = [];\n\n // Compares the tags on the doc to the last recorded set of tags for this doc to find what tags were added\n getTags().filter(function(tag) {\n if (currentTags.indexOf(tag) < 0) {\n tag_added.push(tag);\n }\n });\n\n // Compares the last recorded tags for this doc to the tags on the doc to find what tags were removed \n currentTags.filter(function(tag){\n if (getTags().indexOf(tag) < 0) {\n tag_removed.push(tag);\n }\n });\n\n // Logs what tags were added/removed\n if (tag_added.length > 0) {\n response['tag_added'] = tag_added;\n };\n\n if (tag_removed.length > 0) {\n response['tag_removed'] = tag_removed;\n };\n\n response['status'] = getTags();\n response['file_id'] = getFileId();\n response['timestamp'] = new Date().getTime();\n response['project_id'] = getProjectId();\n };\n };\n if (response.hasOwnProperty('file_id') > 0) {\n storeLog(JSON.stringify(response));\n console.log(JSON.stringify(response));\n }\n currentTags = getTags();\n}", "textDocumentDidChange(params) {\n return __awaiter(this, void 0, void 0, function* () {\n const uri = util_1.normalizeUri(params.textDocument.uri);\n let text;\n for (const change of params.contentChanges) {\n if (change.range || change.rangeLength) {\n throw new Error('incremental updates in textDocument/didChange not supported for file ' + uri);\n }\n text = change.text;\n }\n if (!text) {\n return;\n }\n this.projectManager.didChange(uri, text);\n yield new Promise(resolve => setTimeout(resolve, 200));\n this._publishDiagnostics(uri);\n });\n }", "function parseDoc(doc, newEdits) {\n\t\n\t var nRevNum;\n\t var newRevId;\n\t var revInfo;\n\t var opts = {status: 'available'};\n\t if (doc._deleted) {\n\t opts.deleted = true;\n\t }\n\t\n\t if (newEdits) {\n\t if (!doc._id) {\n\t doc._id = uuid();\n\t }\n\t newRevId = uuid(32, 16).toLowerCase();\n\t if (doc._rev) {\n\t revInfo = parseRevisionInfo(doc._rev);\n\t if (revInfo.error) {\n\t return revInfo;\n\t }\n\t doc._rev_tree = [{\n\t pos: revInfo.prefix,\n\t ids: [revInfo.id, {status: 'missing'}, [[newRevId, opts, []]]]\n\t }];\n\t nRevNum = revInfo.prefix + 1;\n\t } else {\n\t doc._rev_tree = [{\n\t pos: 1,\n\t ids : [newRevId, opts, []]\n\t }];\n\t nRevNum = 1;\n\t }\n\t } else {\n\t if (doc._revisions) {\n\t doc._rev_tree = makeRevTreeFromRevisions(doc._revisions, opts);\n\t nRevNum = doc._revisions.start;\n\t newRevId = doc._revisions.ids[0];\n\t }\n\t if (!doc._rev_tree) {\n\t revInfo = parseRevisionInfo(doc._rev);\n\t if (revInfo.error) {\n\t return revInfo;\n\t }\n\t nRevNum = revInfo.prefix;\n\t newRevId = revInfo.id;\n\t doc._rev_tree = [{\n\t pos: nRevNum,\n\t ids: [newRevId, opts, []]\n\t }];\n\t }\n\t }\n\t\n\t invalidIdError(doc._id);\n\t\n\t doc._rev = nRevNum + '-' + newRevId;\n\t\n\t var result = {metadata : {}, data : {}};\n\t for (var key in doc) {\n\t /* istanbul ignore else */\n\t if (Object.prototype.hasOwnProperty.call(doc, key)) {\n\t var specialKey = key[0] === '_';\n\t if (specialKey && !reservedWords[key]) {\n\t var error = createError(DOC_VALIDATION, key);\n\t error.message = DOC_VALIDATION.message + ': ' + key;\n\t throw error;\n\t } else if (specialKey && !dataWords[key]) {\n\t result.metadata[key.slice(1)] = doc[key];\n\t } else {\n\t result.data[key] = doc[key];\n\t }\n\t }\n\t }\n\t return result;\n\t}", "function analyze_document(document) {\n add_form_buttons(document);\n document_submit_catcher(document);\n }", "function UploadProcess(serverIP, fileName, dbObj) {\r\n\r\n\t// Delete the doc before insert\r\n\tDBOperationRemoveDocByNode(serverIP, fileName, dbObj);\r\n\r\n\t// Parse the doc to MongoD\r\n\tDBOperationParseETLToMongoD(serverIP, fileName, dbObj);\r\n\r\n\t//Query count\r\n\t//DBOperationFindDoc(serverIP, fileName, dbObj);\r\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 }", "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 tryUpdate(document) {\r\n\r\n // DocumentDB supports optimistic concurrency control via HTTP ETag.\r\n var requestOptions = {etag: document._etag};\r\n\r\n // Update operators.\r\n inc(document, update);\r\n mul(document, update);\r\n rename(document, update);\r\n set(document, update);\r\n unset(document, update);\r\n min(document, update);\r\n max(document, update);\r\n currentDate(document, update);\r\n addToSet(document, update);\r\n pop(document, update);\r\n push(document, update);\r\n\r\n // Update the document.\r\n var isAccepted = collection.replaceDocument(document._self, document, requestOptions, function (err, updatedDocument, responseOptions) {\r\n if (err) throw err;\r\n\r\n // If we have successfully updated the document - return it in the response body.\r\n response.setBody(updatedDocument);\r\n });\r\n\r\n // If we hit execution bounds - throw an exception.\r\n if (!isAccepted) {\r\n throw new Error(\"The stored procedure timed out.\");\r\n }\r\n }", "ProcessDocChanges(documents) {\n // process document changes to build a list of documents for us to fetch in batches\n const docRequest = [];\n\n documents.forEach((doc) => {\n if (doc.deleted) {\n // TODO - remove document from database?\n\n // emit document deleted event\n this.emit('deleted', doc);\n } else if (doc.changes !== undefined && doc.changes.length) {\n let AlreadyHaveChange = false;\n docRequest.forEach((docRequested) => {\n if (docRequested.id === doc.id) {\n AlreadyHaveChange = true;\n\n // compare revision numbers\n if (RevisionToInt(doc.changes[0].rev) > RevisionToInt(docRequested.rev)) {\n // if this revision is greater than our existing one, replace\n docRequested.rev = doc.changes[0].rev;\n }\n\n // don't break out of for-loop in case there are even more revision in the changelist\n }\n });\n\n // push new change if we haven't already got one for this document ID in our list\n if (!AlreadyHaveChange) {\n docRequest.push({\n atts_since: null,\n rev: doc.changes[0].rev,\n id: doc.id,\n });\n }\n }\n });\n\n if (docRequest.length === 0) {\n this.Log('Extracted 0 document changes, skipping fetch');\n\n return Promise.resolve();\n }\n this.Log(`Extracted ${docRequest.length} document changes to fetch`);\n\n // filter out document revisions we already have\n return this.FilterAlreadyGotRevisions(docRequest).then((filteredDocRequest) => {\n this.Log(`After filtering on already-got revisions, left with ${filteredDocRequest.length} documents to fetch`);\n\n // split document requests into batches of docFetchBatchSize size\n const batches = [];\n while (filteredDocRequest.length > 0) {\n batches.push(filteredDocRequest.splice(0, Math.min(docFetchBatchSize, filteredDocRequest.length)));\n }\n\n this.Log(`Split document changes into ${batches.length} batches`);\n\n // resolve promises with each batch in order\n return batches.reduce((prev, cur) => prev.then(() => this.ProcessDocChangeBatch(cur)), Promise.resolve()).then(() => Promise.resolve());\n });\n }", "trackOpenedDocument(document) {\n let uri = document.uri;\n let item = this.map.get(uri);\n if (item) {\n let fileChanged = document.version > item.version;\n item.document = document;\n item.version = document.version;\n item.opened = true;\n if (fileChanged) {\n this.makeFileExpire(uri, item);\n }\n }\n else {\n item = {\n document,\n version: document.version,\n opened: true,\n fresh: false,\n updatePromise: null\n };\n this.map.set(uri, item);\n this.afterTrackedFile(uri, item);\n }\n }", "function handlePOObject(filename, po) {\n // Remove previous results\n $(\"#results\").empty();\n // Go through PO file and try to auto-translate untranslated strings.\n let newPO = handleTranslations(po);\n let autoTranslatedCount = newPO.translations[''].length;\n $(\"#progressMsg\").text(`Auto-translated ${autoTranslatedCount} strings`)\n // Export to new PO\n downloadFile(new POExporter(newPO).compile(),\n filename + \".translated.po\",\n 'text/x-gettext-translation')\n}", "function parseDoc(doc, newEdits) {\n\n var nRevNum;\n var newRevId;\n var revInfo;\n var opts = {status: 'available'};\n if (doc._deleted) {\n opts.deleted = true;\n }\n\n if (newEdits) {\n if (!doc._id) {\n doc._id = uuid();\n }\n newRevId = rev();\n if (doc._rev) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n doc._rev_tree = [{\n pos: revInfo.prefix,\n ids: [revInfo.id, {status: 'missing'}, [[newRevId, opts, []]]]\n }];\n nRevNum = revInfo.prefix + 1;\n } else {\n doc._rev_tree = [{\n pos: 1,\n ids : [newRevId, opts, []]\n }];\n nRevNum = 1;\n }\n } else {\n if (doc._revisions) {\n doc._rev_tree = makeRevTreeFromRevisions(doc._revisions, opts);\n nRevNum = doc._revisions.start;\n newRevId = doc._revisions.ids[0];\n }\n if (!doc._rev_tree) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n nRevNum = revInfo.prefix;\n newRevId = revInfo.id;\n doc._rev_tree = [{\n pos: nRevNum,\n ids: [newRevId, opts, []]\n }];\n }\n }\n\n invalidIdError(doc._id);\n\n doc._rev = nRevNum + '-' + newRevId;\n\n var result = {metadata : {}, data : {}};\n for (var key in doc) {\n /* istanbul ignore else */\n if (Object.prototype.hasOwnProperty.call(doc, key)) {\n var specialKey = key[0] === '_';\n if (specialKey && !reservedWords[key]) {\n var error = createError(DOC_VALIDATION, key);\n error.message = DOC_VALIDATION.message + ': ' + key;\n throw error;\n } else if (specialKey && !dataWords[key]) {\n result.metadata[key.slice(1)] = doc[key];\n } else {\n result.data[key] = doc[key];\n }\n }\n }\n return result;\n}", "function parseDoc(doc, newEdits) {\n\n var nRevNum;\n var newRevId;\n var revInfo;\n var opts = {status: 'available'};\n if (doc._deleted) {\n opts.deleted = true;\n }\n\n if (newEdits) {\n if (!doc._id) {\n doc._id = uuid();\n }\n newRevId = rev();\n if (doc._rev) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n doc._rev_tree = [{\n pos: revInfo.prefix,\n ids: [revInfo.id, {status: 'missing'}, [[newRevId, opts, []]]]\n }];\n nRevNum = revInfo.prefix + 1;\n } else {\n doc._rev_tree = [{\n pos: 1,\n ids : [newRevId, opts, []]\n }];\n nRevNum = 1;\n }\n } else {\n if (doc._revisions) {\n doc._rev_tree = makeRevTreeFromRevisions(doc._revisions, opts);\n nRevNum = doc._revisions.start;\n newRevId = doc._revisions.ids[0];\n }\n if (!doc._rev_tree) {\n revInfo = parseRevisionInfo(doc._rev);\n if (revInfo.error) {\n return revInfo;\n }\n nRevNum = revInfo.prefix;\n newRevId = revInfo.id;\n doc._rev_tree = [{\n pos: nRevNum,\n ids: [newRevId, opts, []]\n }];\n }\n }\n\n invalidIdError(doc._id);\n\n doc._rev = nRevNum + '-' + newRevId;\n\n var result = {metadata : {}, data : {}};\n for (var key in doc) {\n /* istanbul ignore else */\n if (Object.prototype.hasOwnProperty.call(doc, key)) {\n var specialKey = key[0] === '_';\n if (specialKey && !reservedWords[key]) {\n var error = createError(DOC_VALIDATION, key);\n error.message = DOC_VALIDATION.message + ': ' + key;\n throw error;\n } else if (specialKey && !dataWords[key]) {\n result.metadata[key.slice(1)] = doc[key];\n } else {\n result.data[key] = doc[key];\n }\n }\n }\n return result;\n}", "analyzeIdDocumentAsync(...args) {\n let operationSpec;\n let operationArguments;\n if (args[0] === \"application/pdf\" ||\n args[0] === \"image/bmp\" ||\n args[0] === \"image/jpeg\" ||\n args[0] === \"image/png\" ||\n args[0] === \"image/tiff\") {\n operationSpec = analyzeIdDocumentAsync$binaryOperationSpec;\n operationArguments = {\n contentType: args[0],\n fileStream: args[1],\n options: args[2]\n };\n }\n else if (args[0] === \"application/json\") {\n operationSpec = analyzeIdDocumentAsync$jsonOperationSpec;\n operationArguments = { contentType: args[0], options: args[1] };\n }\n else {\n throw new TypeError(`\"contentType\" must be a valid value but instead was \"${args[0]}\".`);\n }\n operationArguments.options = coreHttp.operationOptionsToRequestOptionsBase(operationArguments.options || {});\n return this.sendOperationRequest(operationArguments, operationSpec);\n }" ]
[ "0.7181942", "0.7127588", "0.70959693", "0.70959693", "0.65708774", "0.6547708", "0.6525776", "0.6525776", "0.6525776", "0.6525776", "0.6525776", "0.6525776", "0.6501485", "0.6501485", "0.5860337", "0.5381363", "0.5375347", "0.5256774", "0.51226515", "0.5107933", "0.5096684", "0.5060206", "0.5046778", "0.50458974", "0.503016", "0.50060505", "0.49973467", "0.49815354", "0.4981061", "0.49802542", "0.4967383", "0.49577615", "0.49431437", "0.49202743", "0.49179572", "0.48932502", "0.4891498", "0.48820072", "0.48719203", "0.48719203", "0.4861216", "0.4813331", "0.4813331", "0.4813331", "0.4810611", "0.47981927", "0.47830066", "0.47830066", "0.47830066", "0.47830066", "0.47830066", "0.47768676", "0.47724873", "0.47676948", "0.47647727", "0.47639424", "0.4749704", "0.47471875", "0.47403315", "0.47389448", "0.47183657", "0.47112438", "0.46860117", "0.46746454", "0.46702507", "0.46548524", "0.46444878", "0.46291605", "0.46221146", "0.461505", "0.461505", "0.461505", "0.461505", "0.461505", "0.461505", "0.46050164", "0.4598999", "0.45975494", "0.45965055", "0.4590626", "0.45860797", "0.4585784", "0.4565578", "0.45579535", "0.455658", "0.4550874", "0.4550874", "0.4550874", "0.45370236", "0.45363483", "0.4535242", "0.45316547", "0.45304587", "0.45304587", "0.45222878" ]
0.7046547
8
Check if `func` is a constructor.
function newable(value) { return typeof value === 'function' && keys(value.prototype) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isConstructor(name, func) {\n return name[0] == name[0].toUpperCase();\n }", "function isCtor(constr) {\n return constr && !!constr.CONSTRUCTOR___;\n }", "function IsConstructor(o) {\n // Hacks for Safari 7 TypedArray XXXConstructor objects\n if (/Constructor/.test(Object.prototype.toString.call(o))) return true;\n if (/Function/.test(Object.prototype.toString.call(o))) return true;\n // TODO: Can this be improved on?\n return typeof o === 'function';\n }", "function isConstructor(node) {\n var _a;\n return (((_a = node) === null || _a === void 0 ? void 0 : _a.type) === experimental_utils_1.AST_NODE_TYPES.MethodDefinition &&\n node.kind === 'constructor');\n}", "function getConstructorClassCheck(obj) {\n var ctorStr = String(obj);\n return function(obj) {\n return String(obj.constructor) === ctorStr;\n };\n }", "function getConstructorClassCheck(obj) {\n var ctorStr = String(obj);\n return function(obj) {\n return String(obj.constructor) === ctorStr;\n };\n }", "function isConstructor(node) {\n return ((node === null || node === void 0 ? void 0 : node.type) === ts_estree_1.AST_NODE_TYPES.MethodDefinition &&\n node.kind === 'constructor');\n}", "function IsConstructor(argument) { // eslint-disable-line no-unused-vars\n\t// 1. If Type(argument) is not Object, return false.\n\tif (Type(argument) !== 'object') {\n\t\treturn false;\n\t}\n\t// 2. If argument has a [[Construct]] internal method, return true.\n\t// 3. Return false.\n\n\t// Polyfill.io - `new argument` is the only way to truly test if a function is a constructor.\n\t// We choose to not use`new argument` because the argument could have side effects when called.\n\t// Instead we check to see if the argument is a function and if it has a prototype.\n\t// Arrow functions do not have a [[Construct]] internal method, nor do they have a prototype.\n\treturn typeof argument === 'function' && !!argument.prototype;\n}", "static isConstructor(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.Constructor;\r\n }", "function IsConstructor(argument) { // eslint-disable-line no-unused-vars\n\t\t// 1. If Type(argument) is not Object, return false.\n\t\tif (Type(argument) !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\t// 2. If argument has a [[Construct]] internal method, return true.\n\t\t// 3. Return false.\n\n\t\t// Polyfill.io - `new argument` is the only way to truly test if a function is a constructor.\n\t\t// We choose to not use`new argument` because the argument could have side effects when called.\n\t\t// Instead we check to see if the argument is a function and if it has a prototype.\n\t\t// Arrow functions do not have a [[Construct]] internal method, nor do they have a prototype.\n\t\treturn typeof argument === 'function' && !!argument.prototype;\n\t}", "function IsConstructor(argument) { // eslint-disable-line no-unused-vars\n // 1. If Type(argument) is not Object, return false.\n if (Type(argument) !== 'object') {\n return false;\n }\n // 2. If argument has a [[Construct]] internal method, return true.\n // 3. Return false.\n\n // Polyfill.io - `new argument` is the only way to truly test if a function is a constructor.\n // We choose to not use`new argument` because the argument could have side effects when called.\n // Instead we check to see if the argument is a function and if it has a prototype.\n // Arrow functions do not have a [[Construct]] internal method, nor do they have a prototype.\n return typeof argument === 'function' && !!argument.prototype;\n }", "function asCtorOnly(constr) {\n if (isCtor(constr) || isFunc(constr)) {\n return constr;\n }\n enforceType(constr, 'function');\n fail(\"Untamed functions can't be called as constructors: \", constr);\n }", "function isConstructor(value) {\n if (typeof value !== \"function\") {\n return false;\n }\n\n try {\n const P = new Proxy(value, {\n construct() {\n return {};\n }\n });\n\n // eslint-disable-next-line no-new\n new P();\n\n return true;\n } catch {\n return false;\n }\n}", "function isConstructor(parent) {\n return (parent.type === typescript_estree_1.AST_NODE_TYPES.MethodDefinition &&\n parent.kind === 'constructor');\n }", "function isDirectInstanceOf(obj, ctor) {\n var constr = directConstructor(obj);\n if (constr === void 0) { return false; }\n return getFuncCategory(constr) === getFuncCategory(ctor);\n }", "function is_func(func) {\n return Object.prototype.toString.call(func) == \"[object Function]\";\n }", "function is_func(func) { return Object.prototype.toString.call(func) == \"[object Function]\"; }", "function isComponentConstructor(ctor) {\n if (!isFunction$1(ctor)) {\n return false;\n } // Fast path: LightningElement is part of the prototype chain of the constructor.\n\n\n if (ctor.prototype instanceof LightningElement) {\n return true;\n } // Slow path: LightningElement is not part of the prototype chain of the constructor, we need\n // climb up the constructor prototype chain to check in case there are circular dependencies\n // to resolve.\n\n\n let current = ctor;\n\n do {\n if (isCircularModuleDependency(current)) {\n const circularResolved = resolveCircularModuleDependency(current); // If the circular function returns itself, that's the signal that we have hit the end\n // of the proto chain, which must always be a valid base constructor.\n\n if (circularResolved === current) {\n return true;\n }\n\n current = circularResolved;\n }\n\n if (current === LightningElement) {\n return true;\n }\n } while (!isNull(current) && (current = getPrototypeOf$2(current))); // Finally return false if the LightningElement is not part of the prototype chain.\n\n\n return false;\n }", "function isComponentConstructor(ctor) {\n if (!isFunction(ctor)) {\n return false;\n } // Fast path: LightningElement is part of the prototype chain of the constructor.\n\n\n if (ctor.prototype instanceof BaseLightningElement) {\n return true;\n } // Slow path: LightningElement is not part of the prototype chain of the constructor, we need\n // climb up the constructor prototype chain to check in case there are circular dependencies\n // to resolve.\n\n\n let current = ctor;\n\n do {\n if (isCircularModuleDependency(current)) {\n const circularResolved = resolveCircularModuleDependency(current); // If the circular function returns itself, that's the signal that we have hit the end\n // of the proto chain, which must always be a valid base constructor.\n\n if (circularResolved === current) {\n return true;\n }\n\n current = circularResolved;\n }\n\n if (current === BaseLightningElement) {\n return true;\n }\n } while (!isNull(current) && (current = getPrototypeOf(current))); // Finally return false if the LightningElement is not part of the prototype chain.\n\n\n return false;\n }", "function isComponentConstructor$1(ctor) {\n if (!isFunction$2(ctor)) {\n return false;\n } // Fast path: LightningElement is part of the prototype chain of the constructor.\n\n\n if (ctor.prototype instanceof BaseLightningElement$1) {\n return true;\n } // Slow path: LightningElement is not part of the prototype chain of the constructor, we need\n // climb up the constructor prototype chain to check in case there are circular dependencies\n // to resolve.\n\n\n let current = ctor;\n\n do {\n if (isCircularModuleDependency$1(current)) {\n const circularResolved = resolveCircularModuleDependency$1(current); // If the circular function returns itself, that's the signal that we have hit the end of the proto chain,\n // which must always be a valid base constructor.\n\n if (circularResolved === current) {\n return true;\n }\n\n current = circularResolved;\n }\n\n if (current === BaseLightningElement$1) {\n return true;\n }\n } while (!isNull$1(current) && (current = getPrototypeOf$3(current))); // Finally return false if the LightningElement is not part of the prototype chain.\n\n\n return false;\n }", "function isFunction(func) {\n return (typeof func) === 'function';\n }", "function isFunc(cf) {\r\n return typeof cf === \"function\";\r\n}", "function isDelegateCtor(typeStr){return DELEGATE_CTOR.test(typeStr)||INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr)||INHERITED_CLASS.test(typeStr)&&!INHERITED_CLASS_WITH_CTOR.test(typeStr)}", "function isNative (Ctor) {\n return typeof Ctor === 'function' && /native code/.test(Ctor.toString())\n}", "function isNative (Ctor) {\n return typeof Ctor === 'function' && /native code/.test(Ctor.toString())\n}", "function isDelegateCtor(typeStr) {\n return ES5_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr);\n }", "function isFunction(func) {\n return (typeof func) === 'function';\n}", "function isFunction(func) {\n return (typeof func) === 'function';\n}", "function isDelegateCtor(typeStr) {\n return DELEGATE_CTOR.test(typeStr) || INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) || INHERITED_CLASS.test(typeStr) && !INHERITED_CLASS_WITH_CTOR.test(typeStr);\n }", "function isDelegateCtor(typeStr) {\n return DELEGATE_CTOR.test(typeStr) || INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) || INHERITED_CLASS.test(typeStr) && !INHERITED_CLASS_WITH_CTOR.test(typeStr);\n }", "function isDelegateCtor(typeStr) {\n return DELEGATE_CTOR.test(typeStr) || INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) || INHERITED_CLASS.test(typeStr) && !INHERITED_CLASS_WITH_CTOR.test(typeStr);\n }", "function isInstanceOf(victim, constructor) {\n return victim instanceof constructor;\n}", "function getType(ctor) {\r\n const match = ctor && ctor.toString().match(/^\\s*function (\\w+)/);\r\n return match ? match[1] : '';\r\n}", "function getType(ctor) {\r\n const match = ctor && ctor.toString().match(/^\\s*function (\\w+)/);\r\n return match ? match[1] : '';\r\n}", "function getType(ctor) {\r\n const match = ctor && ctor.toString().match(/^\\s*function (\\w+)/);\r\n return match ? match[1] : '';\r\n}", "function isSynthesizedConstructor(constructor) {\n if (!constructor.body)\n return false;\n const firstStatement = constructor.body.statements[0];\n if (!firstStatement || !ts.isExpressionStatement(firstStatement))\n return false;\n return isSynthesizedSuperCall(firstStatement.expression);\n}", "function isDelegateCtor(typeStr) {\n return ES5_DELEGATE_CTOR.test(typeStr) ||\n ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) ||\n (ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr));\n}", "function isDelegateCtor(typeStr) {\n return ES5_DELEGATE_CTOR.test(typeStr) ||\n ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) ||\n (ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr));\n}", "function isDelegateCtor(typeStr) {\n return ES5_DELEGATE_CTOR.test(typeStr) ||\n ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) ||\n (ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr));\n}", "function isDelegateCtor(typeStr) {\n return ES5_DELEGATE_CTOR.test(typeStr) ||\n ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) ||\n (ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr));\n}", "function isDelegateCtor(typeStr) {\n return ES5_DELEGATE_CTOR.test(typeStr) ||\n ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) ||\n (ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr));\n}", "function isDelegateCtor(typeStr) {\n return ES5_DELEGATE_CTOR.test(typeStr) ||\n ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) ||\n (ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr));\n}", "function isFunction(func) {\n return typeof func === \"function\";\n}", "function isDelegateCtor(typeStr) {\n return ES5_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr);\n}", "function getSuperCtor(func) {\n enforceType(func, 'function');\n if (isCtor(func) || isFunc(func)) {\n var result = directConstructor(func.prototype);\n if (isCtor(result) || isFunc(result)) {\n return result;\n }\n }\n return void 0;\n }", "function instanceOf(ctor) {\n // https://github.com/Microsoft/TypeScript/issues/5101#issuecomment-145693151\n return (function (x) { return x instanceof ctor; });\n}", "function getType(ctor) {\n const match = ctor && ctor.toString().match(/^\\s*function (\\w+)/);\n return match ? match[1] : '';\n}", "function getType(ctor) {\n const match = ctor && ctor.toString().match(/^\\s*function (\\w+)/);\n return match ? match[1] : '';\n}", "function getType(ctor) {\n const match = ctor && ctor.toString().match(/^\\s*function (\\w+)/);\n return match ? match[1] : '';\n}", "function isDelegateCtor(typeStr) {\n return DELEGATE_CTOR.test(typeStr) || INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) ||\n (INHERITED_CLASS.test(typeStr) && !INHERITED_CLASS_WITH_CTOR.test(typeStr));\n}", "function isDelegateCtor(typeStr) {\n return DELEGATE_CTOR.test(typeStr) || INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) ||\n (INHERITED_CLASS.test(typeStr) && !INHERITED_CLASS_WITH_CTOR.test(typeStr));\n}", "function isDelegateCtor(typeStr) {\n return DELEGATE_CTOR.test(typeStr) || INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) ||\n (INHERITED_CLASS.test(typeStr) && !INHERITED_CLASS_WITH_CTOR.test(typeStr));\n}", "function getType(ctor) {\n const match = ctor && ctor.toString().match(/^\\s*function (\\w+)/);\n return match ? match[1] : ctor === null ? 'null' : '';\n}", "function getType(ctor) {\n const match = ctor && ctor.toString().match(/^\\s*function (\\w+)/);\n return match ? match[1] : ctor === null ? 'null' : '';\n}", "function getType(ctor) {\n const match = ctor && ctor.toString().match(/^\\s*function (\\w+)/);\n return match ? match[1] : ctor === null ? 'null' : '';\n}", "function getType(ctor) {\n const match = ctor && ctor.toString().match(/^\\s*function (\\w+)/);\n return match ? match[1] : ctor === null ? 'null' : '';\n}", "function getType(ctor) {\n const match = ctor && ctor.toString().match(/^\\s*function (\\w+)/);\n return match ? match[1] : ctor === null ? 'null' : '';\n}", "function getType(ctor) {\n const match = ctor && ctor.toString().match(/^\\s*function (\\w+)/);\n return match ? match[1] : '';\n}", "function getType$1(ctor) {\n const match = ctor && ctor.toString().match(/^\\s*function (\\w+)/);\n return match ? match[1] : ctor === null ? 'null' : '';\n}", "function hasConstructor(obj) {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n\n return obj.constructor !== Object && obj.constructor !== Array;\n}", "function isClass(fn) {\n try {\n if (typeof fn === \"function\") {\n var keys = Object.getOwnPropertyNames(fn.prototype);\n\n let hasMethods = keys.length > 1;\n let hasMethodsOtherThanConstructor = keys.length > 0 && !(keys.length === 1 && keys[0] === 'constructor');\n let hasThisAssignmentAndStaticMethods = THIS_ASSIGNMENT_PATTERN.test(fn + \"\") && Object.getOwnPropertyNames(fn).length > 0;\n\n if (hasMethods || hasMethodsOtherThanConstructor ||\n hasThisAssignmentAndStaticMethods) {\n return true;\n }\n }\n return false;\n } catch (e) {\n return false;\n }\n}", "function isFunction(func)\n\t{\n//\t\t//trace(\"in isfunction parse with \" + func);\n\n\t\t// I believe switch ends up as a bunch of compares. Using a hash would probably be faster.\n\t\tswitch(func)\n\t\t{\n\t\t\tcase \"nroot\":\n\t\t\tcase \"mix\":\n\t\t\tcase \"sin\":\n\t\t\tcase \"cos\":\n\t\t\tcase \"tan\":\n\t\t\tcase \"cot\":\n\t\t\tcase \"sec\":\n\t\t\tcase \"csc\":\n\t\t\tcase \"pow\":\n\t\t\tcase \"sqrt\":\n\t\t\tcase \"sub\":\n\t\t\tcase \"abs\":\n\t\t\tcase \"div\":\n\t\t\tcase \"sigma\":\n\t\t\tcase \"log\":\n\t\t\tcase \"ln\":\n\t\t\t\treturn true;\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t}\n\t}", "function checkIfFunction(func) {\n return typeof func === \"function\";\n}", "function isFunc(f) {\n return typeof f === \"function\";\n}", "function isInstanceOf(obj, ctor) {\n if (obj instanceof ctor) { return true; }\n if (isDirectInstanceOf(obj, ctor)) { return true; }\n // BUG TODO(erights): walk prototype chain.\n // In the meantime, this will fail should it encounter a\n // cross-frame instance of a \"subclass\" of ctor.\n return false;\n }", "function isFunction(obj) {\n return typeof obj === \"function\";\n}", "function isFunction(obj) {\n return typeof obj === \"function\";\n}", "function isFunction(obj) {\n return typeof obj === 'function';\n}", "function isFunction(obj) {\n return typeof obj === 'function';\n}", "function isFunction( obj ){\n return Object.prototype.toString.call( obj ) == \"[object Function]\";\n }", "static isConstructorDeclarationOverload(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.ConstructorOverload;\r\n }", "function isFunction(fun) {\n return fun && {}.toString.call(fun) === '[object Function]';\n}", "function isFunction(obj) {\n return typeof obj === 'function';\n}", "function isFunction(obj) {\n return (typeof obj === \"function\");\n}", "function isFunction(obj) {\n return typeof obj === 'function';\n }", "function isFunction(obj) {\n return typeof obj === 'function';\n }", "function isFunction(object) { return typeof object === 'function'; }", "function markCtor(constr, opt_Sup, opt_name) {\n enforceType(constr, 'function', opt_name);\n if (isFunc(constr)) {\n fail(\"Simple functions can't be constructors: \", constr);\n }\n if (isXo4aFunc(constr)) {\n fail(\"Exophoric functions can't be constructors: \", constr);\n }\n constr.CONSTRUCTOR___ = true;\n if (opt_Sup) {\n derive(constr, opt_Sup);\n } else if (constr !== Object) {\n fail('Only \"Object\" has no super: ', constr);\n }\n if (opt_name) {\n constr.NAME___ = String(opt_name);\n }\n if (constr !== Object && constr !== Array) {\n // Iff constr is not Object nor Array, then any object inheriting from\n // constr.prototype is a constructed object which therefore tames to\n // itself by default. We do this with AS_TAMED___ and AS_FERAL___\n // methods on the prototype so it can be overridden either by overriding\n // these methods or by pre-taming with ___.tamesTo or ___.tamesToSelf.\n constr.prototype.AS_TAMED___ =\n constr.prototype.AS_FERAL___ = function() {\n return this;\n };\n }\n return constr; // translator freezes constructor later\n }", "function isFunction(obj) {\n return typeof obj === 'function';\n }", "function isFunction(obj) {\n return typeof obj === 'function';\n }", "function TestConstructor(type, lanes) {\n var simdFn = SIMD[type];\n var instance = createInstance(type);\n\n assertFalse(Object === simdFn.prototype.constructor)\n assertFalse(simdFn === Object.prototype.constructor)\n assertSame(simdFn, simdFn.prototype.constructor)\n\n assertSame(simdFn, instance.__proto__.constructor)\n assertSame(simdFn, Object(instance).__proto__.constructor)\n assertSame(simdFn.prototype, instance.__proto__)\n assertSame(simdFn.prototype, Object(instance).__proto__)\n}", "function isTypeResolver(\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfn) {\n // 1. A type provider must be a function\n if (typeof fn !== 'function')\n return false;\n // 2. A class constructor is not a type provider\n if (/^class/.test(fn.toString()))\n return false;\n // 3. Built-in types like Date & Array are not type providers\n if (isBuiltinType(fn))\n return false;\n // TODO(bajtos): support model classes defined via ES5 constructor function\n return true;\n}", "function asCtor(constr) {\n return primFreeze(asCtorOnly(constr));\n }", "function isFunction(obj) {\n return (typeof obj == \"function\");\n }", "function isFunction(input){return\"undefined\"!=typeof Function&&input instanceof Function||\"[object Function]\"===Object.prototype.toString.call(input)}", "static isFunctionLike(structure) {\r\n switch (structure.kind) {\r\n case StructureKind_1.StructureKind.Constructor:\r\n case StructureKind_1.StructureKind.GetAccessor:\r\n case StructureKind_1.StructureKind.Method:\r\n case StructureKind_1.StructureKind.SetAccessor:\r\n case StructureKind_1.StructureKind.Function:\r\n return true;\r\n default:\r\n return false;\r\n }\r\n }", "function isInstance(object, targetTypeConstructor) {\n return (targetTypeConstructor && typeof targetTypeConstructor === 'function' && object instanceof targetTypeConstructor);\n}", "function isFunc(it) {\n return it instanceof Function || typeof it === \"function\";\n }", "function isFunction(input) {\n return (\n typeof Function !== 'undefined' && input instanceof Function ||\n Object.prototype.toString.call(input) === '[object Function]');\n\n }", "function isClass(obj) {\n return isFunction(obj) && (obj.prototype && obj === obj.prototype.constructor);\n }", "function isFunction(input) {\n\t return (\n\t (typeof Function !== 'undefined' && input instanceof Function) ||\n\t Object.prototype.toString.call(input) === '[object Function]'\n\t );\n\t }", "function isFunction(a) {\n return getTypeString(a) === '[object Function]';\n }", "function isFunction (obj) {\n return !!(obj && obj.constructor && obj.call && obj.apply)\n}", "function isFunction(input) {\n return typeof Function !== 'undefined' && input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';\n }", "function logged(constructorFn) {\n console.log(constructorFn);\n}", "function logged(constructorFn) {\n console.log(constructorFn);\n}", "function isFunction(value) { return typeof value === \"function\" || value instanceof Function; }", "function isFn (x) { return typeof x === 'function' }", "static isConstructSignature(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.ConstructSignature;\r\n }", "function isFunction(input) {\n return (\n (typeof Function !== 'undefined' && input instanceof Function) ||\n Object.prototype.toString.call(input) === '[object Function]'\n );\n }", "function isFunction(input) {\n return (\n (typeof Function !== 'undefined' && input instanceof Function) ||\n Object.prototype.toString.call(input) === '[object Function]'\n );\n }" ]
[ "0.78567946", "0.77828586", "0.72959", "0.7212019", "0.70982814", "0.70852464", "0.705966", "0.70311177", "0.7030553", "0.69598", "0.69360584", "0.6911233", "0.6753676", "0.66875815", "0.66067296", "0.6506227", "0.6431026", "0.6381115", "0.6379887", "0.62503326", "0.6193139", "0.61904424", "0.61092377", "0.61065316", "0.61065316", "0.60742486", "0.60706943", "0.60706943", "0.60342", "0.60342", "0.60342", "0.6010518", "0.5999588", "0.5999588", "0.5999588", "0.5992644", "0.5980422", "0.5980422", "0.5980422", "0.5980422", "0.5980422", "0.5980422", "0.597915", "0.5976311", "0.5970701", "0.59398025", "0.59318846", "0.59318846", "0.59318846", "0.5929809", "0.5929809", "0.5929809", "0.5900627", "0.5900627", "0.5900627", "0.5900627", "0.5900627", "0.589922", "0.5870733", "0.58457017", "0.5782718", "0.5635878", "0.56046665", "0.5581432", "0.55748445", "0.55625963", "0.55625963", "0.5548369", "0.5548369", "0.5545895", "0.554537", "0.5520378", "0.55024874", "0.5474014", "0.5441998", "0.5441998", "0.54363704", "0.5425955", "0.5407404", "0.5407404", "0.53868467", "0.53708816", "0.53511924", "0.5333452", "0.53212816", "0.5314773", "0.53043944", "0.5302381", "0.53009504", "0.5300381", "0.52786314", "0.5264401", "0.52458626", "0.52214533", "0.52179956", "0.52179956", "0.52165127", "0.5216021", "0.5213342", "0.52115035", "0.52115035" ]
0.0
-1
Check if `value` is an object with keys.
function keys(value) { var key for (key in value) { return true } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object');\n }", "function isKey(value, object) {\n if (Array.isArray(value)) {\n return false;\n }\n const type = typeof value;\n if (\n type === \"number\" ||\n type === \"boolean\" ||\n value == null ||\n isSymbol(value)\n ) {\n return true;\n }\n return (\n reIsPlainProp.test(value) ||\n !reIsDeepProp.test(value) ||\n (object != null && value in Object(object))\n );\n}", "function isObject(value) {\n\n\t if (typeof value === 'object' && value !== null &&\n\t !(value instanceof Boolean) &&\n\t !(value instanceof Date) &&\n\t !(value instanceof Number) &&\n\t !(value instanceof RegExp) &&\n\t !(value instanceof String)) {\n\n\t return true;\n\t }\n\n\t return false;\n\t }", "function isObject(value) {\n return value && typeof value === 'object';\n}", "function isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n }", "__is_object(value) {\n return value && typeof value === 'object' && value.constructor === Object;\n }", "function isObject(value) {\n return value && typeof value === 'object' && value.constructor === Object;\n}", "function isObject(value) {\n\treturn value && typeof value === 'object' && value.constructor === Object;\n}", "function keys(value) {\n var key;\n for (key in value) {\n return true;\n }\n return false;\n}", "function keys(value) {\n var key;\n for (key in value) {\n return true\n }\n\n return false\n}", "function isObject(value) {\n\n if (typeof value === 'object' && value !== null &&\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)) {\n\n return true;\n }\n\n return false;\n }", "function isObject(value) {\n\n if (typeof value === 'object' && value !== null &&\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)) {\n\n return true;\n }\n\n return false;\n }", "function isObject(value) {\n\n if (typeof value === 'object' && value !== null &&\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)) {\n\n return true;\n }\n\n return false;\n }", "function isObject(value) {\n\n if (typeof value === 'object' && value !== null &&\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)) {\n\n return true;\n }\n\n return false;\n }", "function isObject(value) {\n\n if (typeof value === 'object' && value !== null &&\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)) {\n\n return true;\n }\n\n return false;\n }", "function isObject(value) {\n\n if (typeof value === 'object' && value !== null &&\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)) {\n\n return true;\n }\n\n return false;\n }", "function isObject(value) {\n\n if (typeof value === 'object' && value !== null &&\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)) {\n\n return true;\n }\n\n return false;\n }", "function isObject(value) {\n\n if (typeof value === 'object' && value !== null &&\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)) {\n\n return true;\n }\n\n return false;\n }", "function isObject(value) {\n\n if (typeof value === 'object' && value !== null &&\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)) {\n\n return true;\n }\n\n return false;\n }", "function isObject(value) {\n\n if (typeof value === 'object' && value !== null &&\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)) {\n\n return true;\n }\n\n return false;\n }", "function isObject(value) {\n\n if (typeof value === 'object' && value !== null &&\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)) {\n\n return true;\n }\n\n return false;\n }", "function isObject(value) {\n\n if (typeof value === 'object' && value !== null &&\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)) {\n\n return true;\n }\n\n return false;\n }", "function isObject(value) {\n return typeof value === 'object' && !!value;\n}", "function isObject(value) { return typeof value === \"object\" && value !== null; }", "function keys(value) {\n var key\n for (key in value) {\n return true\n }\n\n return false\n}", "function keys(value) {\n var key\n for (key in value) {\n return true\n }\n\n return false\n}", "function keys(value) {\n var key\n for (key in value) {\n return true\n }\n\n return false\n}", "function isObject(value) {\n return typeof value === 'object' && value !== null && !isArray(value);\n}", "function isObject$2(value) {\n return (\n typeof value === \"object\" &&\n value !== null &&\n // none of these are collection objects, so we can return false\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Error) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)\n );\n}", "function isObject$2(value) {\n return (\n typeof value === \"object\" &&\n value !== null &&\n // none of these are collection objects, so we can return false\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Error) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)\n );\n}", "function isObjectObject(value) {\n return typeof value === 'object' && value !== null && ObjectToString(value) === '[object Object]';\n}", "function isObject(value) {\n return (\n typeof value === \"object\" &&\n value !== null &&\n // none of these are collection objects, so we can return false\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Error) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)\n );\n}", "function isObject(value) {\n return (\n typeof value === \"object\" &&\n value !== null &&\n // none of these are collection objects, so we can return false\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Error) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)\n );\n}", "function isObject(value) {\n return (\n typeof value === \"object\" &&\n value !== null &&\n // none of these are collection objects, so we can return false\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Error) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)\n );\n}", "function isObject(value) {\n return (\n typeof value === \"object\" &&\n value !== null &&\n // none of these are collection objects, so we can return false\n !(value instanceof Boolean) &&\n !(value instanceof Date) &&\n !(value instanceof Error) &&\n !(value instanceof Number) &&\n !(value instanceof RegExp) &&\n !(value instanceof String)\n );\n}", "function isObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}", "function isObject(value) {\n return typeof value === \"object\" && value !== null || typeof value === \"function\";\n}", "function isObject(value) {\n return typeof value === \"object\" && value !== null || typeof value === \"function\";\n}", "function isObject(value) {\n return typeof value === \"object\" && value !== null || typeof value === \"function\";\n}", "function isObject(value) {\n return value != null && (typeof value === 'object' || typeof value === 'function') && !Array.isArray(value);\n}", "function isObject$1(value) {\n return _typeof_1(value) === \"object\" && value !== null;\n}", "function isObject$1(value) {\n return _typeof_1(value) === \"object\" && value !== null;\n}", "function isObject(value) {\n return typeof value === \"object\" && value != null;\n}", "function isObject$1(value) {\n return typeof value === 'object' && value !== null || typeof value === 'function';\n }", "function isObject(value) {\n\t\treturn value !== null && Object.prototype.toString.call(value) === '[object Object]';\n\t}", "function isObject(value) {\n return (typeof value === \"object\" && value !== null) || typeof value === \"function\";\n}", "function isObject ( value ) {\n return angular.isObject ( value );\n }", "function objectHasEnumerableKeys(value) {\n for (const _ in value) return true;\n return false;\n}", "function isObj(value) {\n var type = typeof value;\n return value !== null && (type === 'object' || type === 'function');\n}", "function _is_json_value(value) {\n\tif (value === undefined) return false;\n\tif (value === null) return true;\n\treturn ([Object, Array, String, Number, Boolean].indexOf(value.constructor) !== -1);\n}", "function isObject(val) {\n return kindOf$3(val) === 'object';\n}", "function isObjectLike(value) {\n return typeof value === \"object\" && !!value;\n}", "function nodesAsObject(value) {\r\n return !!value && typeof value === 'object';\r\n}", "function isPlainObject(value) {\n return !!value && typeof value === 'object' && value.constructor === Object;\n}", "function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\n }", "function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\n }", "function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\n }", "function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\n }", "function is(value) {\r\n var candidate = value;\r\n return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\r\n }", "function is(value) {\r\n var candidate = value;\r\n return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\r\n }", "function is(value) {\r\n var candidate = value;\r\n return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\r\n }", "function is(value) {\r\n var candidate = value;\r\n return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\r\n }", "function isObjectLike(value) {\n return _typeof$1(value) == 'object' && value !== null;\n }", "function isObjectLike(value) {\n return value != null && (typeof value === \"function\" || typeof value === \"object\");\n}", "function is(value) {\r\n var candidate = value;\r\n return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\r\n }", "function is(value) {\r\n var candidate = value;\r\n return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\r\n }", "function isObject(val) {\n return typeOf(val) === 'object';\n}", "function isObject(val) {\n return typeOf(val) === 'object';\n}", "function isObject(val) {\n return typeOf(val) === 'object';\n}", "function isObject(val) {\n return typeOf(val) === 'object';\n}", "function isObject(v) {\n return v instanceof Object;\n }", "function isObjectLike(value) {\n return _typeof(value) == 'object' && value !== null;\n}", "function isObjectLike(value) {\n return _typeof(value) == 'object' && value !== null;\n}", "function isObjectLike(value) {\n return _typeof(value) == 'object' && value !== null;\n}", "function isObjectLike(value) {\n return _typeof(value) == 'object' && value !== null;\n}", "function isObjectLike(value) {\n return _typeof(value) == 'object' && value !== null;\n}", "function isObjectLike(value) {\n return _typeof(value) == 'object' && value !== null;\n}", "function isObjectLike(value) {\n return _typeof(value) == 'object' && value !== null;\n}", "function isObjectLike(value) {\n return _typeof(value) == 'object' && value !== null;\n}", "function isObjectLike(value) {\n return _typeof(value) == 'object' && value !== null;\n}", "function isObjectLike(value) {\n return _typeof(value) == 'object' && value !== null;\n}", "function isObjectLike(value) {\n return _typeof(value) == 'object' && value !== null;\n}", "function isObjectLike(value) {\n return _typeof(value) == 'object' && value !== null;\n}", "function wkt_is_object(val) {\n return !!val && typeof val == 'object' && !Array.isArray(val);\n}", "function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);\n }", "function isObjectLike$a(value) {\n return typeof value == 'object' && value !== null;\n}", "function isObject(val) {\n return val && typeof val == \"object\";\n}", "function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);\n }", "function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);\n }", "function is(value) {\r\n var candidate = value;\r\n return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);\r\n }", "function is(value) {\r\n var candidate = value;\r\n return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);\r\n }", "function is(value) {\r\n var candidate = value;\r\n return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);\r\n }", "function is(value) {\r\n var candidate = value;\r\n return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);\r\n }", "function isPlainObject(value) {\n return (!!value && typeof value === 'object' &&\n value.constructor === Object);\n }", "function isPlainObject(value) {\n return (!!value && typeof value === 'object' &&\n value.constructor === Object);\n }", "function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);\n }" ]
[ "0.7191914", "0.71467626", "0.71403253", "0.71176916", "0.7086549", "0.7021256", "0.6997804", "0.6993788", "0.6949828", "0.6939899", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011", "0.6909596", "0.68978256", "0.68739635", "0.68739635", "0.68739635", "0.6850823", "0.6825888", "0.6825888", "0.67960066", "0.6778988", "0.6778988", "0.6778988", "0.6778988", "0.676161", "0.67524266", "0.67524266", "0.67524266", "0.6748463", "0.67479324", "0.67479324", "0.6741936", "0.6738722", "0.67209804", "0.66579634", "0.664489", "0.6614652", "0.6593048", "0.65478307", "0.65385723", "0.6536143", "0.6521495", "0.6469206", "0.64670783", "0.64491075", "0.64491075", "0.64491075", "0.64472294", "0.64472294", "0.64472294", "0.64472294", "0.64279974", "0.6424793", "0.64232415", "0.64232415", "0.6405065", "0.6405065", "0.6405065", "0.6405065", "0.6394501", "0.6393967", "0.6393967", "0.6393967", "0.6393967", "0.6393967", "0.6393967", "0.6393967", "0.6393967", "0.6393967", "0.6393967", "0.6393967", "0.6393967", "0.6338267", "0.6330077", "0.63209456", "0.6299565", "0.6295708", "0.6295708", "0.62936836", "0.62936836", "0.62936836", "0.62936836", "0.6288841", "0.6288841", "0.62876296" ]
0.6883021
27
Assert a parser is available.
function assertParser(name, Parser) { if (typeof Parser !== 'function') { throw new Error('Cannot `' + name + '` without `Parser`') } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertParser(name, Parser) {\n if (!func(Parser)) {\n throw new Error('Cannot `' + name + '` without `Parser`');\n }\n}", "async ensureParser() {\n if (!this.parser) {\n this.parser = await ASTParser.importASTParser();\n }\n }", "function _checkParser() {\n eval(Processing(canvas, parserTest.body));\n _pass();\n}", "function tryParse(callback) {\n return speculationHelper(callback, /*isLookAhead*/ false);\n }", "function check_parse_error (txt) {\n try {\n eval (txt)\n assert (false)\n } catch (e) {\n assert (e instanceof SyntaxError)\n }\n}", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = __nccwpck_require__(20859)\n break\n case 'raw':\n parser = __nccwpck_require__(49609)\n break\n case 'text':\n parser = __nccwpck_require__(26382)\n break\n case 'urlencoded':\n parser = __nccwpck_require__(76100)\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function Parser() {\n}", "function Parser() {\n}", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = __webpack_require__(558)\n break\n case 'raw':\n parser = __webpack_require__(591)\n break\n case 'text':\n parser = __webpack_require__(592)\n break\n case 'urlencoded':\n parser = __webpack_require__(593)\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function Parser() {\n var errors = this.errors = [];\n var warnings = this.warnings = [];\n}", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = __webpack_require__(212)\n break\n case 'raw':\n parser = __webpack_require__(242)\n break\n case 'text':\n parser = __webpack_require__(243)\n break\n case 'urlencoded':\n parser = __webpack_require__(244)\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = require('./lib/types/json')\n break\n case 'raw':\n parser = require('./lib/types/raw')\n break\n case 'text':\n parser = require('./lib/types/text')\n break\n case 'urlencoded':\n parser = require('./lib/types/urlencoded')\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = require('./lib/types/json')\n break\n case 'raw':\n parser = require('./lib/types/raw')\n break\n case 'text':\n parser = require('./lib/types/text')\n break\n case 'urlencoded':\n parser = require('./lib/types/urlencoded')\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = require('./lib/types/json')\n break\n case 'raw':\n parser = require('./lib/types/raw')\n break\n case 'text':\n parser = require('./lib/types/text')\n break\n case 'urlencoded':\n parser = require('./lib/types/urlencoded')\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = require('./lib/types/json')\n break\n case 'raw':\n parser = require('./lib/types/raw')\n break\n case 'text':\n parser = require('./lib/types/text')\n break\n case 'urlencoded':\n parser = require('./lib/types/urlencoded')\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = __webpack_require__(/*! ./lib/types/json */ \"./node_modules/body-parser/lib/types/json.js\")\n break\n case 'raw':\n parser = __webpack_require__(/*! ./lib/types/raw */ \"./node_modules/body-parser/lib/types/raw.js\")\n break\n case 'text':\n parser = __webpack_require__(/*! ./lib/types/text */ \"./node_modules/body-parser/lib/types/text.js\")\n break\n case 'urlencoded':\n parser = __webpack_require__(/*! ./lib/types/urlencoded */ \"./node_modules/body-parser/lib/types/urlencoded.js\")\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = __webpack_require__(/*! ./lib/types/json */ \"./node_modules/body-parser/lib/types/json.js\")\n break\n case 'raw':\n parser = __webpack_require__(/*! ./lib/types/raw */ \"./node_modules/body-parser/lib/types/raw.js\")\n break\n case 'text':\n parser = __webpack_require__(/*! ./lib/types/text */ \"./node_modules/body-parser/lib/types/text.js\")\n break\n case 'urlencoded':\n parser = __webpack_require__(/*! ./lib/types/urlencoded */ \"./node_modules/body-parser/lib/types/urlencoded.js\")\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = __webpack_require__(/*! ./lib/types/json */ \"./node_modules/body-parser/lib/types/json.js\")\n break\n case 'raw':\n parser = __webpack_require__(/*! ./lib/types/raw */ \"./node_modules/body-parser/lib/types/raw.js\")\n break\n case 'text':\n parser = __webpack_require__(/*! ./lib/types/text */ \"./node_modules/body-parser/lib/types/text.js\")\n break\n case 'urlencoded':\n parser = __webpack_require__(/*! ./lib/types/urlencoded */ \"./node_modules/body-parser/lib/types/urlencoded.js\")\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = __webpack_require__(/*! ./lib/types/json */ \"./node_modules/body-parser/lib/types/json.js\")\n break\n case 'raw':\n parser = __webpack_require__(/*! ./lib/types/raw */ \"./node_modules/body-parser/lib/types/raw.js\")\n break\n case 'text':\n parser = __webpack_require__(/*! ./lib/types/text */ \"./node_modules/body-parser/lib/types/text.js\")\n break\n case 'urlencoded':\n parser = __webpack_require__(/*! ./lib/types/urlencoded */ \"./node_modules/body-parser/lib/types/urlencoded.js\")\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = __webpack_require__(22)\n break\n case 'raw':\n parser = __webpack_require__(28)\n break\n case 'text':\n parser = __webpack_require__(29)\n break\n case 'urlencoded':\n parser = __webpack_require__(30)\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = __webpack_require__(455)\n break\n case 'raw':\n parser = __webpack_require__(486)\n break\n case 'text':\n parser = __webpack_require__(487)\n break\n case 'urlencoded':\n parser = __webpack_require__(488)\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = __webpack_require__(441)\n break\n case 'raw':\n parser = __webpack_require__(460)\n break\n case 'text':\n parser = __webpack_require__(461)\n break\n case 'urlencoded':\n parser = __webpack_require__(462)\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = __webpack_require__(373)\n break\n case 'raw':\n parser = __webpack_require__(395)\n break\n case 'text':\n parser = __webpack_require__(396)\n break\n case 'urlencoded':\n parser = __webpack_require__(397)\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function loadParser(parserName) {\n var parser = parsers[parserName];\n\n if (parser !== undefined) {\n return parser;\n } // this uses a switch for static require analysis\n\n\n switch (parserName) {\n case 'json':\n parser = __webpack_require__(/*! ./lib/types/json */ \"./node_modules/body-parser/lib/types/json.js\");\n break;\n\n case 'raw':\n parser = __webpack_require__(/*! ./lib/types/raw */ \"./node_modules/body-parser/lib/types/raw.js\");\n break;\n\n case 'text':\n parser = __webpack_require__(/*! ./lib/types/text */ \"./node_modules/body-parser/lib/types/text.js\");\n break;\n\n case 'urlencoded':\n parser = __webpack_require__(/*! ./lib/types/urlencoded */ \"./node_modules/body-parser/lib/types/urlencoded.js\");\n break;\n } // store to prevent invoking require()\n\n\n return parsers[parserName] = parser;\n}", "static canParse(testName) {\n const benchmarkParserKey = Utils.getBenchmarkParserKey(testName);\n if (benchmarkParserKey) {\n return true;\n }\n return false;\n }", "function loadParser (parserName) {\n var parser = parsers[parserName]\n\n if (parser !== undefined) {\n return parser\n }\n\n // this uses a switch for static require analysis\n switch (parserName) {\n case 'json':\n parser = __webpack_require__(273)\n break\n case 'raw':\n parser = __webpack_require__(307)\n break\n case 'text':\n parser = __webpack_require__(308)\n break\n case 'urlencoded':\n parser = __webpack_require__(309)\n break\n }\n\n // store to prevent invoking require()\n return (parsers[parserName] = parser)\n}", "function testParserInsertedDidNotRun(description) {\n test(() => assert_false(window.ran),\n \"Script shouldn't run with \" + description + \" (parser-inserted)\");\n window.ran = false;\n}", "function _getParser(options){\r\n return (options && options.parser) || setDefaultParser();\r\n}", "get parser() {\r\n return this._parser;\r\n }", "constructor( parser ){ \n super()\n this.parser = parser \n }", "function expect(parser, kind) {\n var token = parser.token;\n if (token.kind === kind) {\n advance(parser);\n return token;\n }\n throw (0, _error.syntaxError)(parser.source, token.start, 'Expected ' + (0, _lexer.getTokenKindDesc)(kind) + ', found ' + (0, _lexer.getTokenDesc)(token));\n}", "function def(source, result) {\n\treturn function () {\n\t var actualResult = undefined;\n\t var exception = undefined;\n\t expectAsserts(1);\n try {\n\t\tactualResult = MicroXML.parse(source);\n }\n catch (e) {\n\t\texception = e;\n }\n if (result === undefined) {\n\t\tassertInstanceOf(\"non-conformance not detected:\", MicroXML.ParseError, exception);\n }\n else {\n\t\tassertEquals(\"incorrect parse result:\", result, actualResult);\n }\n\t};\n }", "function Parser() {\n\n}", "function expect(parser, kind) {\n\t var token = parser.token;\n\t if (token.kind === kind) {\n\t advance(parser);\n\t return token;\n\t }\n\t throw (0, _error.syntaxError)(parser.source, token.start, 'Expected ' + (0, _lexer.getTokenKindDesc)(kind) + ', found ' + (0, _lexer.getTokenDesc)(token));\n\t}", "function caml_set_parser_trace() { return 0; }", "async function checkExecution() {\n await (async () => {\n const m = new Module('import { nonexistent } from \"module\";');\n await m.link(common.mustCall(() => new Module('')));\n\n // There is no code for this exception since it is thrown by the JavaScript\n // engine.\n assert.throws(() => {\n m.instantiate();\n }, SyntaxError);\n })();\n\n await (async () => {\n const m = new Module('throw new Error();');\n await m.link(common.mustNotCall());\n m.instantiate();\n const evaluatePromise = m.evaluate();\n await evaluatePromise.catch(() => {});\n assert.strictEqual(m.status, 'errored');\n try {\n await evaluatePromise;\n } catch (err) {\n assert.strictEqual(m.error, err);\n return;\n }\n assert.fail('Missing expected exception');\n })();\n}", "instantiateParser() {\n return new this.ParserClass(this.config);\n }", "function _isSupported() {\n _state = 1;\n if (typeof chai !== \"undefined\") {\n _chai = chai;\n assert = _chai.assert;\n\n } else {\n _cat.core.log.info(\"Chai library is not supported, skipping annotation 'assert', consider adding it to the .catproject dependencies\");\n }\n }", "function parseXML(){\n\tdescribe(\"Parse XML\", function(){\n\t\tit(\"Game XML should parse without errors\", function(done){\n\n\t\t\tparser.parseString(xmlString, function(err, result){\n\n\t\t\t\tif (err) throw err;\n\n\t\t\t\txmlData = result.math;\n\n\t\t\t\tdone();\n\t\t\t});\n\t\t});\n\t});\n}", "function parseXML(){\n\tdescribe(\"Parse XML\", function(){\n\t\tit(\"Game XML should parse without errors\", function(done){\n\n\t\t\tparser.parseString(xmlString, function(err, result){\n\n\t\t\t\tif (err) throw err;\n\n\t\t\t\txmlData = result.math;\n\n\t\t\t\tdone();\n\t\t\t});\n\t\t});\n\t});\n}", "constructor(type, parser) { \n this.parser = parser\n this.type = type\n }", "parse() {\n if (this._readable === undefined) {\n log.error(\"No Readable: Cannot find stream for the scanner to work against.\");\n return;\n }\n log.verbose(\"<system goal>\");\n this._systemGoal();\n return this._parseSuccess;\n }", "init(parser, reporter, severity, meta) {\n this.parser = parser;\n this.reporter = reporter;\n this.severity = severity;\n this.meta = meta;\n }", "function assertCompiler(name, Compiler) {\n if (!func(Compiler)) {\n throw new Error('Cannot `' + name + '` without `Compiler`');\n }\n}", "function Parser() {\n if(false === (this instanceof Parser)) {\n return new Parser();\n }\n\n events.EventEmitter.call(this);\n}", "function assertCompiler(name, Compiler) {\n if (typeof Compiler !== 'function') {\n throw new Error('Cannot `' + name + '` without `Compiler`')\n }\n}", "function assertCompiler(name, Compiler) {\n if (typeof Compiler !== 'function') {\n throw new Error('Cannot `' + name + '` without `Compiler`')\n }\n}", "function assertCompiler(name, Compiler) {\n if (typeof Compiler !== 'function') {\n throw new Error('Cannot `' + name + '` without `Compiler`')\n }\n}", "function assertCompiler(name, Compiler) {\n if (typeof Compiler !== 'function') {\n throw new Error('Cannot `' + name + '` without `Compiler`')\n }\n}", "function assertCompiler(name, Compiler) {\n if (typeof Compiler !== 'function') {\n throw new Error('Cannot `' + name + '` without `Compiler`')\n }\n}", "function assertCompiler(name, Compiler) {\n if (typeof Compiler !== 'function') {\n throw new Error('Cannot `' + name + '` without `Compiler`')\n }\n}", "function assertCompiler(name, Compiler) {\n if (typeof Compiler !== 'function') {\n throw new Error('Cannot `' + name + '` without `Compiler`')\n }\n}", "function assertCompiler(name, Compiler) {\n if (typeof Compiler !== 'function') {\n throw new Error('Cannot `' + name + '` without `Compiler`')\n }\n}", "function assertCompiler(name, Compiler) {\n if (typeof Compiler !== 'function') {\n throw new Error('Cannot `' + name + '` without `Compiler`')\n }\n}", "function assertValidSDL(documentAST) {\n var errors = validateSDL(documentAST);\n\n if (errors.length !== 0) {\n throw new Error(errors.map(function (error) {\n return error.message;\n }).join('\\n\\n'));\n }\n}", "function assertValidSDL(documentAST) {\n var errors = validateSDL(documentAST);\n\n if (errors.length !== 0) {\n throw new Error(errors.map(function (error) {\n return error.message;\n }).join('\\n\\n'));\n }\n}", "function assertValidSDL(documentAST) {\n var errors = validateSDL(documentAST);\n\n if (errors.length !== 0) {\n throw new Error(errors.map(function (error) {\n return error.message;\n }).join('\\n\\n'));\n }\n}", "function assertValidSDL(documentAST) {\n var errors = validateSDL(documentAST);\n\n if (errors.length !== 0) {\n throw new Error(errors.map(function (error) {\n return error.message;\n }).join('\\n\\n'));\n }\n}", "function assertValidSDL(documentAST) {\n var errors = validateSDL(documentAST);\n\n if (errors.length !== 0) {\n throw new Error(errors.map(function (error) {\n return error.message;\n }).join('\\n\\n'));\n }\n}", "function assertValidSDL(documentAST) {\n var errors = validateSDL(documentAST);\n\n if (errors.length !== 0) {\n throw new Error(errors.map(function (error) {\n return error.message;\n }).join('\\n\\n'));\n }\n}", "function parser(p) {\n return new Parser(p);\n }", "constructor( parser, embeded=parser ) { \n super(new GeneratorTokenizer(embeded), parser?GeneratorParser.full_rules():GeneratorParser.rules(), \n parser?GeneratorConstants.LANG:GeneratorConstants.EXP) \n this.matcher = new Matcher(\"matcher-inner\", embeded)\n }", "validate(input) {\r\n return new Promise((resolve, reject) => {\r\n SwaggerParser.validate(input+'.yaml').then((api) => {\r\n resolve(true);\r\n }).catch((err) => {\r\n \t\t console.log(err);\r\n resolve('You must provide an existing OpenAPI spec (yaml file in working directory) and the spec MUST be valid');\r\n });\r\n });\r\n }", "function assert(bool, message) {\n\tif (!bool) {\n\t\tthrow new ParseException(message);\n\t}\n}", "initParsers() {\n this.parserRegistry = new ParserRegistry();\n }", "function assertValidXMLResponse(responseXML) {\n assert(!responseXML.isAbsent(), Const_1.EMPTY_RESPONSE, Const_1.PHASE_PROCESS_RESPONSE);\n assert(!responseXML.isXMLParserError(), responseXML.parserErrorText(Const_1.EMPTY_STR), Const_1.PHASE_PROCESS_RESPONSE);\n assert(responseXML.querySelectorAll(Const_1.XML_TAG_PARTIAL_RESP).isPresent(), Const_1.ERR_NO_PARTIAL_RESPONSE, Const_1.PHASE_PROCESS_RESPONSE);\n }", "function isDOMRequired() { \n\treturn true;\n}", "function ConditionParser() {}", "function Parser() {\r\n this.lexer = new zz.Lexer();\r\n }", "function Parser() {\n var nodeFactory = arguments.length <= 0 || arguments[0] === undefined ? new _nodeFactory.NodeFactory() : arguments[0];\n\n _classCallCheck(this, Parser);\n\n this.nodeFactory = nodeFactory;\n }", "function isDOMRequired()\n{\n\treturn true;\n}", "function peek(parser, kind) {\n return parser.token.kind === kind;\n}", "function parseAndAssertThrows() {\n var args = arguments;\n assertThrows(function() {\n parseHtmlSubset.apply(null, args);\n });\n}", "function _setupParser(){\n\t\t//Extend the parser with the local displayError function\n\t\tparser.displayError = displayError;\n\n\t\t$('html')\n\t\t\t.fileDragAndDrop(function(fileCollection){\n\t\t\t\t_resetUI();\n\n\t\t\t\t//Reset lists\n\t\t\t\tparser.errorList = [];\n\t\t\t\tparser.songList = [];\n\n\t\t\t\t//Loop through each file and parse it\n\t\t\t\t$.each(fileCollection, parser.parseFile);\n\n\t\t\t\t//Parsing complete, run the display/output functions\n\t\t\t\tparser.complete($output);\n\n\t\t\t\t//Update the total converted song count\n\t\t\t\t_updateSongCount(parser.songList.length);\n\t\t\t\t\n\t\t\t\t//Also display errors if there are any\n\t\t\t\tif(parser.errorList.length){\n\n\t\t\t\t\tvar errorTitle = parser.errorList.length == 1 ? \"One song ran into an error and could not be converted\": \"We ran into errors with \" + parser.errorList.length + \" of the songs, and they were not converted\";\n\n\t\t\t\t\t//Join all the error messages together\n\t\t\t\t\tdisplayError(parser.errorList.join(\"<br/>\"), errorTitle);\n\t\t\t\t}\n\n\t\t\t});\n\t}", "function Parser(grammar) {\n _classCallCheck(this, Parser);\n\n this.grammar = grammar;\n } // Parse `line` using current grammar. Returns {success: true} if the", "function validateLoaderOptions(loaderOptions) {\n const loaderOptionKeys = Object.keys(loaderOptions);\n for (let i = 0; i < loaderOptionKeys.length; i++) {\n const option = loaderOptionKeys[i];\n const isUnexpectedOption = validLoaderOptions.indexOf(option) === -1;\n if (isUnexpectedOption) {\n throw new Error(`ts-loader was supplied with an unexpected loader option: ${option}\n\nPlease take a look at the options you are supplying; the following are valid options:\n${validLoaderOptions.join(' / ')}\n`);\n }\n }\n if (loaderOptions.context !== undefined &&\n !path.isAbsolute(loaderOptions.context)) {\n throw new Error(`Option 'context' has to be an absolute path. Given '${loaderOptions.context}'.`);\n }\n}", "function checkReady() {\r\n\tvar isReady = (domContentLoaded && (xhrDug.readyState == xhrDug.DONE && xhrBuried.readyState == xhrBuried.DONE) || DBG_FAKE_RESPONSE);\r\n\tDBG && win.console.info('checkReady', isReady);\r\n\tif (isReady) {\r\n\t\tonReady();\r\n\t}\r\n}", "static parse(parseTokens) {\n let isParsed = false;\n CSTTree = new mackintosh.CST();\n ASTTree = new mackintosh.CST();\n tokenPointer = 0;\n _Functions.log(\"\\n\");\n _Functions.log(\"\\n\");\n _Functions.log(\"PARSER - Parsing Program \" + (programCount - 1));\n //Check if there are tokens in the token stream.\n if (parseTokens.length == 0) {\n _Functions.log(\"PARSER ERROR - There are no tokens to be parsed.\");\n parseErrCount++;\n }\n //Begin parse.\n else {\n //Use try catch to check for parse failures and output them.\n try {\n this.parseProgram(parseTokens);\n _Functions.log(\"PARSER - Parse completed with \" + parseErrCount + \" errors and \" +\n parseWarnCount + \" warnings\");\n //Prints the CST if there are no more errors.\n if (parseErrCount <= 0) {\n isParsed = true;\n _Functions.log(\"\\n\");\n _Functions.log(\"\\n\");\n _Functions.log(\"PARSER - Program \" + (programCount - 1) + \" CST:\");\n _Functions.log(CSTTree.toString());\n _Functions.log(\"\\n\");\n _Functions.log(\"\\n\");\n _Functions.log(\"PARSER - Program \" + (programCount - 1) + \" AST:\");\n _Functions.log(ASTTree.toString());\n }\n else {\n isParsed = false;\n _Functions.log(\"\\n\");\n _Functions.log(\"\\n\");\n _Functions.log(\"PARSER - CST and AST not displayed due to parse errors.\");\n }\n }\n catch (error) {\n _Functions.log(error);\n _Functions.log(\"PARSER - Error caused parse to end.\");\n parseErrCount++;\n }\n }\n return isParsed;\n }", "function GherkinParser() {\n if (!(this instanceof GherkinParser))\n return new GherkinParser();\n\n this.matchers_ = [\n {name: 'assertionFailed', re: /Assertion Failed/},\n {name: 'summaryError', re: /[1-9]0* failed/},\n {name: 'failingScenariosStart', re: /Failing scenarios:/}\n ]\n}", "function sanityCheck() {\n const errors = [];\n // Webworkers\n if (!window.Worker) errors.push(\"WebWorkers\");\n // IndexedDB\n if (!window.indexedDB) errors.push(\"IndexedDB\");\n // Notifications\n if (!window.Notification) errors.push(\"Notifications\");\n\n errors.length > 0 ? showErrors(errors) : setUp();\n}", "function getDOMParser() {\n domParser = domParser || new DOMParser();\n return domParser;\n }", "function parseDebug(parser) {\n const elems = parser.elems;\n if (elems.length === 0) {\n return {'error': 'expected `true` or `false` value, found nothing'};\n } else if (elems.length !== 1 || elems[0].kind !== 'boolean') {\n return {'error': `expected \\`true\\` or \\`false\\` value, found \\`${parser.getRawArgs()}\\``};\n }\n return {\n 'instructions': [\n 'if (arg && arg.debug_log && arg.debug_log.setDebugEnabled) {\\n' +\n `arg.debug_log.setDebugEnabled(${elems[0].getRaw()});\\n` +\n '} else {\\n' +\n 'throw \"`debug` command needs an object with a `debug_log` field of `Debug` type!\";\\n' +\n '}',\n ],\n 'wait': false,\n };\n}", "function detectCustomBeaconLayout(parser: number): Promise<any> {\n return new Promise((resolve, reject) => {\n BeaconsManager.addParser(parser, resolve, reject);\n });\n}", "function TextParser() {}", "function TextParser() {}", "function peek(parser, kind) {\n\t return parser.token.kind === kind;\n\t}", "function SpecParser() {\n this.result = {};\n }", "function Parser(input) {\n // Make a new lexer\n this.lexer = new Lexer(input);\n}", "parseXMLFile(rootElement) {\n console.log(rootElement);\n\n window.yasxml = rootElement;\n\n try {\n this.yas = new XMLYas(rootElement);\n console.log(this.yas);\n return true;\n } catch (e) {\n console.error(e);\n return false;\n }\n }", "constructor(type) { \n this.type = type \n this.parser = null\n }", "_assertEmitterExists(method = '') {\n if (!exists(this.emitter)) {\n throw new Error(\n `${this.name}.${method} : No emitter found, check if initEmittable() has been called`\n );\n }\n }", "static load() {\n throw new Error(\"`EmberExamMochaTestLoader` doesn't support `load()`.\");\n }" ]
[ "0.7156712", "0.66241133", "0.62994504", "0.50442", "0.4859782", "0.4845704", "0.48403746", "0.48403746", "0.47225016", "0.47192085", "0.47178409", "0.47056007", "0.47056007", "0.47056007", "0.47056007", "0.47035977", "0.47035977", "0.47035977", "0.47035977", "0.46994075", "0.46887186", "0.46877912", "0.46854585", "0.46738157", "0.46689445", "0.46634093", "0.4659274", "0.46478918", "0.46293655", "0.45627162", "0.45306438", "0.44946265", "0.4454064", "0.44343567", "0.44324842", "0.43988317", "0.43707666", "0.4369831", "0.4364025", "0.4364025", "0.4333371", "0.43267438", "0.4320533", "0.43080643", "0.42980257", "0.42922473", "0.42922473", "0.42922473", "0.42922473", "0.42922473", "0.42922473", "0.42922473", "0.42922473", "0.42922473", "0.42848024", "0.42848024", "0.42848024", "0.42848024", "0.42848024", "0.42848024", "0.42514613", "0.42506406", "0.42246327", "0.42121688", "0.4192693", "0.41824177", "0.41604197", "0.41581494", "0.4140739", "0.4129565", "0.4114376", "0.41052234", "0.41006067", "0.40820986", "0.4076404", "0.40605557", "0.4051121", "0.40417016", "0.40396926", "0.40214816", "0.4015514", "0.40128627", "0.4010655", "0.39984402", "0.39984402", "0.39816886", "0.39784208", "0.3977032", "0.39734566", "0.39696458", "0.39681", "0.39647508" ]
0.7231354
6
Assert a compiler is available.
function assertCompiler(name, Compiler) { if (typeof Compiler !== 'function') { throw new Error('Cannot `' + name + '` without `Compiler`') } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertCompiler(name, Compiler) {\n if (!func(Compiler)) {\n throw new Error('Cannot `' + name + '` without `Compiler`');\n }\n}", "function startMyCompiler() {\n throw new Error('You have no compiler!');\n}", "function _isSupported() {\n _state = 1;\n if (typeof chai !== \"undefined\") {\n _chai = chai;\n assert = _chai.assert;\n\n } else {\n _cat.core.log.info(\"Chai library is not supported, skipping annotation 'assert', consider adding it to the .catproject dependencies\");\n }\n }", "function ensure() {\n let platform = _os.platform();\n\n if (0 > SUPPORTED_PLATFORMS.indexOf(platform)) {\n throw _dev.createError('Environment PHP does not support the ' + platform.toUpperCase() + ' platform.');\n }\n }", "function checkCliDependency() {\n checkIfChcpInstalled(function(err) {\n if (err) {\n suggestCliInstallation();\n }\n\n logEnd();\n });\n}", "apply(compiler) {\n compiler.hooks.invalid.tap('invalid', () => {\n this.stdout('compiling...');\n });\n\n compiler.hooks.done.tap('done', stats => {\n // don't care about module messages\n // just warnings + errors\n const statsData = stats.toJson({\n all: false,\n warnings: true,\n errors: true\n });\n\n const wasSuccessful =\n !statsData.errors.length && !statsData.warnings.length;\n if (wasSuccessful) {\n this.stdout('success!');\n }\n\n if (statsData.errors.length) {\n const error = statsData.errors[0];\n return this.stdout(formatErrorMessage(error));\n }\n\n if (statsData.warnings.length) {\n this.stdout(statsData.warnings.join('\\n\\n'));\n }\n });\n }", "function cnc_check_if_loaded() {\n try {\n if (typeof qx != 'undefined') {\n a = qx.core.Init.getApplication(); // application\n if (a) {\n cncopt_create();\n } else {\n window.setTimeout(cnc_check_if_loaded, 1000);\n }\n } else {\n window.setTimeout(cnc_check_if_loaded, 1000);\n }\n } catch (e) {\n if (typeof console != 'undefined') console.log(e);\n else if (window.opera) opera.postError(e);\n else console.log(e);\n }\n }", "function sanityCheck() {\n const errors = [];\n // Webworkers\n if (!window.Worker) errors.push(\"WebWorkers\");\n // IndexedDB\n if (!window.indexedDB) errors.push(\"IndexedDB\");\n // Notifications\n if (!window.Notification) errors.push(\"Notifications\");\n\n errors.length > 0 ? showErrors(errors) : setUp();\n}", "function cnc_check_if_loaded() {\n try {\n if (typeof qx != 'undefined') {\n a = qx.core.Init.getApplication(); // application\n if (a) {\n cncopt_create();\n } else {\n window.setTimeout(cnc_check_if_loaded, 1000);\n }\n } else {\n window.setTimeout(cnc_check_if_loaded, 1000);\n }\n } catch (e) {\n if (typeof console != 'undefined') console.log(e);\n else if (window.opera) opera.postError(e);\n else GM_log(e);\n }\n }", "async checkIfConfigured () {\r\n this.path = await this._getToolPath()\r\n return this.path != null\r\n }", "async checkIfConfigured () {\r\n this.path = await this._getToolPath()\r\n return this.path != null\r\n }", "function assert(condition, message) {\n if ((0, _devtoolsEnvironment.isDevelopment)() && !condition) {\n throw new Error(`Assertion failure: ${message}`);\n }\n}", "function areDependenciesAvailable() {}", "checkDependencies() {\n if(os.platform() === \"linux\") {\n Helpers.isPackageInstalled(\"wmctrl\")\n .catch((error) => {\n var message = \"This tool uses <strong>wmctrl</strong> to focus the Path of Exile window. It is recommended to install it for an optimal experience.\";\n new TextEntry(\"Missing dependency\", message, {icon: \"fa-exclamation-triangle yellow\"}).add();\n });\n }\n }", "async assertImplementation() {\n if (_env.env.EXPO_NO_TYPESCRIPT_SETUP) {\n Log.warn(\"Skipping TypeScript setup: EXPO_NO_TYPESCRIPT_SETUP is enabled.\");\n return;\n }\n debug(\"Ensuring TypeScript support is setup\");\n const tsConfigPath = _path.default.join(this.projectRoot, \"tsconfig.json\");\n // Ensure the project is TypeScript before continuing.\n const intent = await this._getSetupRequirements();\n if (!intent) {\n return;\n }\n // Ensure TypeScript packages are installed\n await this._ensureDependenciesInstalledAsync();\n // Update the config\n await (0, _updateTSConfig).updateTSConfigAsync({\n tsConfigPath,\n isBootstrapping: intent.isBootstrapping\n });\n }", "function detectCompilerInfo(decoded) {\n if (typeof decoded !== \"object\" || decoded === null) {\n return undefined;\n }\n //cbor sometimes returns maps and sometimes objects,\n //so let's make things consistent by converting to a map\n //(although see note above?)\n if (!(decoded instanceof Map)) {\n decoded = new Map(Object.entries(decoded));\n }\n if (!decoded.has(\"solc\")) {\n //return undefined if the solc version field is not present\n //(this occurs if version <0.5.9)\n //currently no other language attaches cbor info, so, yeah\n return undefined;\n }\n const rawVersion = decoded.get(\"solc\");\n if (typeof rawVersion === \"string\") {\n //for prerelease versions, the version is stored as a string.\n return {\n name: \"solc\",\n version: rawVersion\n };\n }\n else if (rawVersion instanceof Uint8Array && rawVersion.length === 3) {\n //for release versions, it's stored as a bytestring of length 3, with the\n //bytes being major, minor, patch. so we just join them with \".\" to form\n //a version string (although it's missing precise commit & etc).\n return {\n name: \"solc\",\n version: rawVersion.join(\".\")\n };\n }\n else {\n //return undefined on anything else\n return undefined;\n }\n}", "function ensureReady(vm, cb) {\n if (!vm.$compiler.init) return cb();\n vm.$once('hook:ready', cb);\n}", "async function checkExecution() {\n await (async () => {\n const m = new Module('import { nonexistent } from \"module\";');\n await m.link(common.mustCall(() => new Module('')));\n\n // There is no code for this exception since it is thrown by the JavaScript\n // engine.\n assert.throws(() => {\n m.instantiate();\n }, SyntaxError);\n })();\n\n await (async () => {\n const m = new Module('throw new Error();');\n await m.link(common.mustNotCall());\n m.instantiate();\n const evaluatePromise = m.evaluate();\n await evaluatePromise.catch(() => {});\n assert.strictEqual(m.status, 'errored');\n try {\n await evaluatePromise;\n } catch (err) {\n assert.strictEqual(m.error, err);\n return;\n }\n assert.fail('Missing expected exception');\n })();\n}", "function main () {\n if (process.platform === 'win32') {\n console.error('Sorry, check-deps only works on Mac and Linux')\n return\n }\n\n var usedDeps = findUsedDeps()\n var packageDeps = findPackageDeps()\n\n var missingDeps = usedDeps.filter(\n (dep) => !includes(packageDeps, dep) && !includes(BUILT_IN_DEPS, dep)\n )\n var unusedDeps = packageDeps.filter(\n (dep) => !includes(usedDeps, dep) && !includes(EXECUTABLE_DEPS, dep)\n )\n\n if (missingDeps.length > 0) {\n console.error('Missing package dependencies: ' + missingDeps)\n }\n if (unusedDeps.length > 0) {\n console.error('Unused package dependencies: ' + unusedDeps)\n }\n if (missingDeps.length + unusedDeps.length > 0) {\n process.exitCode = 1\n }\n}", "function _check_modules(){\n // ADD MODULES CHECKS BELOW\n _checkModule('Chrome_serial');\n _checkModule('serial_console'); // check that the neatFramework \"serial_console\" module is present\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error(message || 'loader assertion failed.');\n }\n}", "function assert(condition, message) {\n if (!condition) {\n throw new Error(message || 'loader assertion failed.');\n }\n}", "function assert(condition, message) {\n if (!condition) {\n throw new Error(message || 'loader assertion failed.');\n }\n}", "function assert(condition, message) {\n if (!condition) {\n throw new Error(message || 'loader assertion failed.');\n }\n}", "function cnc_check_if_loaded() {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (typeof qx != 'undefined') {\n\t\t\t\t\t\t\ta = qx.core.Init.getApplication(); // application\n\t\t\t\t\t\t\tif (a) {\n\t\t\t\t\t\t\t\tcnctaopt_create();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twindow.setTimeout(cnc_check_if_loaded, 1000);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twindow.setTimeout(cnc_check_if_loaded, 1000);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tif (typeof console != 'undefined') console.log(e);\n\t\t\t\t\t\telse if (window.opera) opera.postError(e);\n\t\t\t\t\t\telse GM_log(e);\n\t\t\t\t\t}\n\t\t\t\t}", "function VersionCompiler() {\n}", "function Compiler() {\n}", "function cnc_check_if_loaded() {\n\t\ttry {\n\t\t\tif (typeof qx != 'undefined') {\n\t\t\t\ta = qx.core.Init.getApplication(); // application\n\t\t\t\tif (a) {\n\t\t\t\t\tcncloot_create();\n\t\t\t\t} else {\n\t\t\t\t\twindow.setTimeout(cnc_check_if_loaded, 1000);\n }\n\t\t\t} else {\n\t\t\t\twindow.setTimeout(cnc_check_if_loaded, 1000);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (typeof console != 'undefined') console.log(e);\n\t\t\telse if (window.opera) opera.postError(e);\n\t\t\telse GM_log(e);\n\t\t}\n\t}", "apply(compiler) {\n // Specify the event hook to attach to\n compiler.hooks.done.tap(\n 'BailPlugin',\n (stats) => {\n if (IS_DEV_SERVER === false && stats.hasErrors() === true) {\n throw new Error(stats.compilation.errors.map((err) => err.message || err));\n }\n }\n );\n }", "_checkConfigured() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (!this._pointerTracker) {\n throwMissingPointerFocusTracker();\n }\n if (!this._menu) {\n throwMissingMenuReference();\n }\n }\n }", "function assert(cond) {\n if (!cond) {\n throw new Error(\"assertion error\");\n }\n}", "function checkToolchain () {\n return new Promise((resolve, reject) => {\n const toolBinPath = getToolBinPath()\n exec(`${toolBinPath} toolchain list`).then((results) => {\n const { stdout } = results;\n const matches = (/^(?=nightly)(.*)$/mi).exec(stdout);\n\n // If found, we're done\n if (matches) {\n return resolve(matches[0])\n }\n\n // If not found, install it\n // Ask to install\n atomPrompt(\"`rustup` missing nightly toolchain\", {\n detail: \"rustup toolchain install nightly\",\n }, [\"Install\"]).then((response) => {\n if (response === \"Install\") {\n installNightly().then(checkToolchain).then(resolve).catch(reject)\n } else {\n reject();\n }\n })\n }).catch(() => {\n // Missing rustup\n // Ask to install\n atomPrompt(\"`rustup` is not available\", {\n description: \"From https://www.rustup.rs/\",\n detail: \"curl https://sh.rustup.rs -sSf | sh\",\n }, [\"Install\"]).then((response) => {\n if (response === \"Install\") {\n // Install rustup and try again\n installRustup().then(checkToolchain).then(resolve).catch(reject)\n } else {\n reject();\n }\n })\n })\n })\n}", "compile() {\n if (this.currentProgram.isExecutable()) {\n this.messageBox.message = \"Erfolgreich übersetzt!\\nProgramm kann ausgeführt werden.\"\n } else if (this.currentProgram.isNotExecutable()) {\n this.messageBox.message = \"Übersetzungsfehler!\\n\" + this.currentProgram.errorMessage;\n } else if (this.currentProgram.isUnknown()) {\n this.messageBox.message = \"Backend ist noch nicht implementiert.\\nSelbst geschriebene Programme können noch nicht übersetzt werden.\\nBitte verwende ein Beispielprogramm.\";\n } else {\n console.error(\"Unbekannter Status in currentProgram.\");\n }\n }", "isToolchainInstalled(toolchain) {\r\n return this.toolchains.find(t => t.equals(toolchain)) !== undefined;\r\n }", "function assert(cond) {\n if (!cond) throw new Error('Assertion error');\n }", "function checkInit() {\n if (glEnums == null) {\n throw 'WebGLDebugUtils.init(ctx) not called';\n }\n}", "function checkInit() {\n if (glEnums == null) {\n throw 'WebGLDebugUtils.init(ctx) not called';\n }\n}", "function checkError(status) { // fn beep if compilation errors\n if (status.compilation.errors.length > 0) {\n gutil.beep();\n }\n }", "function makeCompiler() {\n\tif (!config) {\n\t\tmakeConfig();\n\t}\n\n\tcompiler = webpack(config);\n\tif (options.useMemoryFs)\n\t\tmemoryFileSystem = compiler.outputFileSystem = getOutputFileSystem();\n\n\tlog('webpack: First compilation');\n\tcompiler.run(makeWebpackCallback(false));\n\tlog('webpack: Watching');\n\tcompiler.watch({},makeWebpackCallback(true));\n\n\n\tcompiler.plugin(\"invalid\", invalidPlugin);\n\tcompiler.plugin(\"watch-run\", invalidAsyncPlugin);\n\tcompiler.plugin(\"run\", invalidAsyncPlugin);\n\n\n\n\n\n\tcompiler.plugin(\"done\", stats => {\n\t\t// We are now on valid state\n\t\tstate = true;\n\n\n\t\tfunction continueBecauseBundleAvailable(cb) {\n\t\t\tcb();\n\t\t}\n\n\t\tfunction readyCallback() {\n\t\t\t// check if still in valid state\n\t\t\tif(!state) return;\n\n\t\t\tlog(`webpack compiled ${stats.toString(config.stats || {})}`)\n\n\t\t\t// print webpack output\n\t\t\tlet displayStats = (!options.quiet && config.stats !== false) ||\n\t\t\t\tstats.hasErrors() || stats.hasWarnings()\n\n\t\t\tif(displayStats)\n\t\t\t\tlog(stats.toString(options.stats));\n\n\t\t\t// if (!options.noInfo && !options.quiet)\n\t\t\tlog(\"webpack: bundle is now VALID.\");\n\n\t\t\t// execute callback that are delayed\n\t\t\tvar cbs = compilationCallbacks;\n\t\t\tcompilationCallbacks = [];\n\t\t\tcbs.forEach(continueBecauseBundleAvailable);\n\t\t}\n\n\t\t// Do the stuff in nextTick, because bundle may be invalidated\n\t\t// if a change happened while compiling\n\t\tprocess.nextTick(readyCallback);\n\n\t\t// In lazy mode, we may issue another rebuild\n\t\tif(forceRebuild) {\n\t\t\tforceRebuild = false;\n\t\t\trebuild();\n\t\t}\n\t});\n}", "function assertPlatform(requiredToken){var platform=getPlatform();if(!platform){throw new Error('No platform exists!');}if(!platform.injector.get(requiredToken,null)){throw new Error('A platform with a different configuration has been created. Please destroy it first.');}return platform;}", "function createAotCompiler(compilerHost,options,errorCollector){var translations=options.translations||'';var urlResolver=createAotUrlResolver(compilerHost);var symbolCache=new StaticSymbolCache();var summaryResolver=new AotSummaryResolver(compilerHost,symbolCache);var symbolResolver=new StaticSymbolResolver(compilerHost,symbolCache,summaryResolver);var staticReflector=new StaticReflector(summaryResolver,symbolResolver,[],[],errorCollector);var htmlParser;if(!!options.enableIvy){// Ivy handles i18n at the compiler level so we must use a regular parser\nhtmlParser=new HtmlParser();}else{htmlParser=new I18NHtmlParser(new HtmlParser(),translations,options.i18nFormat,options.missingTranslation,console);}var config=new CompilerConfig({defaultEncapsulation:ViewEncapsulation.Emulated,useJit:false,missingTranslation:options.missingTranslation,preserveWhitespaces:options.preserveWhitespaces,strictInjectionParameters:options.strictInjectionParameters});var normalizer=new DirectiveNormalizer({get:function get(url){return compilerHost.loadResource(url);}},urlResolver,htmlParser,config);var expressionParser=new Parser(new Lexer());var elementSchemaRegistry=new DomElementSchemaRegistry();var tmplParser=new TemplateParser(config,staticReflector,expressionParser,elementSchemaRegistry,htmlParser,console,[]);var resolver=new CompileMetadataResolver(config,htmlParser,new NgModuleResolver(staticReflector),new DirectiveResolver(staticReflector),new PipeResolver(staticReflector),summaryResolver,elementSchemaRegistry,normalizer,console,symbolCache,staticReflector,errorCollector);// TODO(vicb): do not pass options.i18nFormat here\nvar viewCompiler=new ViewCompiler(staticReflector);var typeCheckCompiler=new TypeCheckCompiler(options,staticReflector);var compiler=new AotCompiler(config,options,compilerHost,staticReflector,resolver,tmplParser,new StyleCompiler(urlResolver),viewCompiler,typeCheckCompiler,new NgModuleCompiler(staticReflector),new InjectableCompiler(staticReflector,!!options.enableIvy),new TypeScriptEmitter(),summaryResolver,symbolResolver);return{compiler:compiler,reflector:staticReflector};}", "async function compiler() {\n\ttry {\n\t await electronInstaller.createWindowsInstaller({\n\t appDirectory: '/var/www/nicoldesktop/release-builds/Insurance-win32-ia32',\n\t outputDirectory: '/var/www/nicoldesktop/release-builds/Insurance-win32-ia32/installer',\n\t authors: 'NICOL Devs',\n\t exe: 'Insurance.exe',\n\t iconUrl: '/var/www/nicoldesktop/assets/icons/win/icon.ico', \n\t setupIcon: '/var/www/nicoldesktop/assets/icons/win/icon.ico',\n\t setupExe: 'NICOL.exe',\n\t setupMsi: 'NICOL.exe'\n\t });\n\t console.log('It worked!');\n\t} catch (e) {\n\t console.log(`No dice: ${e.message}`);\n\t}\n}", "function assertPlatform(requiredToken) {\n var platform = getPlatform();\n if (!platform) {\n throw new Error('No platform exists!');\n }\n if (!platform.injector.get(requiredToken, null)) {\n throw new Error('A platform with a different configuration has been created. Please destroy it first.');\n }\n return platform;\n}", "function assertPlatform(requiredToken) {\n var platform = getPlatform();\n if (!platform) {\n throw new Error('No platform exists!');\n }\n if (!platform.injector.get(requiredToken, null)) {\n throw new Error('A platform with a different configuration has been created. Please destroy it first.');\n }\n return platform;\n}", "function assertPlatform(requiredToken) {\n var platform = getPlatform();\n if (!platform) {\n throw new Error('No platform exists!');\n }\n if (!platform.injector.get(requiredToken, null)) {\n throw new Error('A platform with a different configuration has been created. Please destroy it first.');\n }\n return platform;\n}", "function assertPlatform(requiredToken) {\n var platform = getPlatform();\n if (!platform) {\n throw new Error('No platform exists!');\n }\n if (!platform.injector.get(requiredToken, null)) {\n throw new Error('A platform with a different configuration has been created. Please destroy it first.');\n }\n return platform;\n}", "function assertPlatform(requiredToken) {\n var platform = getPlatform();\n if (!platform) {\n throw new Error('No platform exists!');\n }\n if (!platform.injector.get(requiredToken, null)) {\n throw new Error('A platform with a different configuration has been created. Please destroy it first.');\n }\n return platform;\n}", "function assertPlatform(requiredToken) {\n const platform = getPlatform();\n if (!platform) {\n throw new Error('No platform exists!');\n }\n if (!platform.injector.get(requiredToken, null)) {\n throw new Error('A platform with a different configuration has been created. Please destroy it first.');\n }\n return platform;\n}", "function assertPlatform(requiredToken) {\n const platform = getPlatform();\n if (!platform) {\n throw new Error('No platform exists!');\n }\n if (!platform.injector.get(requiredToken, null)) {\n throw new Error('A platform with a different configuration has been created. Please destroy it first.');\n }\n return platform;\n}", "function assertPlatform(requiredToken) {\n const platform = getPlatform();\n if (!platform) {\n throw new Error('No platform exists!');\n }\n if (!platform.injector.get(requiredToken, null)) {\n throw new Error('A platform with a different configuration has been created. Please destroy it first.');\n }\n return platform;\n}", "function assertPlatform(requiredToken) {\n const platform = getPlatform();\n if (!platform) {\n throw new Error('No platform exists!');\n }\n if (!platform.injector.get(requiredToken, null)) {\n throw new Error('A platform with a different configuration has been created. Please destroy it first.');\n }\n return platform;\n}", "function assertPlatform(requiredToken) {\n const platform = getPlatform();\n if (!platform) {\n throw new Error('No platform exists!');\n }\n if (!platform.injector.get(requiredToken, null)) {\n throw new Error('A platform with a different configuration has been created. Please destroy it first.');\n }\n return platform;\n}", "function required() { }", "function test_code_generator_checkIfImplementations() {\n var workspace = create_typed_workspace();\n try {\n var prototypes = Object.keys(Blockly.Blocks);\n var blocks = [];\n for (var i = 0, type; type = prototypes[i]; i++) {\n if (!type.match(/\\w+_typed/)) {\n continue;\n }\n blocks.push(workspace.newBlock(type));\n }\n var code = Blockly.TypedLang.workspaceToCode(workspace);\n assertTrue(goog.isString(code));\n } finally {\n workspace.dispose();\n }\n}", "function assertPlatform(requiredToken) {\n var platform = getPlatform();\n if (lang_1.isBlank(platform)) {\n throw new exceptions_1.BaseException('Not platform exists!');\n }\n if (lang_1.isPresent(platform) && lang_1.isBlank(platform.injector.get(requiredToken, null))) {\n throw new exceptions_1.BaseException('A platform with a different configuration has been created. Please destroy it first.');\n }\n return platform;\n}", "function createAotCompiler(compilerHost, options, errorCollector) {\n let translations = options.translations || '';\n const urlResolver = createAotUrlResolver(compilerHost);\n const symbolCache = new StaticSymbolCache();\n const summaryResolver = new AotSummaryResolver(compilerHost, symbolCache);\n const symbolResolver = new StaticSymbolResolver(compilerHost, symbolCache, summaryResolver);\n const staticReflector = new StaticReflector(summaryResolver, symbolResolver, [], [], errorCollector);\n let htmlParser;\n if (!!options.enableIvy) {\n // Ivy handles i18n at the compiler level so we must use a regular parser\n htmlParser = new HtmlParser();\n }\n else {\n htmlParser = new I18NHtmlParser(new HtmlParser(), translations, options.i18nFormat, options.missingTranslation, console);\n }\n const config = new CompilerConfig({\n defaultEncapsulation: ViewEncapsulation.Emulated,\n useJit: false,\n missingTranslation: options.missingTranslation,\n preserveWhitespaces: options.preserveWhitespaces,\n strictInjectionParameters: options.strictInjectionParameters,\n });\n const normalizer = new DirectiveNormalizer({ get: (url) => compilerHost.loadResource(url) }, urlResolver, htmlParser, config);\n const expressionParser = new Parser$1(new Lexer());\n const elementSchemaRegistry = new DomElementSchemaRegistry();\n const tmplParser = new TemplateParser(config, staticReflector, expressionParser, elementSchemaRegistry, htmlParser, console, []);\n const resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector, errorCollector);\n // TODO(vicb): do not pass options.i18nFormat here\n const viewCompiler = new ViewCompiler(staticReflector);\n const typeCheckCompiler = new TypeCheckCompiler(options, staticReflector);\n const compiler = new AotCompiler(config, options, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver), viewCompiler, typeCheckCompiler, new NgModuleCompiler(staticReflector), new InjectableCompiler(staticReflector, !!options.enableIvy), new TypeScriptEmitter(), summaryResolver, symbolResolver);\n return { compiler, reflector: staticReflector };\n}", "function createAotCompiler(compilerHost, options, errorCollector) {\n let translations = options.translations || '';\n const urlResolver = createAotUrlResolver(compilerHost);\n const symbolCache = new StaticSymbolCache();\n const summaryResolver = new AotSummaryResolver(compilerHost, symbolCache);\n const symbolResolver = new StaticSymbolResolver(compilerHost, symbolCache, summaryResolver);\n const staticReflector = new StaticReflector(summaryResolver, symbolResolver, [], [], errorCollector);\n let htmlParser;\n if (!!options.enableIvy) {\n // Ivy handles i18n at the compiler level so we must use a regular parser\n htmlParser = new HtmlParser();\n }\n else {\n htmlParser = new I18NHtmlParser(new HtmlParser(), translations, options.i18nFormat, options.missingTranslation, console);\n }\n const config = new CompilerConfig({\n defaultEncapsulation: ViewEncapsulation.Emulated,\n useJit: false,\n missingTranslation: options.missingTranslation,\n preserveWhitespaces: options.preserveWhitespaces,\n strictInjectionParameters: options.strictInjectionParameters,\n });\n const normalizer = new DirectiveNormalizer({ get: (url) => compilerHost.loadResource(url) }, urlResolver, htmlParser, config);\n const expressionParser = new Parser$1(new Lexer());\n const elementSchemaRegistry = new DomElementSchemaRegistry();\n const tmplParser = new TemplateParser(config, staticReflector, expressionParser, elementSchemaRegistry, htmlParser, console, []);\n const resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector, errorCollector);\n // TODO(vicb): do not pass options.i18nFormat here\n const viewCompiler = new ViewCompiler(staticReflector);\n const typeCheckCompiler = new TypeCheckCompiler(options, staticReflector);\n const compiler = new AotCompiler(config, options, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver), viewCompiler, typeCheckCompiler, new NgModuleCompiler(staticReflector), new InjectableCompiler(staticReflector, !!options.enableIvy), new TypeScriptEmitter(), summaryResolver, symbolResolver);\n return { compiler, reflector: staticReflector };\n}", "function createAotCompiler(compilerHost, options, errorCollector) {\n let translations = options.translations || '';\n const urlResolver = createAotUrlResolver(compilerHost);\n const symbolCache = new StaticSymbolCache();\n const summaryResolver = new AotSummaryResolver(compilerHost, symbolCache);\n const symbolResolver = new StaticSymbolResolver(compilerHost, symbolCache, summaryResolver);\n const staticReflector = new StaticReflector(summaryResolver, symbolResolver, [], [], errorCollector);\n let htmlParser;\n if (!!options.enableIvy) {\n // Ivy handles i18n at the compiler level so we must use a regular parser\n htmlParser = new HtmlParser();\n }\n else {\n htmlParser = new I18NHtmlParser(new HtmlParser(), translations, options.i18nFormat, options.missingTranslation, console);\n }\n const config = new CompilerConfig({\n defaultEncapsulation: ViewEncapsulation.Emulated,\n useJit: false,\n missingTranslation: options.missingTranslation,\n preserveWhitespaces: options.preserveWhitespaces,\n strictInjectionParameters: options.strictInjectionParameters,\n });\n const normalizer = new DirectiveNormalizer({ get: (url) => compilerHost.loadResource(url) }, urlResolver, htmlParser, config);\n const expressionParser = new Parser$1(new Lexer());\n const elementSchemaRegistry = new DomElementSchemaRegistry();\n const tmplParser = new TemplateParser(config, staticReflector, expressionParser, elementSchemaRegistry, htmlParser, console, []);\n const resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector, errorCollector);\n // TODO(vicb): do not pass options.i18nFormat here\n const viewCompiler = new ViewCompiler(staticReflector);\n const typeCheckCompiler = new TypeCheckCompiler(options, staticReflector);\n const compiler = new AotCompiler(config, options, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver), viewCompiler, typeCheckCompiler, new NgModuleCompiler(staticReflector), new InjectableCompiler(staticReflector, !!options.enableIvy), new TypeScriptEmitter(), summaryResolver, symbolResolver);\n return { compiler, reflector: staticReflector };\n}", "function createAotCompiler(compilerHost, options, errorCollector) {\n let translations = options.translations || '';\n const urlResolver = createAotUrlResolver(compilerHost);\n const symbolCache = new StaticSymbolCache();\n const summaryResolver = new AotSummaryResolver(compilerHost, symbolCache);\n const symbolResolver = new StaticSymbolResolver(compilerHost, symbolCache, summaryResolver);\n const staticReflector = new StaticReflector(summaryResolver, symbolResolver, [], [], errorCollector);\n let htmlParser;\n if (!!options.enableIvy) {\n // Ivy handles i18n at the compiler level so we must use a regular parser\n htmlParser = new HtmlParser();\n }\n else {\n htmlParser = new I18NHtmlParser(new HtmlParser(), translations, options.i18nFormat, options.missingTranslation, console);\n }\n const config = new CompilerConfig({\n defaultEncapsulation: ViewEncapsulation.Emulated,\n useJit: false,\n missingTranslation: options.missingTranslation,\n preserveWhitespaces: options.preserveWhitespaces,\n strictInjectionParameters: options.strictInjectionParameters,\n });\n const normalizer = new DirectiveNormalizer({ get: (url) => compilerHost.loadResource(url) }, urlResolver, htmlParser, config);\n const expressionParser = new Parser$1(new Lexer());\n const elementSchemaRegistry = new DomElementSchemaRegistry();\n const tmplParser = new TemplateParser(config, staticReflector, expressionParser, elementSchemaRegistry, htmlParser, console, []);\n const resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector, errorCollector);\n // TODO(vicb): do not pass options.i18nFormat here\n const viewCompiler = new ViewCompiler(staticReflector);\n const typeCheckCompiler = new TypeCheckCompiler(options, staticReflector);\n const compiler = new AotCompiler(config, options, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver), viewCompiler, typeCheckCompiler, new NgModuleCompiler(staticReflector), new InjectableCompiler(staticReflector, !!options.enableIvy), new TypeScriptEmitter(), summaryResolver, symbolResolver);\n return { compiler, reflector: staticReflector };\n}", "function assertNodeEnv() {\r\n return assert(isNode, 'This feature is only available in NodeJS environments');\r\n }", "isMultiCompiler() {\n return this.projectConfig.files.length > 1;\n }", "static startCompile() {\n //Set compilation flag to true.\n isCompiling = true;\n _Functions.log('INFO: Beginning Compilation...');\n //Get source code from text area input.\n let code = document.getElementById(\"inputCode\").value;\n //code = mackintosh.compilerFunctions.trim(code);\n _Lexer.populateProgram(code);\n _Lexer.lex();\n //Check if there is a $ at the end of the program, if not display warning.\n if (program[program.length - 1] != '$') {\n _Functions.log('LEXER WARNING: End of Program $ Not Found.');\n warnCount++;\n }\n return isCompiling;\n }", "function assertPlatform(requiredToken) {\n var platform = getPlatform();\n\n if (!platform) {\n throw new Error('No platform exists!');\n }\n\n if (!platform.injector.get(requiredToken, null)) {\n throw new Error('A platform with a different configuration has been created. Please destroy it first.');\n }\n\n return platform;\n}", "function tryAssertHas(ctx, types)\n{\n try {\n assertHas(ctx,types);\n return true;\n } catch(e) {\n return false;\n }\n}", "assert(condition) {\n if (!condition) {\n throw \"Assert failed!\"\n }\n }", "function testSimpleCompilation() {\n RunTests([\n E([1, 2, 3], [1, 2, 3]),\n E(true, true),\n E(false, false),\n E(ccc.NIL, ccc.NIL),\n E(42, 42),\n E(new String('Ello'), new String('Ello')),\n ]);\n}", "function assertBrowserEnv() {\r\n return assert(isBrowser, 'This feature is only available in browser environments');\r\n }", "checkInit() {\n if (!this.cfgObj) {\n throw new Error(\"Project Config not initialized\");\n }\n }", "function check() {}", "function checkCode(){\n try {\n var checks = {\n mustContain: function(){return api.mustContain(editor.getValue(), document.getElementById('mustContain').value.replace(/ /g, '').split(','))},\n cantContain: function(){return api.cantContain(editor.getValue(), document.getElementById('cantContain').value.replace(/ /g, '').split(','))},\n matchesStructure: function(){return api.matchesStructure(editor.getValue(), matchesStructureInput.getValue())}\n };\n for(var key in checks) {\n //Reset the status indicator\n document.getElementById(key+'Status').className = 'resultIndicator';\n //Only run the tests for this constraint if it's not empty\n if(checks.hasOwnProperty(key) && document.getElementById(key).value !== '') {\n //If the code passed for this constraint\n if(checks[key]()) {\n document.getElementById(key+'Status').className += ' passing';\n }\n else {\n document.getElementById(key+'Status').className += ' failing';\n }\n }\n }\n } catch (e) {\n console.log(e);\n }\n}", "function cordovaJSCheck() {\n\tvar hasCordovaDotJS = (document.querySelector(\"script[src*='cordova.js']\")!=null);\n\tif(!hasCordovaDotJS){\n\t\tvar scr=document.createElement('script');\n\t\tscr.src='cordova.js';\n\t\tdocument.head.appendChild(scr);\n\t}\n}", "function assertPlatform(requiredToken) {\n const platform = getPlatform();\n if (!platform) {\n const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? 'No platform exists!' : '';\n throw new RuntimeError(401 /* PLATFORM_NOT_FOUND */, errorMessage);\n }\n if ((typeof ngDevMode === 'undefined' || ngDevMode) &&\n !platform.injector.get(requiredToken, null)) {\n throw new RuntimeError(400 /* MULTIPLE_PLATFORMS */, 'A platform with a different configuration has been created. Please destroy it first.');\n }\n return platform;\n}", "function assert(cond) {\n if(!cond) {\n console.log(\"assertion failed\");\n } else {\n console.log(\"assertion passed\");\n }\n}", "function checkForDependency(cb) {\n var ajax = new XMLHttpRequest();\n ajax.onreadystatechange = function () {\n // noinspection EqualityComparisonWithCoercionJS\n if (this.readyState == 4 && this.status == 200) {\n // noinspection EqualityComparisonWithCoercionJS\n if (ajax.responseText == \"1\") {\n cb();\n } else {\n alert(\"wrtbwmon is not installed!\");\n }\n }\n };\n ajax.open('GET', basePath + '/check_dependency', true);\n ajax.send();\n }", "function createAotCompiler(compilerHost, options, errorCollector) {\n var translations = options.translations || '';\n var urlResolver = createAotUrlResolver(compilerHost);\n var symbolCache = new StaticSymbolCache();\n var summaryResolver = new AotSummaryResolver(compilerHost, symbolCache);\n var symbolResolver = new StaticSymbolResolver(compilerHost, symbolCache, summaryResolver);\n var staticReflector = new StaticReflector(summaryResolver, symbolResolver, [], [], errorCollector);\n var htmlParser;\n if (!!options.enableIvy) {\n // Ivy handles i18n at the compiler level so we must use a regular parser\n htmlParser = new HtmlParser();\n }\n else {\n htmlParser = new I18NHtmlParser(new HtmlParser(), translations, options.i18nFormat, options.missingTranslation, console);\n }\n var config = new CompilerConfig({\n defaultEncapsulation: ViewEncapsulation.Emulated,\n useJit: false,\n missingTranslation: options.missingTranslation,\n preserveWhitespaces: options.preserveWhitespaces,\n strictInjectionParameters: options.strictInjectionParameters,\n });\n var normalizer = new DirectiveNormalizer({ get: function (url) { return compilerHost.loadResource(url); } }, urlResolver, htmlParser, config);\n var expressionParser = new Parser$1(new Lexer());\n var elementSchemaRegistry = new DomElementSchemaRegistry();\n var tmplParser = new TemplateParser(config, staticReflector, expressionParser, elementSchemaRegistry, htmlParser, console, []);\n var resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector, errorCollector);\n // TODO(vicb): do not pass options.i18nFormat here\n var viewCompiler = new ViewCompiler(staticReflector);\n var typeCheckCompiler = new TypeCheckCompiler(options, staticReflector);\n var compiler = new AotCompiler(config, options, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver), viewCompiler, typeCheckCompiler, new NgModuleCompiler(staticReflector), new InjectableCompiler(staticReflector, !!options.enableIvy), new TypeScriptEmitter(), summaryResolver, symbolResolver);\n return { compiler: compiler, reflector: staticReflector };\n}", "function createAotCompiler(compilerHost, options, errorCollector) {\n var translations = options.translations || '';\n var urlResolver = createAotUrlResolver(compilerHost);\n var symbolCache = new StaticSymbolCache();\n var summaryResolver = new AotSummaryResolver(compilerHost, symbolCache);\n var symbolResolver = new StaticSymbolResolver(compilerHost, symbolCache, summaryResolver);\n var staticReflector = new StaticReflector(summaryResolver, symbolResolver, [], [], errorCollector);\n var htmlParser;\n if (!!options.enableIvy) {\n // Ivy handles i18n at the compiler level so we must use a regular parser\n htmlParser = new HtmlParser();\n }\n else {\n htmlParser = new I18NHtmlParser(new HtmlParser(), translations, options.i18nFormat, options.missingTranslation, console);\n }\n var config = new CompilerConfig({\n defaultEncapsulation: ViewEncapsulation.Emulated,\n useJit: false,\n missingTranslation: options.missingTranslation,\n preserveWhitespaces: options.preserveWhitespaces,\n strictInjectionParameters: options.strictInjectionParameters,\n });\n var normalizer = new DirectiveNormalizer({ get: function (url) { return compilerHost.loadResource(url); } }, urlResolver, htmlParser, config);\n var expressionParser = new Parser(new Lexer());\n var elementSchemaRegistry = new DomElementSchemaRegistry();\n var tmplParser = new TemplateParser(config, staticReflector, expressionParser, elementSchemaRegistry, htmlParser, console, []);\n var resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector, errorCollector);\n // TODO(vicb): do not pass options.i18nFormat here\n var viewCompiler = new ViewCompiler(staticReflector);\n var typeCheckCompiler = new TypeCheckCompiler(options, staticReflector);\n var compiler = new AotCompiler(config, options, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver), viewCompiler, typeCheckCompiler, new NgModuleCompiler(staticReflector), new InjectableCompiler(staticReflector, !!options.enableIvy), new TypeScriptEmitter(), summaryResolver, symbolResolver);\n return { compiler: compiler, reflector: staticReflector };\n}", "function createAotCompiler(compilerHost, options, errorCollector) {\n var translations = options.translations || '';\n var urlResolver = createAotUrlResolver(compilerHost);\n var symbolCache = new StaticSymbolCache();\n var summaryResolver = new AotSummaryResolver(compilerHost, symbolCache);\n var symbolResolver = new StaticSymbolResolver(compilerHost, symbolCache, summaryResolver);\n var staticReflector = new StaticReflector(summaryResolver, symbolResolver, [], [], errorCollector);\n var htmlParser;\n if (!!options.enableIvy) {\n // Ivy handles i18n at the compiler level so we must use a regular parser\n htmlParser = new HtmlParser();\n }\n else {\n htmlParser = new I18NHtmlParser(new HtmlParser(), translations, options.i18nFormat, options.missingTranslation, console);\n }\n var config = new CompilerConfig({\n defaultEncapsulation: ViewEncapsulation.Emulated,\n useJit: false,\n missingTranslation: options.missingTranslation,\n preserveWhitespaces: options.preserveWhitespaces,\n strictInjectionParameters: options.strictInjectionParameters,\n });\n var normalizer = new DirectiveNormalizer({ get: function (url) { return compilerHost.loadResource(url); } }, urlResolver, htmlParser, config);\n var expressionParser = new Parser(new Lexer());\n var elementSchemaRegistry = new DomElementSchemaRegistry();\n var tmplParser = new TemplateParser(config, staticReflector, expressionParser, elementSchemaRegistry, htmlParser, console, []);\n var resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector, errorCollector);\n // TODO(vicb): do not pass options.i18nFormat here\n var viewCompiler = new ViewCompiler(staticReflector);\n var typeCheckCompiler = new TypeCheckCompiler(options, staticReflector);\n var compiler = new AotCompiler(config, options, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver), viewCompiler, typeCheckCompiler, new NgModuleCompiler(staticReflector), new InjectableCompiler(staticReflector, !!options.enableIvy), new TypeScriptEmitter(), summaryResolver, symbolResolver);\n return { compiler: compiler, reflector: staticReflector };\n}", "function __JUAssert(){;}", "async run(): Promise<bool> {\n let deps = await this.getDeps()\n console.log(`Starting search for ${deps.length} deps.\\n`)\n\n let successes:TypeResult[] = []\n for (let dep of deps) {\n let typings = await this.checkDefinitelyTyped(dep)\n if (typings.status) {\n console.log(`found Typings for ${dep}`)\n successes.push(typings)\n }\n }\n\n if (successes) {\n let names = successes.map((result: TypeResult) => { return \"@types/\" + result.dep })\n console.log(\"\\nYou can install the following types:\")\n console.log(`\\n $ npm install ${names.join(\" \")} --save --only=dev`)\n } else {\n console.log(\"Could not find any types\")\n }\n\n return true\n }", "function createAotCompiler(compilerHost, options, errorCollector) {\n var translations = options.translations || '';\n var urlResolver = createAotUrlResolver(compilerHost);\n var symbolCache = new StaticSymbolCache();\n var summaryResolver = new AotSummaryResolver(compilerHost, symbolCache);\n var symbolResolver = new StaticSymbolResolver(compilerHost, symbolCache, summaryResolver);\n var staticReflector = new StaticReflector(summaryResolver, symbolResolver, [], [], errorCollector);\n var htmlParser;\n\n if (!!options.enableIvy) {\n // Ivy handles i18n at the compiler level so we must use a regular parser\n htmlParser = new HtmlParser();\n } else {\n htmlParser = new I18NHtmlParser(new HtmlParser(), translations, options.i18nFormat, options.missingTranslation, console);\n }\n\n var config = new CompilerConfig({\n defaultEncapsulation: ViewEncapsulation.Emulated,\n useJit: false,\n missingTranslation: options.missingTranslation,\n preserveWhitespaces: options.preserveWhitespaces,\n strictInjectionParameters: options.strictInjectionParameters\n });\n var normalizer = new DirectiveNormalizer({\n get: function get(url) {\n return compilerHost.loadResource(url);\n }\n }, urlResolver, htmlParser, config);\n var expressionParser = new Parser$1(new Lexer());\n var elementSchemaRegistry = new DomElementSchemaRegistry();\n var tmplParser = new TemplateParser(config, staticReflector, expressionParser, elementSchemaRegistry, htmlParser, console, []);\n var resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector, errorCollector); // TODO(vicb): do not pass options.i18nFormat here\n\n var viewCompiler = new ViewCompiler(staticReflector);\n var typeCheckCompiler = new TypeCheckCompiler(options, staticReflector);\n var compiler = new AotCompiler(config, options, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver), viewCompiler, typeCheckCompiler, new NgModuleCompiler(staticReflector), new InjectableCompiler(staticReflector, !!options.enableIvy), new TypeScriptEmitter(), summaryResolver, symbolResolver);\n return {\n compiler: compiler,\n reflector: staticReflector\n };\n}", "function checkBuildMode() {\n\tconst browser = process.argv[2]\n\ttestMode = process.argv[3] === 'test' ? true : false\n\n\tif (!buildTargets.includes(browser)) {\n\t\terror(`Invalid build mode requested: expected one of [${buildTargets}] but received '${browser}'`)\n\t}\n\n\tif (testMode && browser !== 'chrome') {\n\t\terror('Test build requested for browser(s) other than Chrome. This is not advisable: e.g. for Firefox, a version number such as \"2.1.0alpha1\" can be set instead and the extension uploaded to the beta channel. Only Chrome needs a separate extension listing for test versions.')\n\t}\n\n\treturn browser === 'all' ? validBrowsers : [browser]\n}", "function check() {\n\n console.log(chalk.cyan('Checking if requiresafe installed...'));\n exec('requiresafe', function(err, stdout, stderr) {\n // Check if there were any errors\n if ( err ) {\n process.stderr.write(chalk.red('requiresafe not found, please make sure it is installed before proceding.\\nError: ', err, '\\n\\n'));\n process.exit(1);\n }\n\n else if ( stdout.length ) {\n console.log('requiresafe found!\\n');\n console.log(chalk.cyan('Checking if authenticated with requiresafe...'));\n if ( config && config.token ) {\n console.log('it would appear you have authenticated with requiresafe.\\n');\n console.log(chalk.green('Check Successful!'));\n process.exit();\n }\n else {\n process.stderr.write(chalk.red('you have not authenticated with requiresafe, please run: requiresafe login\\n\\n'));\n process.exit(1);\n }\n }\n });\n}", "function bfCheckLibConfiguration() {\n\n //check that the names of mandatory HTML elements are defined\n if (typeof elementDebugText === 'undefined' || bfIsInvalidElement(elementDebugText))\n alert(\"Debug text element (elementDebugText) is not defined\");\n\n if (typeof elementOutputText === 'undefined' || bfIsInvalidElement(elementOutputText))\n alert(\"Output text element (elementOutputText) is not defined\");\n\n if (typeof elementSpinDiv === 'undefined' || bfIsInvalidElement(elementSpinDiv))\n alert(\"Spin div element is not defined\");\n\n //check that various variables are properly declared and defined\n if (typeof apiKey === 'undefined' || bfIsInvalidStr(apiKey))\n alert(\"API key (apiKey) is not defined\");\n\n if (typeof containerPrefix === 'undefined' || bfIsInvalidStr(containerPrefix))\n alert(\"Container prefix (containerPrefix) is not defined\");\n\n //empty container name is OK\n if (typeof containerName === 'undefined')\n alert(\"Container name variable (containerPrefix) is not declared\");\n\n if (typeof testrigName === 'undefined' || bfIsInvalidStr(testrigName))\n alert(\"Testrig name (testrigName) is not defined\");\n\n if (typeof envName === 'undefined' || bfIsInvalidStr(envName))\n alert(\"Environment name (envName) is not defined\");\n\n if (typeof diffEnvName === 'undefined')\n alert(\"Differential environment name (diffEnvName) is not declared\");\n\n if (typeof testrigZip === 'undefined')\n alert(\"Testrig zip variable (testrigZip) is not declared\");\n\n}", "function Compiler () {\n this.importPath = []\n this.entryFile = null\n this.typeSystem = new TypeSystem()\n this.parser = new Parser()\n // Setup the default import path\n var extDir = path.join(path.dirname(__filename), '..', 'ext')\n this.importPath.push(extDir)\n}", "function checkCode(code)\n{\n\tlet result = TScript.parse(code);\n\tif (result.hasOwnProperty(\"errors\") && result.errors.length > 0) throw result.errors[0].message;\n\tlet interpreter = new TScript.Interpreter(result.program);\n\tinterpreter.reset();\n\tinterpreter.service.message = function(msg) { throw msg; }\n\tinterpreter.service.documentation_mode = true;\n\twhile (interpreter.status == \"running\" || interpreter.status == \"waiting\") interpreter.exec_step();\n\tif (interpreter.status != \"finished\") alert(\"code sample failed to run:\\n\" + code);\n}", "function createClosureModeGuard() {\n return typeofExpr(variable(NG_I18N_CLOSURE_MODE)).notIdentical(literal('undefined', STRING_TYPE)).and(variable(NG_I18N_CLOSURE_MODE));\n}", "get compilerObject() {\r\n return this._compilerObject;\r\n }", "_isValidContext() {\n const isNode = (typeof process !== 'undefined')\n && (typeof process.release !== 'undefined')\n && (process.release.name === 'node');\n return isNode;\n }", "function assertUint8ArrayAvailable() {\n if (typeof Uint8Array === 'undefined') {\n throw new __WEBPACK_IMPORTED_MODULE_2__util_error__[\"a\" /* FirestoreError */](__WEBPACK_IMPORTED_MODULE_2__util_error__[\"b\" /* Code */].UNIMPLEMENTED, 'Uint8Arrays are not available in this environment.');\n }\n}", "function assertUint8ArrayAvailable() {\n if (typeof Uint8Array === 'undefined') {\n throw new __WEBPACK_IMPORTED_MODULE_2__util_error__[\"a\" /* FirestoreError */](__WEBPACK_IMPORTED_MODULE_2__util_error__[\"b\" /* Code */].UNIMPLEMENTED, 'Uint8Arrays are not available in this environment.');\n }\n}", "function warnIfUnsupported () {\n const [major, minor] = process.versions.node.split('.').map(Number)\n if (\n major < 16 ||\n (major === 16 && minor < 17) ||\n (major === 18 && minor < 7)) {\n console.error('WARNING: Esbuild support isn\\'t available for older versions of Node.js.')\n console.error(`Expected: Node.js >=v16.17 or >=v18.7. Actual: Node.js = ${process.version}.`)\n console.error('This application may build properly with this version of Node.js, but unless a')\n console.error('more recent version is used at runtime, third party packages won\\'t be instrumented.')\n }\n}", "check (cb) {\n if (this.checked) return cb()\n binWrapper.run(['version'], (err) => {\n // The binary is ok if no error poped up\n this.checked = !err\n return cb(err)\n })\n }" ]
[ "0.7280039", "0.6609343", "0.5701623", "0.55071414", "0.5359753", "0.5310645", "0.5287135", "0.5255695", "0.5185235", "0.51780653", "0.51780653", "0.510953", "0.50870246", "0.5071456", "0.5061714", "0.50458944", "0.50141674", "0.49524596", "0.49390462", "0.4907709", "0.4905424", "0.4905424", "0.4905424", "0.4905424", "0.48802313", "0.48529014", "0.48484248", "0.48188427", "0.4784693", "0.47592968", "0.47391728", "0.4736301", "0.47219598", "0.47135553", "0.47067124", "0.4666223", "0.4666223", "0.4663273", "0.46576327", "0.46484098", "0.4645288", "0.46386406", "0.46380222", "0.46380222", "0.46380222", "0.46380222", "0.46380222", "0.46373263", "0.46373263", "0.46373263", "0.46373263", "0.46373263", "0.4633518", "0.46310878", "0.46282828", "0.46204954", "0.46204954", "0.46204954", "0.46204954", "0.46161446", "0.46141553", "0.46083316", "0.46036398", "0.46006322", "0.4593826", "0.45894998", "0.45855418", "0.45686185", "0.45563954", "0.45532265", "0.45527393", "0.45490214", "0.45406464", "0.4535439", "0.45335978", "0.45302135", "0.45302135", "0.4522191", "0.45170924", "0.45022547", "0.4464877", "0.44618702", "0.44573712", "0.4456806", "0.4456008", "0.4441731", "0.4440812", "0.44373223", "0.4435697", "0.4435697", "0.44347328", "0.44280195" ]
0.7297869
6
Assert the processor is not frozen.
function assertUnfrozen(name, frozen) { if (frozen) { throw new Error( [ 'Cannot invoke `' + name + '` on a frozen processor.\nCreate a new ', 'processor first, by invoking it: use `processor()` instead of ', '`processor`.' ].join('') ) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot invoke `' + name + '` on a frozen processor.\\n' +\n 'Create a new processor first, by invoking it: ' +\n 'use `processor()` instead of `processor`.'\n );\n }\n}", "function assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot invoke `' +\n name +\n '` on a frozen processor.\\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.'\n )\n }\n}", "function assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot invoke `' +\n name +\n '` on a frozen processor.\\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.'\n )\n }\n}", "function assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot invoke `' +\n name +\n '` on a frozen processor.\\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.'\n )\n }\n}", "function assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot invoke `' +\n name +\n '` on a frozen processor.\\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.'\n )\n }\n}", "function freeze() {\n _isFrozen = true;\n }", "didFreeze() {\n Ember.debug('didFreeze', arguments);\n this.set('isFrozen', true);\n }", "freeze() {\n\t\tthis._isFrozen = true\n\t}", "function skipWaiting() {\n // Just call self.skipWaiting() directly.\n // See https://github.com/GoogleChrome/workbox/issues/2525\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`skipWaiting() from workbox-core is no longer recommended ` +\n `and will be removed in Workbox v7. Using self.skipWaiting() instead ` +\n `is equivalent.`);\n }\n void self.skipWaiting();\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n }", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n }", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n }", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n }", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n }", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n }", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n }", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n }", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n }", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n }", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n }", "function warnIfUnmockedScheduler(fiber) {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n error(\"In Concurrent or Sync modes, the \\\"scheduler\\\" module needs to be mocked to guarantee consistent behaviour across tests and browsers. For example, with jest: \\njest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\nFor more info, visit https://reactjs.org/link/mock-scheduler\");\n }\n }\n }", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (\n didWarnAboutUnmockedScheduler === false &&\n Scheduler.unstable_flushAllWithoutAsserting === undefined\n ) {\n if (\n fiber.mode & BlockingMode ||\n fiber.mode & ConcurrentMode\n ) {\n didWarnAboutUnmockedScheduler = true;\n\n error(\n 'In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' +\n 'to guarantee consistent behaviour across tests and browsers. ' +\n 'For example, with jest: \\n' +\n \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" +\n 'For more info, visit https://fb.me/react-mock-scheduler',\n );\n }\n }\n }\n }", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n\n error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + // Break up requires to avoid accidentally parsing them as dependencies.\n \"jest.mock('scheduler', () => require\" + \"('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://reactjs.org/link/mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber){{if(didWarnAboutUnmockedScheduler===false&&Scheduler.unstable_flushAllWithoutAsserting===undefined){if(fiber.mode&BlockingMode||fiber.mode&ConcurrentMode){didWarnAboutUnmockedScheduler=true;error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked '+'to guarantee consistent behaviour across tests and browsers. '+'For example, with jest: \\n'+// Break up requires to avoid accidentally parsing them as dependencies.\n\"jest.mock('scheduler', () => require\"+\"('scheduler/unstable_mock'));\\n\\n\"+'For more info, visit https://reactjs.org/link/mock-scheduler');}}}}", "function warnIfUnmockedScheduler(fiber){{if(didWarnAboutUnmockedScheduler===false&&Scheduler.unstable_flushAllWithoutAsserting===undefined){if(fiber.mode&BlockingMode||fiber.mode&ConcurrentMode){didWarnAboutUnmockedScheduler=true;error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked '+'to guarantee consistent behaviour across tests and browsers. '+'For example, with jest: \\n'+// Break up requires to avoid accidentally parsing them as dependencies.\n\"jest.mock('scheduler', () => require\"+\"('scheduler/unstable_mock'));\\n\\n\"+'For more info, visit https://reactjs.org/link/mock-scheduler');}}}}", "function unfreeze() {\n _isFrozen = false;\n }", "function warnIfUnmockedScheduler(fiber){{if(didWarnAboutUnmockedScheduler===false&&Scheduler.unstable_flushAllWithoutAsserting===undefined){if(fiber.mode&BlockingMode||fiber.mode&ConcurrentMode){didWarnAboutUnmockedScheduler=true;error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked '+'to guarantee consistent behaviour across tests and browsers. '+'For example, with jest: \\n'+\"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\"+'For more info, visit https://fb.me/react-mock-scheduler');}}}}", "function warnIfUnmockedScheduler(fiber){{if(didWarnAboutUnmockedScheduler===false&&Scheduler.unstable_flushAllWithoutAsserting===undefined){if(fiber.mode&BlockingMode||fiber.mode&ConcurrentMode){didWarnAboutUnmockedScheduler=true;error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked '+'to guarantee consistent behaviour across tests and browsers. '+'For example, with jest: \\n'+\"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\"+'For more info, visit https://fb.me/react-mock-scheduler');}}}}", "function warnIfUnmockedScheduler(fiber){{if(didWarnAboutUnmockedScheduler===false&&Scheduler.unstable_flushAllWithoutAsserting===undefined){if(fiber.mode&BlockingMode||fiber.mode&ConcurrentMode){didWarnAboutUnmockedScheduler=true;error('In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked '+'to guarantee consistent behaviour across tests and browsers. '+'For example, with jest: \\n'+\"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\"+'For more info, visit https://fb.me/react-mock-scheduler');}}}}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n } else if (warnAboutUnmockedScheduler === true) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'Starting from React v17, the \"scheduler\" module will need to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n } else if (warnAboutUnmockedScheduler === true) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'Starting from React v17, the \"scheduler\" module will need to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n } else if (warnAboutUnmockedScheduler === true) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'Starting from React v17, the \"scheduler\" module will need to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BatchedMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n } else if (warnAboutUnmockedScheduler === true) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'Starting from React v17, the \"scheduler\" module will need to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n }", "function skipWaiting() {\n\n self.skipWaiting();\n }", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BatchedMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n } else if (warnAboutUnmockedScheduler === true) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'Starting from React v17, the \"scheduler\" module will need to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BatchedMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n } else if (warnAboutUnmockedScheduler === true) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'Starting from React v17, the \"scheduler\" module will need to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BatchedMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n } else if (warnAboutUnmockedScheduler === true) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'Starting from React v17, the \"scheduler\" module will need to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BatchedMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n } else if (warnAboutUnmockedScheduler === true) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'Starting from React v17, the \"scheduler\" module will need to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function warnIfUnmockedScheduler(fiber) {\n {\n if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {\n if (fiber.mode & BatchedMode || fiber.mode & ConcurrentMode) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n } else if (warnAboutUnmockedScheduler === true) {\n didWarnAboutUnmockedScheduler = true;\n warningWithoutStack$1(false, 'Starting from React v17, the \"scheduler\" module will need to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \\n' + \"jest.mock('scheduler', () => require('scheduler/unstable_mock'));\\n\\n\" + 'For more info, visit https://fb.me/react-mock-scheduler');\n }\n }\n }\n}", "function unless_(self, b, __trace) {\n return (0, _core.suspend)(() => b() ? _core.unit : (0, _asUnit.asUnit)(self), __trace);\n}", "function isFrozen(obj) {\n if (!obj) { return true; }\n // TODO(erights): Object(<primitive>) wrappers should also be\n // considered frozen.\n if (obj.FROZEN___ === obj) { return true; }\n var t = typeof obj;\n return t !== 'object' && t !== 'function';\n }", "_ensureEmptyStackBarrier() {\n if (!this._emptyStackBarrier) {\n this._emptyStackBarrier = scheduleNextPossibleRun(this._executeEmptyStackBarrier);\n }\n }", "function specOnlyIsInstructionStateEmpty() {\n return instructionState.lFrame.parent === null;\n}", "function assert(){\n called = true;\n }", "function specOnlyIsInstructionStateEmpty() {\n return instructionState.lFrame.parent === null;\n }", "function specOnlyIsInstructionStateEmpty() {\n return instructionState.lFrame.parent === null;\n}", "function specOnlyIsInstructionStateEmpty() {\n return instructionState.lFrame.parent === null;\n}", "function specOnlyIsInstructionStateEmpty() {\n return instructionState.lFrame.parent === null;\n}", "function specOnlyIsInstructionStateEmpty() {\n return instructionState.lFrame.parent === null;\n}", "function specOnlyIsInstructionStateEmpty() {\n return instructionState.lFrame.parent === null;\n}", "function specOnlyIsInstructionStateEmpty() {\n return instructionState.lFrame.parent === null;\n}", "unabledOrDisableFreezeGraph() {\n this.frozen = !this.frozen;\n this.nodes.forEach(d => d.fixed = this.frozen);\n }", "function objectFrozen(obj){if(!Object.isFrozen){return false;}return Object.isFrozen(obj);}", "function unless(b, __trace) {\n return self => (0, _core.suspend)(() => b() ? _core.unit : (0, _asUnit.asUnit)(self), __trace);\n}", "static get NOT_READY () {return 0}", "get executionInvariant() {\n return this.state.executionCount < 4;\n }", "function $deny_frozen_access(obj) {\n if (obj.$$frozen) {\n $raise(Opal.FrozenError, \"can't modify frozen \" + (obj.$class()) + \": \" + (obj), Opal.hash2([\"receiver\"], {\"receiver\": obj}));\n }\n }", "function assertRunning() {\r\n assert(testCase.debugContext.started, \" Command is only valid in a running script.\");\r\n}" ]
[ "0.763147", "0.762365", "0.762365", "0.762365", "0.762365", "0.6224439", "0.6096795", "0.5899092", "0.5878287", "0.570214", "0.570214", "0.570214", "0.570214", "0.570214", "0.570214", "0.5657232", "0.5657232", "0.5657232", "0.5657232", "0.5657232", "0.56491834", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56472737", "0.56182", "0.5611338", "0.5611338", "0.5611338", "0.5611338", "0.5611338", "0.5611338", "0.5611338", "0.5611338", "0.5611338", "0.5611338", "0.5611338", "0.5611338", "0.5611338", "0.5611338", "0.5611338", "0.5611338", "0.56031394", "0.56031394", "0.5574563", "0.5565516", "0.5565516", "0.5565516", "0.54054725", "0.54054725", "0.54054725", "0.5399141", "0.5397016", "0.53570884", "0.53570884", "0.53570884", "0.53570884", "0.53570884", "0.52707064", "0.5263045", "0.5246165", "0.5233749", "0.52330637", "0.52001274", "0.51999843", "0.51999843", "0.51999843", "0.51999843", "0.51999843", "0.51999843", "0.51883054", "0.51880515", "0.51110923", "0.509201", "0.50831735", "0.5077492", "0.49902984" ]
0.7521065
8
Assert `node` is a Unist node.
function assertNode(node) { if (!node || !string(node.type)) { throw new Error('Expected node, got `' + node + '`') } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertNode(node) {\n if (!node || !string(node.type)) {\n throw new Error('Expected node, got `' + node + '`');\n }\n}", "function assertNode(node) {\n if (!node || typeof node.type !== 'string') {\n throw new Error('Expected node, got `' + node + '`')\n }\n}", "function assertNode(node) {\n if (!node || typeof node.type !== 'string') {\n throw new Error('Expected node, got `' + node + '`')\n }\n}", "function assertNode(node) {\n if (!node || typeof node.type !== 'string') {\n throw new Error('Expected node, got `' + node + '`')\n }\n}", "function assertNode(node) {\n if (!node || typeof node.type !== 'string') {\n throw new Error('Expected node, got `' + node + '`')\n }\n}", "function _assertUnremoved() {\n if (this.removed) {\n throw this.errorWithNode(\"NodePath has been removed so is read-only.\");\n }\n}", "function _assertUnremoved() {\n if (this.removed) {\n throw this.errorWithNode(\"NodePath has been removed so is read-only.\");\n }\n}", "function _assertUnremoved() {\n\t if (this.removed) {\n\t throw this.errorWithNode(\"NodePath has been removed so is read-only.\");\n\t }\n\t}", "function _assertUnremoved() {\n\t if (this.removed) {\n\t throw this.errorWithNode(\"NodePath has been removed so is read-only.\");\n\t }\n\t}", "function assertNodeType(node, type) {\n var typedNode = checkNodeType(node, type);\n\n if (!typedNode) {\n throw new Error(\"Expected node of type \" + type + \", but got \" + (node ? \"node of type \" + node.type : String(node)));\n } // $FlowFixMe: Unsure why.\n\n\n return typedNode;\n}", "function assertNodeType(node, type) {\n var typedNode = checkNodeType(node, type);\n\n if (!typedNode) {\n throw new Error(\"Expected node of type \" + type + \", but got \" + (node ? \"node of type \" + node.type : String(node)));\n } // $FlowFixMe: Unsure why.\n\n\n return typedNode;\n}", "function assertNodeType(node, type) {\n var typedNode = checkNodeType(node, type);\n\n if (!typedNode) {\n throw new Error(\"Expected node of type \" + type + \", but got \" + (node ? \"node of type \" + node.type : String(node)));\n } // $FlowFixMe: Unsure why.\n\n\n return typedNode;\n}", "function uunodehas(node, // @param Node: child node\r\n context) { // @param Node: context(parent) node\r\n // @return Boolean:\r\n for (var c = node; c && c !== context;) {\r\n c = c.parentNode;\r\n }\r\n return node !== context && c === context;\r\n}", "function isNode(x) {\n return x !== null && typeof x === \"object\" && typeof x.type === \"string\";\n}", "function assertListContent(node) {\n if (!isListContent(node)) {\n throw new Error('Node is not a ListContent');\n }\n}", "static canInflect (node) {\n return false\n }", "static canInflect (node) {\n return false\n }", "static canInflect (node) {\n return false\n }", "static canInflect (node) {\n return false\n }", "static canInflect (node) {\n return true\n }", "static canInflect (node) {\n return true\n }", "static isNode(n) {\n return n && typeof n === \"object\" && typeof n.type === \"string\";\n }", "function U(t,e){return typeof t===e}", "function checkTypeAnnotationAsExpression(node) {\n checkTypeNodeAsExpression(node.type);\n }", "function isNode(node) {\r\n return node && node.nodeType && node.nodeName &&\r\n toString.call(node) === '[object Node]';\r\n }", "function hc_nodeelementnodename() {\n var success;\n var doc;\n var elementNode;\n var elementName;\n doc = load(\"hc_staff\");\n elementNode = doc.documentElement;\n\n elementName = elementNode.nodeName;\n\n \n\tif(\n\t\n\t(builder.contentType == \"image/svg+xml\")\n\n\t) {\n\tassertEquals(\"svgNodeName\",\"svg\",elementName);\n \n\t}\n\t\n\t\telse {\n\t\t\tassertEqualsAutoCase(\"element\", \"nodeName\",\"html\",elementName);\n \n\t\t}\n\t\n}", "function assertAtomFamily(node, family) {\n var typedNode = checkAtomFamily(node, family);\n\n if (!typedNode) {\n throw new Error(\"Expected node of type \\\"atom\\\" and family \\\"\" + family + \"\\\", but got \" + (node ? node.type === \"atom\" ? \"atom of family \" + node.family : \"node of type \" + node.type : String(node)));\n }\n\n return typedNode;\n}", "function assertAtomFamily(node, family) {\n var typedNode = checkAtomFamily(node, family);\n\n if (!typedNode) {\n throw new Error(\"Expected node of type \\\"atom\\\" and family \\\"\" + family + \"\\\", but got \" + (node ? node.type === \"atom\" ? \"atom of family \" + node.family : \"node of type \" + node.type : String(node)));\n }\n\n return typedNode;\n}", "function assertAtomFamily(node, family) {\n var typedNode = checkAtomFamily(node, family);\n\n if (!typedNode) {\n throw new Error(\"Expected node of type \\\"atom\\\" and family \\\"\" + family + \"\\\", but got \" + (node ? node.type === \"atom\" ? \"atom of family \" + node.family : \"node of type \" + node.type : String(node)));\n }\n\n return typedNode;\n}", "function isTypeAssertion(node) {\n if (!node) {\n return false;\n }\n return (node.type === ts_estree_1.AST_NODE_TYPES.TSAsExpression ||\n node.type === ts_estree_1.AST_NODE_TYPES.TSTypeAssertion);\n}", "function TNode(){}", "function assertNodeDetails(convertedNode, jenkinsNode) {\n assert.equal(convertedNode.name, jenkinsNode.displayName, 'name');\n assert.equal(convertedNode.id, jenkinsNode.id, 'id');\n}", "function checkSubtree() {\n \n}", "function isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement;\n }", "function validateNode(node) {\n return [\n node.type === \"Literal\" && typeof node.value === \"string\"\n ];\n}", "function node(){}", "function uunodeidremove(node) { // @param Node:\r\n // @return Node: removed node\r\n node.uuguid && (uunodeid._db[node.uuguid] = null, node.uuguid = null);\r\n return node;\r\n}", "function isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement;\n }", "function _crossCheck (node) {\n if (!ecma.util.isa(node, CNode)) {\n throw new Error('child is not a data node');\n }\n if (node.parentNode !== this) {\n throw new Error('child belongs to another parent');\n }\n }", "function checkIfAncestorElement(element, node) {\n if (!element.contains(node)) {\n hideElement(element);\n }\n}", "function unflowedTest( node){\n\tconst open= openTest( node)\n\tif( !open){\n\t\treturn false\n\t}\n\n\tconst tag= lastTag= open[ 1];\n\tlet closeTest= closeTests[ tag]\n\tif( !closeTest){\n\t\tconst re= new RegExp( `</\\s*${open[ 1]}\\s*>\\s*$`)\n\t\tcloseTest= closeTests[ tag]= makeNodeTest( re)\n\t}\n\n\t// check to see if this node closes\n\tif( closeTest(node.value)){\n\t\treturn false\n\t}\n\n\t// return the tester to find the closing pair\n\treturn closeTest\n}", "function isTypeAssertion(node) {\n if (!node) {\n return false;\n }\n return (node.type === experimental_utils_1.AST_NODE_TYPES.TSAsExpression ||\n node.type === experimental_utils_1.AST_NODE_TYPES.TSTypeAssertion);\n}", "function _verifyNodeList(nodes) {\n\t if (nodes.constructor !== Array) {\n\t nodes = [nodes];\n\t }\n\n\t for (var i = 0; i < nodes.length; i++) {\n\t var node = nodes[i];\n\t if (!node) {\n\t throw new Error(\"Node list has falsy node with the index of \" + i);\n\t } else if (typeof node !== \"object\") {\n\t throw new Error(\"Node list contains a non-object node with the index of \" + i);\n\t } else if (!node.type) {\n\t throw new Error(\"Node list contains a node without a type with the index of \" + i);\n\t } else if (node instanceof _index2[\"default\"]) {\n\t nodes[i] = node.node;\n\t }\n\t }\n\n\t return nodes;\n\t}", "function _verifyNodeList(nodes) {\n\t if (nodes.constructor !== Array) {\n\t nodes = [nodes];\n\t }\n\n\t for (var i = 0; i < nodes.length; i++) {\n\t var node = nodes[i];\n\t if (!node) {\n\t throw new Error(\"Node list has falsy node with the index of \" + i);\n\t } else if (typeof node !== \"object\") {\n\t throw new Error(\"Node list contains a non-object node with the index of \" + i);\n\t } else if (!node.type) {\n\t throw new Error(\"Node list contains a node without a type with the index of \" + i);\n\t } else if (node instanceof _index2[\"default\"]) {\n\t nodes[i] = node.node;\n\t }\n\t }\n\n\t return nodes;\n\t}", "function _verifyNodeList(nodes) {\n if (nodes.constructor !== Array) {\n nodes = [nodes];\n }\n\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n if (!node) {\n throw new Error(\"Node list has falsy node with the index of \" + i);\n } else if (typeof node !== \"object\") {\n throw new Error(\"Node list contains a non-object node with the index of \" + i);\n } else if (!node.type) {\n throw new Error(\"Node list contains a node without a type with the index of \" + i);\n } else if (node instanceof _index2[\"default\"]) {\n nodes[i] = node.node;\n }\n }\n\n return nodes;\n}", "function hasBlacklistedType(node, parent, scope, state) {\n if (node.type === state.type) {\n state.has = true;\n this.skip();\n }\n}", "static isOfMyType(node) {\n return true; // default implementation: if the tagname matches, it's mine.\n }", "function uid2node(uid) { // @param String: unique id\r\n // @return Node/undefined:\r\n return _uid2node[uid];\r\n}", "function assertDefinition(node) {\n if (!isDefinition(node)) {\n throw new Error('Node is not a Definition');\n }\n}", "function isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n }", "function hasBlacklistedType(node, parent, scope, state) {\n\t if (node.type === state.type) {\n\t state.has = true;\n\t this.skip();\n\t }\n\t}", "function hasBlacklistedType(node, parent, scope, state) {\n\t if (node.type === state.type) {\n\t state.has = true;\n\t this.skip();\n\t }\n\t}", "function TNode() {}", "function TNode() {}", "function TNode() {}", "function isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}", "function isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}", "function isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}", "function isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}", "function isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}", "function isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}", "function notAlreadyMarked(node) {\n \"use strict\";\n return ($(node).closest(\"a.gloss\").length === 0);\n}", "expectItemType() {\n cy.log('Common.Editor.expectItemType');\n this.element.find(this.itemIcon)\n .should('exist');\n }", "function isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}", "function isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}", "function isUsableNode(node){\r\n\t\tvar tgN = node.tagName,\r\n\t\t\tinputNodeType, data, retVal;\r\n\t\t\t\r\n\t\tif(!node.dataset) node.dataset = {};\r\n\t\t\r\n\t\tdata = node.dataset;\r\n\t\t\r\n\t\tif(data && typeof data[CACHE_DATASET_STRING] !== \"undefined\")\r\n\t\t\tretVal = data[CACHE_DATASET_STRING] === \"true\";\r\n\t\t\r\n\t\telse if(isParent(node, null, [\"CodeMirror\", \"ace\"], 3))\r\n\t\t\tretVal = false;\r\n\t\t\r\n\t\telse if(tgN === \"TEXTAREA\" || isContentEditable(node))\r\n\t\t\tretVal = true;\r\n\t\t\r\n\t\telse if(tgN === \"INPUT\"){\r\n\t\t\tinputNodeType = node.getAttribute(\"type\");\r\n\t\t\tretVal = allowedInputElms.indexOf(inputNodeType) > -1;\r\n\t\t}\t\t\r\n\t\telse retVal = false;\r\n\t\t\r\n\t\tnode.dataset[CACHE_DATASET_STRING] = retVal;\r\n\t\t\r\n\t\treturn retVal;\r\n\t}", "function UntouchabilityChecker(elementDocument) {\n this.doc = elementDocument;\n // Node cache must be refreshed on every check, in case\n // the content of the element has changed. The cache contains tuples\n // mapping nodes to their boolean result.\n this.cache = [];\n}", "function UntouchabilityChecker(elementDocument) {\n this.doc = elementDocument;\n // Node cache must be refreshed on every check, in case\n // the content of the element has changed. The cache contains tuples\n // mapping nodes to their boolean result.\n this.cache = [];\n}", "function UntouchabilityChecker(elementDocument) {\n this.doc = elementDocument;\n // Node cache must be refreshed on every check, in case\n // the content of the element has changed. The cache contains tuples\n // mapping nodes to their boolean result.\n this.cache = [];\n}", "function UntouchabilityChecker(elementDocument) {\n this.doc = elementDocument;\n // Node cache must be refreshed on every check, in case\n // the content of the element has changed. The cache contains tuples\n // mapping nodes to their boolean result.\n this.cache = [];\n}", "function isNodeFromTemplate(node) {\n if (isFalse$3(node instanceof Node)) {\n return false;\n } // TODO [#1250]: skipping the shadowRoot instances itself makes no sense, we need to revisit\n // this with locker\n\n\n if (node instanceof ShadowRoot) {\n return false;\n }\n\n if (useSyntheticShadow) {\n // TODO [#1252]: old behavior that is still used by some pieces of the platform,\n // specifically, nodes inserted manually on places where `lwc:dom=\"manual\"` directive is not\n // used, will be considered global elements.\n if (isUndefined$4(node.$shadowResolver$)) {\n return false;\n }\n }\n\n const root = node.getRootNode();\n return root instanceof ShadowRoot;\n }", "function checkNode(node, prefix) {\n if (node instanceof Bucket) {\n var contacts = node.obtain();\n for (var i = 0; i < contacts.length; ++i) {\n for (var j = 0; j < prefix.length; ++j) {\n contacts[i].id.at(j).should.equal(prefix[j]);\n }\n }\n } else {\n checkNode(node.left, prefix.concat(false));\n checkNode(node.right, prefix.concat(true));\n }\n}", "function testType(d, type) {\n return node_by_id[d.source].type === type || node_by_id[d.target].type === type;\n } //A version that has to be used after the simulations have run", "function isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n }", "function isNode(nodeImpl) {\n return Boolean(nodeImpl && \"nodeType\" in nodeImpl);\n}", "function _isNode(o){\n return (\n typeof Node === \"object\" ? o instanceof Node : \n o && typeof o === \"object\" && typeof o.nodeType === \"number\" && typeof o.nodeName===\"string\"\n );\n }", "function nodeTest(assert) { \n let name = nodeStore.address[assert.loc.toString()].name; \n let index = nodeStore.address[assert.loc.toString()].index; \n let result = `${oneSpace}expect(wrapper.find('${name}').at(${index}).props().${assert.property}).`;\n result += evalTest(assert); \n return result;\n}", "function isInferrable(node, init) {\n if (node.type !== typescript_estree_1.AST_NODE_TYPES.TSTypeAnnotation ||\n !node.typeAnnotation) {\n return false;\n }\n const annotation = node.typeAnnotation;\n if (annotation.type === typescript_estree_1.AST_NODE_TYPES.TSStringKeyword) {\n if (init.type === typescript_estree_1.AST_NODE_TYPES.Literal) {\n return typeof init.value === 'string';\n }\n return false;\n }\n if (annotation.type === typescript_estree_1.AST_NODE_TYPES.TSBooleanKeyword) {\n return init.type === typescript_estree_1.AST_NODE_TYPES.Literal;\n }\n if (annotation.type === typescript_estree_1.AST_NODE_TYPES.TSNumberKeyword) {\n // Infinity is special\n if ((init.type === typescript_estree_1.AST_NODE_TYPES.UnaryExpression &&\n init.operator === '-' &&\n init.argument.type === typescript_estree_1.AST_NODE_TYPES.Identifier &&\n init.argument.name === 'Infinity') ||\n (init.type === typescript_estree_1.AST_NODE_TYPES.Identifier && init.name === 'Infinity')) {\n return true;\n }\n return (init.type === typescript_estree_1.AST_NODE_TYPES.Literal && typeof init.value === 'number');\n }\n return false;\n }", "function isSpecialNode(nodeString)\n{\n return(nodeString[0] == '_');\n}", "function TypeofTypeAnnotation(node, print) {\n this.push(\"typeof \");\n print.plain(node.argument);\n}", "function TypeofTypeAnnotation(node, print) {\n\t this.push(\"typeof \");\n\t print.plain(node.argument);\n\t}", "function TypeofTypeAnnotation(node, print) {\n\t this.push(\"typeof \");\n\t print.plain(node.argument);\n\t}", "function isNodeOneOf(elem,nodeTypeArray){if(nodeTypeArray.indexOf(elem.nodeName)!==-1){return true;}}", "function isString(node) {\n return t.isLiteral(node) && typeof node.value === \"string\";\n}", "function isString(node) {\n return t.isLiteral(node) && typeof node.value === \"string\";\n}", "function isNode(obj) {\n return !!((typeof Node === 'undefined' ? 'undefined' : _typeof(Node)) === 'object' ? obj instanceof Node : obj && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string');\n }", "function isNoNBTNode(node) {\n return isTypedNode(node) && node.type === \"no-nbt\";\n}", "function Node(){}", "function TElementNode(){}", "function isElement(domNode) {\n return domNode.nodeType !== undefined;\n}", "function assertExist () {\n var val = flag(this, 'object');\n this.assert(\n val !== null && val !== undefined\n , 'expected #{this} to exist'\n , 'expected #{this} to not exist'\n );\n }", "function removeNode(node) {\n if(Editor.writeAccess && node != null)\n socket.emit(\"node/remove\", node);\n}", "function nodesAsObject(value) {\r\n return !!value && typeof value === 'object';\r\n}", "function isNode(o){\n return (\n typeof Node === \"object\" ? o instanceof Node : \n o && typeof o === \"object\" && typeof o.nodeType === \"number\" && typeof o.nodeName===\"string\"\n );\n}", "static isNode(val) {\n return val instanceof Node;\n }", "function isString(node) {\n\t return t.isLiteral(node) && typeof node.value === \"string\";\n\t}" ]
[ "0.62221384", "0.61372936", "0.61372936", "0.61372936", "0.61372936", "0.5832636", "0.5832636", "0.5619439", "0.5619439", "0.55803466", "0.55803466", "0.55803466", "0.52470446", "0.52253616", "0.5197108", "0.5097337", "0.5097337", "0.5097337", "0.5097337", "0.5046135", "0.5046135", "0.49703705", "0.48222986", "0.47011688", "0.46723595", "0.46688274", "0.46635842", "0.46635842", "0.46635842", "0.46417028", "0.4635951", "0.46306223", "0.46233425", "0.46100086", "0.46029517", "0.45956293", "0.45876867", "0.4584478", "0.4577007", "0.45758948", "0.4573845", "0.45727354", "0.45559803", "0.45559803", "0.4538815", "0.45277974", "0.4512572", "0.4489436", "0.4487854", "0.4480414", "0.4475281", "0.4475281", "0.44675386", "0.44675386", "0.44675386", "0.44567585", "0.44567585", "0.44567585", "0.44567585", "0.44567585", "0.44567585", "0.44500506", "0.44456208", "0.44413942", "0.44413942", "0.44387996", "0.44270948", "0.44270948", "0.44270948", "0.44270948", "0.4413495", "0.44107953", "0.4406809", "0.4404532", "0.44044447", "0.4387989", "0.43861085", "0.4371323", "0.43681034", "0.4367089", "0.43616626", "0.43616626", "0.4361517", "0.43605793", "0.43605793", "0.43378317", "0.43338966", "0.43272302", "0.4327198", "0.4313817", "0.43122277", "0.43103182", "0.43089664", "0.43025285", "0.42981285", "0.42940333" ]
0.62289256
3
Assert that `complete` is `true`.
function assertDone(name, asyncName, complete) { if (!complete) { throw new Error( '`' + name + '` finished async. Use `' + asyncName + '` instead' ) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertDone(name, asyncName, complete) {\n if (!complete) {\n throw new Error('`' + name + '` finished async. Use `' + asyncName + '` instead');\n }\n}", "isComplete() {\n return (this.title === this.titleComplete) &&\n (this.labo === this.laboComplete) &&\n (this.univ === this.univComplete) &&\n (this.coAuthor === this.coAuthorComplete)\n }", "function complete() {\n\tconsole.log('Completed');\n}", "get isCompleted() { return this.result.isDefined }", "get isComplete() {\n return self.step.isComplete(self.annotations)\n }", "function testComplete() {\n process.nextTick(function() {\n if (testQueue.length > 0) {\n testQueue.shift()();\n }\n else {\n t.equal(async, expectAsync, \"captured all expected async callbacks\");\n t.equal(testQueue.length, 0, \"all tests have been processed\");\n }\n });\n }", "function checkComplete() {\n if (listQuestion.length === Object.keys(listResult).length) {\n return true\n } else {\n return false\n }\n}", "complete() {}", "checkComplete() {\n let result = true;\n for (let i = 0; i < this.solution.length; i++) {\n result = result && this.solution[i] === this.inputGates[i];\n }\n let oldComplete = this.complete;\n this.complete = result;\n if ((this.complete !== oldComplete) && this.complete) {\n bing.play();\n }\n }", "function isComplete(flags) {\n return (flags & FLAGS.COMPLETE) === FLAGS.COMPLETE;\n }", "function checkIfComplete() {\r\n if(isComplete == false) { //here no car has won yet\r\n isComplete = true; //a car won either car1 or car2\r\n }\r\n else {\r\n place = 'second';\r\n }\r\n }", "isComplete() {\n if (!this.endTime) return false;\n if (this.now() > this.endTime) {\n return true;\n }\n else {\n return false;\n }\n \n }", "function checkIfComplete(){\n\t\tif(isComplete == false){\n\t\t\tisComplete = true;\n\t\t} else {\n\t\t\tplace = ' SEGUNDO ';\n\t\t}\n\t}", "allQuestCompleted() {\n return !this.incompleteQuests().length;\n }", "done() {\n assert_equals(this._state, TaskState.STARTED)\n this._state = TaskState.FINISHED;\n\n let message = '< [' + this._label + '] ';\n\n if (this._result) {\n message += 'All assertions passed. (total ' + this._totalAssertions +\n ' assertions)';\n _logPassed(message);\n } else {\n message += this._failedAssertions + ' out of ' + this._totalAssertions +\n ' assertions were failed.'\n _logFailed(message);\n }\n\n this._resolve();\n }", "function SetComplete (){\n\tstoreDataValue( \"cmi.completion_status\", \"completed\" );\n}", "_checkIfComplete() {\n\n\t\tif(this._matchedCards === this.rows*this.cols) {\n\n\t\t\t// Delay for the animations\n\t\t\tsetTimeout(() => {\n\n\t\t\t\talert(`You have scored ${this._score} points`);\n\n\t\t\t\tclearInterval(this._timer);\n\n\t\t\t\tthis.initGame();\n\t\t\t}, 400);\n\t\t}\n\t}", "function isCompleted() {\n return cards.length === matchedCards.length;\n}", "review() {\n if (this.complete) {\n this.complete = !this.complete;\n }\n }", "function complete() {\n Y.log('complete');\n }", "isComplete() {\n try {\n if (!validator.isPositiveNumber(this.cap)) {\n return false;\n } else if (!validator.isPositiveNumber(this.tokenPrice)) {\n return false;\n }\n return true;\n } catch (error) {\n return false;\n }\n }", "static allQuestCompleted() {\n for (let questCompleted of player.completedQuestList) {\n if (!questCompleted()) {\n return false;\n }\n }\n return true;\n }", "function IteratorComplete(iterResult) {\n console.assert(Type(iterResult) === 'object');\n return Boolean(iterResult.done);\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 }", "get isCompleted() {\r\n return this._isResolved || this._isRejected;\r\n }", "function complete(){\n if(++count == 2) done()\n }", "function IteratorComplete(iterResult) { // eslint-disable-line no-unused-vars\n\t\t// 1. Assert: Type(iterResult) is Object.\n\t\tif (Type(iterResult) !== 'object') {\n\t\t\tthrow new Error(Object.prototype.toString.call(iterResult) + 'is not an Object.');\n\t\t}\n\t\t// 2. Return ToBoolean(? Get(iterResult, \"done\")).\n\t\treturn ToBoolean(Get(iterResult, \"done\"));\n\t}", "get is_complete() {\n return !!(this.flags & PaintVolumeFlags.IS_COMPLETE);\n }", "get completed() {\n return this.wizardSteps.every(step => step.completed || step.optional);\n }", "completeAll() {\n records.forEach(function (todo, index) {\n todo.completed = true\n });\n }", "get done() {\n return Boolean(this._set);\n }", "function checkIfCompleted() {\n matchingCards++;\n\n if (matchingCards >= Math.floor(fieldSize / 2)) {\n gameCompleted = true;\n timerStop();\n gratulation();\n }\n }", "setCompleted() {\nreturn this.isComplete = true;\n}", "function iteratorComplete(iterResult) {\n\t\t// 1. Assert: Type(iterResult) is Object.\n\t\tif (typeof iterResult !== 'object') {\n\t\t\tthrow new Error(Object.prototype.toString.call(iterResult) + 'is not an Object.');\n\t\t}\n\t\t// 2. Return ToBoolean(? Get(iterResult, \"done\")).\n\t\treturn Boolean(iterResult['done']);\n\t}", "function loadComplete() {\n if (++docsLoaded == 1) {\n setUpPageStatus = 'complete';\n }\n}", "function loadComplete() {\n if (++docsLoaded == 1) {\n setUpPageStatus = 'complete';\n }\n}", "function loadComplete() {\n if (++docsLoaded == 1) {\n setUpPageStatus = 'complete';\n }\n}", "function loadComplete() {\n if (++docsLoaded == 1) {\n setUpPageStatus = 'complete';\n }\n}", "function areAllTodosComplete(){\n for (var i = 0; i < todos.length; i++){\n if (todos[i].state === 'notComplete')\n return false\n }\n \n return true\n}", "isCompleted(wizardStep) {\n return wizardStep instanceof WizardCompletionStep && this.wizard.completed;\n }", "isCompleted(wizardStep) {\n return wizardStep instanceof WizardCompletionStep && this.wizard.completed;\n }", "function canComplete() {\n return state.accounts.data.email && state.accounts.data.personId;\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 complete() {\n /* jshint validthis:true */\n if (!this._isDisposed) {\n this._subject.complete();\n }\n}", "hasCompleted() {\n let completed = this.props.todos.filter(\n todo => todo.complete\n );\n return completed.length > 0 ? true : false;\n }", "isComplete() {\n for (let i = 0; i < this.rounds.length; i++) {\n for (let j = 0; j < this.rounds[i].length; j++) {\n if (this.rounds[i][j] == \"\") {\n return false;\n }\n }\n }\n return true;\n }", "function SetIncomplete (){\n\tretrieveDataValue( \"cmi.completion_status\" );\n\tif (status != \"completed\"){\n\t\tstoreDataValue( \"cmi.completion_status\", \"incomplete\" );\n\t}\n}", "function async_completed() {\n\tasync_completions += 1;\n\tD.log(\"completions: \" + async_completions + \" out of \" + async_completions_waiting);\n\tif ( async_completions == async_completions_waiting ) {\n\t completion();\n\t}\n }", "function test(done) {\n // always pass\n return done(null, true)\n}", "function checkDone() {\r\n\t\t\tif (todo===0) {\r\n\t\t\t\tresultCallback(unmarshalledTable);\r\n\t\t\t}\r\n\t\t}", "function stateSetComplete()\n\t\t{\n\t\t\t_cb();\n\t\t}", "function checkSuccessfullEnd(){\n successfullEnd = true;\n if(moves>0) successfullEnd = false;\n if (successfullEnd) alert(\"you won!\") \n}", "isFinished (){\n\t\treturn this.status !== null && this.finishDelay < 0;\n\t}", "get isComplete() {\n return this.value === \"100\" ? true : false;\n }", "function checkQuestCompletion(quest) {\n searchResult = _.findWhere(quest.objectives, {\"status\": constants.quest.status.INCOMPLETE});\n\n if (searchResult === undefined) {\n quest.status = constants.quest.status.COMPLETE;\n }\n }", "hasFinished() {\n return this.status === 'finished';\n }", "function checkIfDone() {\n var done = true;\n var hasResult = false;\n \n\n for ( i = 0; i < results.length; i++) {\n \tconsole.log('results[' + i + '].waiting: ' + results[i].waiting);\n \tconsole.log('results[' + i + '].geo_info.valid: ' + results[i].geo_info.valid);\n \tconsole.log('results[i]:');\n \tconsole.log(results[i]);\n if (results[i].waiting) {\n done = false;\n break;\n }\n if (results[i].geo_info.valid) {\n hasResult = true;\n }\n }\n\t\t\tconsole.log(done);\n if (done) {\n if (hasResult) {\n finish(true);\n } else {\n console.log('failed'); finish(false);\n }\n }//if (done)\n\n }", "function TestForCompletion() {\n if (test_complete && callback) {\n callback(\"Server successfully tested!\");\n } else {\n if (++retrys < retry_limit) {\n setTimeout(TestForCompletion, retry_interval);\n } else if (callback) {\n callback(\n \"Server test failed to complete after \" +\n (retry_limit * retry_interval) / 1000 +\n \" seconds\"\n );\n }\n }\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 }", "checkRangeComplete(firstRequestedNumber, firstTransactionObtained, rangeFirstTransaction, expectedRangeComplete) {\n // If the first requested number is 0 then the range is complete\n if (firstRequestedNumber === 0) {\n return true;\n } else {\n // Check that first transaction id in range has been reached\n if (rangeFirstTransaction.id !== false) {\n return this.checkIdReached(rangeFirstTransaction.id, firstTransactionObtained.id);\n // First transaction id in range cannot be checked - so use expectation based on numbers\n } else {\n return expectedRangeComplete;\n }\n }\n }", "function ok(value,message){if(!value)fail(value,true,message,'==',assert.ok);}", "function ok(value,message){if(!value)fail(value,true,message,'==',assert.ok);}", "function ok(value,message){if(!value)fail(value,true,message,'==',assert.ok);}", "function ok(value,message){if(!value)fail(value,true,message,'==',assert.ok);}", "completeList(){\n this.isListComplete = true;\n alert(`You have completed all tasks!`);\n }", "static isTutorialCompleted() {\n var _a;\n return ((_a = App.game.quests.getQuestLine('Tutorial Quests')) === null || _a === void 0 ? void 0 : _a.state()) == QuestLineState.ended;\n }", "isDone(wizardStep) {\n return wizardStep.completed;\n }", "isDone(wizardStep) {\n return wizardStep.completed;\n }", "function assertResult(document) {\n if (!document.isTrashed) {\n console.log(\"The document is not in the trashed state.\");\n return false;\n }\n\n console.log('Congratulations, you have successfully completed this exercise.');\n}", "function onDone(event){\n\tconsole.log('done button clicked');\n\tif (validateContents() === true){ \n finishTest();\n }\n\telse {\n\t\trepeatTest();\n\t\treset();\n\t}\n}", "function afterEach () {\n this.allPassed = this.allPassed && (this.currentTest.state === 'passed');\n}", "isComplete() {\n return this.selection != null;\n }", "isComplete() {\n return this.selection != null;\n }", "function complete(number) {\n if (number >= list.length) {\n console.log(`\\nInvalid Number\\n`);\n view()\n } else {\n list[number].done = true\n console.log(`\\nCompleted ${list[number].task}\\n`)\n menu();\n }\n}", "function tryOnComplete() {\n if (numCallbacks == numComplete && allCallbacksCreated) {\n onComplete();\n }\n }", "function ok(test, desc) { expect(test).toBe(true); }", "static async checkOrderComplete(poId) {\n try {\n const incompleteOrderItems = await shopdb.poitem.findAll({\n where: { poId: poId, dateComplete: null }\n });\n\n if (incompleteOrderItems.length > 0) {\n return false;\n } else {\n return true;\n }\n } catch (error) {\n throw error;\n }\n }", "function loadComplete() {\n\thasLoaded = true;\n}", "function assert(){\n called = true;\n }", "async assertResultStatus(){\n\t\tawait t\n\t\t.expect(resultText.innerText).eql('You clicked: Ok', {timeout:10000})\n\t}", "function checkSucess() {\n setTimeout(function() {\n if (answered && authenticated) {\n done();\n } else {\n checkSucess();\n }\n }, asyncDelay);\n }", "function checkComplete(intent,session,callback)\n{\n if ((session[\"d\"][\"size\"]) && (session[\"d\"][\"type\"]) && (session[\"d\"][\"drink\"]) && (session[\"d\"][\"quantity\"]))\n {\n return true;\n \n }\n return false;\n}", "function assertGuestJsCorrect(frame, div, result) {\n // TODO(kpreid): reenable or declare completion value unsupported\n //assertEquals(12, result);\n console.warn('JS completion value not yet supported by ES5 mode; '\n + 'not testing.');\n }", "isDone() {\n return this.single.length == 0 ? true : false\n }", "get isComplete() {\n\t\treturn (this._status === this._gl.FRAMEBUFFER_COMPLETE);\n\t}", "function isComplete(area) {\n\tif (area.expert === undefined) area.expert = 0;\n\tif (area.advanced === undefined) area.advanced = 0;\n\tif (area.yearlySnowfall === undefined ) area.yearlySnowfall = 0;\n\treturn ( area.state && area.vertical && area.skiableAcres );\n}", "function checkCompletion() {\n\tif (levelCompleted()) {\n\t\tincreasePoints();\n\t\tinitLevel(currentLevel + 1);\n\t\tinitValues();\n\t\tinitCells();\n\t}\n}", "function testReady(task) {\n return (task.checks || []).reduce(function(memo, check) {\n return memo && check(pc, task);\n }, true);\n }" ]
[ "0.64496076", "0.62851554", "0.61078316", "0.6088317", "0.6086782", "0.6085638", "0.6077784", "0.60390526", "0.6015842", "0.59758866", "0.5937751", "0.58899134", "0.5833281", "0.57518196", "0.57095605", "0.55940217", "0.558774", "0.5580275", "0.55591047", "0.55531603", "0.5544694", "0.5540704", "0.55400926", "0.5516527", "0.5516527", "0.5516527", "0.5516527", "0.5511379", "0.5493616", "0.54405165", "0.54347545", "0.5417798", "0.54012567", "0.53913105", "0.5389601", "0.5388332", "0.5359237", "0.53541505", "0.53541505", "0.53541505", "0.53541505", "0.53477186", "0.5346881", "0.5346881", "0.5342438", "0.5324637", "0.532218", "0.53185755", "0.53122", "0.5311706", "0.52824175", "0.5267026", "0.5266304", "0.5249726", "0.5246617", "0.5235006", "0.5226532", "0.5224799", "0.5222956", "0.52129453", "0.5201391", "0.51982003", "0.51982003", "0.5196296", "0.5196155", "0.5196155", "0.5196155", "0.5196155", "0.51908565", "0.5167786", "0.51543015", "0.51543015", "0.51525116", "0.515097", "0.51476264", "0.5146314", "0.5146314", "0.51308966", "0.51179713", "0.51170677", "0.5107476", "0.5100897", "0.50963986", "0.50960386", "0.50926423", "0.50904423", "0.5089575", "0.5089285", "0.5085004", "0.50829256", "0.50803053", "0.5077485" ]
0.6452487
6
Create a message with `reason` at `position`. When an error is passed in as `reason`, copies the stack.
function message(reason, position, origin) { var filePath = this.path; var message = new VMessage(reason, position, origin); if (filePath) { message.name = filePath + ':' + message.name; message.file = filePath; } message.fatal = false; this.messages.push(message); return message; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function message(reason, position, ruleId) {\n var filePath = this.path;\n var range = stringify(position) || '1:1';\n var location;\n var err;\n\n location = {\n start: {line: null, column: null},\n end: {line: null, column: null}\n };\n\n if (position && position.position) {\n position = position.position;\n }\n\n if (position) {\n /* Location. */\n if (position.start) {\n location = position;\n position = position.start;\n } else {\n /* Position. */\n location.start = position;\n }\n }\n\n err = new VMessage(reason.message || reason);\n\n err.name = (filePath ? filePath + ':' : '') + range;\n err.file = filePath || '';\n err.reason = reason.message || reason;\n err.line = position ? position.line : null;\n err.column = position ? position.column : null;\n err.location = location;\n err.ruleId = ruleId || null;\n err.source = null;\n err.fatal = false;\n\n if (reason.stack) {\n err.stack = reason.stack;\n }\n\n this.messages.push(err);\n\n return err;\n}", "function makeError (message) {\n const ret = Error(message);\n const stack = ret.stack.split(/\\n/)\n ret.stack = stack.slice(0, 2).join(\"\\n\");\n return ret;\n}", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin)\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin)\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin)\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin);\n\n if (this.path) {\n message.name = this.path + ':' + message.name;\n message.file = this.path;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message\n}", "function createStackForSend() {\n try {\n throw Error(error);\n }\n catch (ex) {\n error = ex;\n\n // note we generated this stack for later\n error.generatedStack = true;\n\n // set the time when it was created\n error.timestamp = error.timestamp || now;\n\n impl.addError(error, via, source);\n }\n }", "function message(reason, position, origin) {\n var filePath = this.path\n var message = new VMessage(reason, position, origin)\n\n if (filePath) {\n message.name = filePath + ':' + message.name\n message.file = filePath\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function message$1(reason, position, origin) {\n var message = new VMessage$2(reason, position, origin);\n\n if (this.path) {\n message.name = this.path + ':' + message.name;\n message.file = this.path;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message\n}", "function syntaxError(message, pos) {\n let err = Error(message);\n err.name = \"SyntaxError\";\n err.pos = pos;\n return err;\n}", "raise ( message, pos ) {\n\t\tconst err = new Error( this.sourceLocation( pos ) + ': ' + message );\n\t\terr.pos = this.completePosition( this.createPosition() );\n\t\tthrow err;\n\t}", "function stackOverflow() {\n let error_msg = document.createElement(\"div\");\n error_msg.innerHTML = `<p class='error_content'>Stack Oveflow</p>`;\n error_msg.classList.add(\"error_msg\", \"stack_overflow\");\n stack_div.insertBefore(error_msg, stack_div.lastChild.nextSibling);\n}", "function PositionError() {\n this.code = null;\n this.message = \"\";\n}", "function stackUnderflow() {\n let error_msg = document.createElement(\"div\");\n error_msg.innerHTML = `<p class='error_content'>Stack Underflow</p>`;\n error_msg.classList.add(\"error_msg\", \"stack_underflow\");\n stack_div.insertBefore(error_msg, stack_div.firstChild);\n}", "function PositionError() {\n\tthis.code = null;\n\tthis.message = \"\";\n}", "function PositionError() {\n\tthis.code = null;\n\tthis.message = \"\";\n}", "function makeError(pnpCode, message, data = {}) {\n const code = MODULE_NOT_FOUND_ERRORS.has(pnpCode) ? `MODULE_NOT_FOUND` : pnpCode;\n return Object.assign(new Error(message), {\n code,\n pnpCode,\n data\n });\n}", "static wrapError(msg, cause) {\n if (msg === 'unknown error' && cause && cause.message === 'transaction finished') {\n return cause;\n }\n const error = new Error(msg);\n error.cause = cause;\n return error;\n }", "chain(type, pos, msg) {\n\t\tthrow new ParseError(type, pos, msg, this);\n\t}", "makeError(message) {\n var _a;\n let msg = (_a = this.fileName) !== null && _a !== void 0 ? _a : \"\";\n if (this.trackPosition) {\n if (msg.length > 0) {\n msg += \":\";\n }\n msg += `${this.line}:${this.column}`;\n }\n if (msg.length > 0) {\n msg += \": \";\n }\n return new Error(msg + message);\n }", "selectErrorAtPosition(position) {\n const {\n errors\n } = this.state;\n\n if (errors.length === 0) {\n return;\n }\n\n const selectedError = errors.find(error => position >= (error.offset || 0) && position <= (error.offset || 0) + (error.length || 0)) || null;\n this.setState({\n selectedError\n });\n }", "function unstack (msg) {\n var sep = msg.search(/\\n\\s*at\\s/)\n return {\n msg: msg.substr(0, sep)\n , stack: utils.trimLines(msg.substr(sep + 1))\n }\n}", "function createStack() {\n // somewhat nasty trick to get a stack trace in Moz\n var stack = undefined;\n try {notdefined()} catch(e) {stack = e.stack};\n if (stack) {\n stack = stack.split('\\n');\n stack.shift();\n stack.shift();\n };\n return stack ? stack.join('\\n') : '';\n}", "newMessage ({commit}, msg) {\n commit(NEW_MESSAGE, msg)\n }", "function makeError( code, msg )\n{\n const err = new Error( msg );\n err.code = code;\n return err;\n}", "unexpected(pos, messageOrType) {\n if (messageOrType == null) messageOrType = 'Unexpected token';\n if (typeof messageOrType !== 'string') messageOrType = `Unexpected token, expected \"${messageOrType.label}\"`;\n throw this.raise(pos != null ? pos : this.state.start, messageOrType);\n }", "function extendStack(newError, originalError) {\n let stackProp = Object.getOwnPropertyDescriptor(newError, \"stack\");\n if (isLazyStack(stackProp)) {\n lazyJoinStacks(stackProp, newError, originalError);\n }\n else if (isWritableStack(stackProp)) {\n newError.stack = joinStacks(newError, originalError);\n }\n}", "function getMatTooltipInvalidPositionError(position) {\n return Error(`Tooltip position \"${position}\" is invalid.`);\n}", "function popErrorMsg(element, message, pos) {\n pos = (typeof pos !== 'undefined') ? pos : 'top';\n\n $(element).popover({\n content: message,\n placement: pos\n });\n $(element).popover('show');\n setTimeout(function() {\n $(element).popover('hide'); }\n , 1000\n );\n setTimeout(function() {\n $(element).popover('destroy'); }\n , 1500\n );\n}", "function copyStackTrace(target, source) {\n target.stack = source.stack.replace(source.message, target.message)\n}", "function extendStack(newError, originalError) {\n let stackProp = Object.getOwnPropertyDescriptor(newError, \"stack\");\n if (stack_1.isLazyStack(stackProp)) {\n stack_1.lazyJoinStacks(stackProp, newError, originalError);\n }\n else if (stack_1.isWritableStack(stackProp)) {\n newError.stack = stack_1.joinStacks(newError, originalError);\n }\n}", "popAt(index) {\n if (this.stacks[index] === undefined) return new Error;\n this.stacks[index].pop();\n }", "function GraphQLError( // eslint-disable-line no-redeclare\nmessage, nodes, source, positions, path, originalError, extensions) {\n // Compute list of blame nodes.\n var _nodes = Array.isArray(nodes) ? nodes.length !== 0 ? nodes : undefined : nodes ? [nodes] : undefined; // Compute locations in the source for the given nodes/positions.\n\n\n var _source = source;\n\n if (!_source && _nodes) {\n var node = _nodes[0];\n _source = node && node.loc && node.loc.source;\n }\n\n var _positions = positions;\n\n if (!_positions && _nodes) {\n _positions = _nodes.reduce(function (list, node) {\n if (node.loc) {\n list.push(node.loc.start);\n }\n\n return list;\n }, []);\n }\n\n if (_positions && _positions.length === 0) {\n _positions = undefined;\n }\n\n var _locations;\n\n if (positions && source) {\n _locations = positions.map(function (pos) {\n return (0, _location.getLocation)(source, pos);\n });\n } else if (_nodes) {\n _locations = _nodes.reduce(function (list, node) {\n if (node.loc) {\n list.push((0, _location.getLocation)(node.loc.source, node.loc.start));\n }\n\n return list;\n }, []);\n }\n\n var _extensions = extensions || originalError && originalError.extensions;\n\n Object.defineProperties(this, {\n message: {\n value: message,\n // By being enumerable, JSON.stringify will include `message` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: true,\n writable: true\n },\n locations: {\n // Coercing falsey values to undefined ensures they will not be included\n // in JSON.stringify() when not provided.\n value: _locations || undefined,\n // By being enumerable, JSON.stringify will include `locations` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: Boolean(_locations)\n },\n path: {\n // Coercing falsey values to undefined ensures they will not be included\n // in JSON.stringify() when not provided.\n value: path || undefined,\n // By being enumerable, JSON.stringify will include `path` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: Boolean(path)\n },\n nodes: {\n value: _nodes || undefined\n },\n source: {\n value: _source || undefined\n },\n positions: {\n value: _positions || undefined\n },\n originalError: {\n value: originalError\n },\n extensions: {\n // Coercing falsey values to undefined ensures they will not be included\n // in JSON.stringify() when not provided.\n value: _extensions || undefined,\n // By being enumerable, JSON.stringify will include `path` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: Boolean(_extensions)\n }\n }); // Include (non-enumerable) stack trace.\n\n if (originalError && originalError.stack) {\n Object.defineProperty(this, 'stack', {\n value: originalError.stack,\n writable: true,\n configurable: true\n });\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, GraphQLError);\n } else {\n Object.defineProperty(this, 'stack', {\n value: Error().stack,\n writable: true,\n configurable: true\n });\n }\n}", "static renderCompileError(message) {\n const noCreate = !message\n const overlay = this.getErrorOverlay(noCreate)\n if (!overlay) return\n overlay.setCompileError(message)\n }", "function copyStackTrace(target, source) {\n // eslint-disable-next-line no-param-reassign\n target.stack = source.stack.replace(source.message, target.message);\n}", "function badVarPosMessage(varName, varType, expectedType) {\n return \"Variable \\\"$\".concat(varName, \"\\\" of type \\\"\").concat(varType, \"\\\" used in \") + \"position expecting type \\\"\".concat(expectedType, \"\\\".\");\n}", "function handleWarning(reason, position, code) {\n if (code === 3) {\n return;\n }\n\n ctx.file.message(reason, position);\n }", "function handleWarning(reason, position, code) {\n if (code === 3) {\n return;\n }\n\n ctx.file.message(reason, position);\n }", "function handleWarning(reason, position, code) {\n if (code === 3) {\n return;\n }\n\n ctx.file.message(reason, position);\n }", "function handleWarning(reason, position, code) {\n if (code === 3) {\n return;\n }\n\n ctx.file.message(reason, position);\n }", "function handleWarning(reason, position, code) {\n if (code === 3) {\n return;\n }\n\n ctx.file.message(reason, position);\n }", "function handleWarning(reason, position, code) {\n if (code === 3) {\n return;\n }\n\n ctx.file.message(reason, position);\n }", "function prepareStackTrace(error, stack) {\n if (emptyCacheBetweenOperations) {\n fileContentsCache = {};\n sourceMapCache = {};\n }\n\n var name = error.name || 'Error';\n var message = error.message || '';\n var errorString = name + \": \" + message;\n\n var state = { nextPosition: null, curPosition: null };\n var processedStack = [];\n for (var i = stack.length - 1; i >= 0; i--) {\n processedStack.push('\\n at ' + wrapCallSite(stack[i], state));\n state.nextPosition = state.curPosition;\n }\n state.curPosition = state.nextPosition = null;\n return errorString + processedStack.reverse().join('');\n}", "prepare(msg) {\n\t\tif (typeof msg === 'string') {\n\t\t\tmsg = {command: msg};\n\t\t}\n\t\tif (typeof msg.command !== 'string') {\n\t\t\tthrow new Error(`missing command: ${msg}`);\n\t\t}\n\t\tif (typeof msg.destination !== 'string') {\n\t\t\tlet dst = CMD_DST[msg.command];\n\t\t\tif (!dst) {\n\t\t\t\tthrow new Error(`unknown command destination: ${msg.command}`);\n\t\t\t}\n\t\t\tmsg.destination = dst;\n\t\t}\n\t\tif (typeof msg.request_id !== 'string') {\n\t\t\tmsg.request_id = advance(this.req_id).toString('hex');\n\t\t}\n\t\tmsg.origin = SERVICE_WALLET_UI;\n\t\tmsg.ack = false;\n\t\treturn msg;\n\t}", "function prepareBuffer(buffer, position) {\n var j;\n while (buffer[position] == undefined && buffer.length < getMaskLength()) {\n j = 0;\n while (getActiveBufferTemplate()[j] !== undefined) { //add a new buffer\n buffer.push(getActiveBufferTemplate()[j++]);\n }\n }\n\n return position;\n }", "function prepareBuffer(buffer, position) {\n var j;\n while (buffer[position] == undefined && buffer.length < getMaskLength()) {\n j = 0;\n while (getActiveBufferTemplate()[j] !== undefined) { //add a new buffer\n buffer.push(getActiveBufferTemplate()[j++]);\n }\n }\n\n return position;\n }", "function prepareBuffer(buffer, position) {\n var j;\n while (buffer[position] == undefined && buffer.length < getMaskLength()) {\n j = 0;\n while (getActiveBufferTemplate()[j] !== undefined) { //add a new buffer\n buffer.push(getActiveBufferTemplate()[j++]);\n }\n }\n\n return position;\n }", "function makeException(error, title, name, callerCls, callFunc, message) {\n var _a;\n return new Error((_a = message + (callerCls !== null && callerCls !== void 0 ? callerCls : nameSpace) + callFunc) !== null && _a !== void 0 ? _a : (Const_1.EMPTY_STR + arguments.caller.toString()));\n }", "function queueOverflow() {\n let error_msg = document.createElement(\"div\");\n error_msg.innerHTML = `<p class='error_content'>Queue Oveflow</p>`;\n error_msg.classList.add(\"error_msg\", \"query_overflow\");\n queue_div.insertBefore(error_msg, queue_div.lastChild.nextSibling);\n}", "function frameError(err, str) {\n var stringParts = [\n str.slice(0, err.pos),\n '<span class=\"error\">',\n str.slice(err.pos, err.pos + err.extent),\n '</span>',\n str.slice(err.pos + err.extent),\n ];\n return stringParts.join(\"\");\n}", "function withErrorStack(err, stack) {\n if (config.env === 'development') {\n // Asignamos stack al objeto error || Object.assign({}, err, stack) otra manera\n return {...err, stack};\n } else {\n return err\n }\n}", "function throwError(msg, loc, errorClass) {\n loc.source = loc.source || \"<unknown>\"; // FIXME -- we should have the source populated\n // rewrite a ColoredPart to match the format expected by the runtime\n function rewritePart(part){\n if(typeof(part) === 'string'){\n return part;\n } else if(part instanceof symbolExpr){\n return '[\"span\", [[\"class\", \"SchemeValue-Symbol\"]], '+part.val+']';\n return part.val;\n } else if(part.location !== undefined){\n return {text: part.text, type: 'ColoredPart', loc: part.location.toBytecode()\n , toString: function(){return part.text;}};\n } else if(part.locations !== undefined){\n return {text: part.text, type: 'MultiPart', solid: part.solid\n , locs: part.locations.map(function(l){return l.toBytecode()})\n , toString: function(){return part.text;}};\n }\n }\n \n msg.args = msg.args.map(rewritePart);\n \n var json = {type: \"moby-failure\"\n , \"dom-message\": [\"span\"\n ,[[\"class\", \"Error\"]]\n ,[\"span\"\n , [[\"class\", (errorClass || \"Message\")]]].concat(\n (errorClass? [[\"span\"\n , [[\"class\", \"Error.reason\"]]\n , msg.toString()]\n , [\"span\", [[\"class\", ((errorClass || \"message\")\n +((errorClass === \"Error-GenericReadError\")?\n \".locations\"\n :\".otherLocations\"))]]]]\n : msg.args.map(function(x){return x.toString();})))\n ,[\"br\", [], \"\"]\n ,[\"span\"\n , [[\"class\", \"Error.location\"]]\n , [\"span\"\n , [[\"class\", \"location-reference\"]\n , [\"style\", \"display:none\"]]\n , [\"span\", [[\"class\", \"location-offset\"]], (loc.offset+1).toString()]\n , [\"span\", [[\"class\", \"location-line\"]] , loc.sLine.toString()]\n , [\"span\", [[\"class\", \"location-column\"]], loc.sCol.toString()]\n , [\"span\", [[\"class\", \"location-span\"]] , loc.span.toString()]\n , [\"span\", [[\"class\", \"location-id\"]] , loc.source.toString()]\n ]\n ]\n ]\n , \"structured-error\": JSON.stringify({message: (errorClass? false : msg.args), location: loc.toBytecode() })\n };\n throw JSON.stringify(json);\n}", "popPosition(position) {\n\t\tthis.positionContainer.pop();\n\t}", "function GraphQLError( // eslint-disable-line no-redeclare\nmessage, nodes, source, positions, path, originalError, extensions) {\n // Compute list of blame nodes.\n var _nodes = Array.isArray(nodes) ? nodes.length !== 0 ? nodes : undefined : nodes ? [nodes] : undefined; // Compute locations in the source for the given nodes/positions.\n\n\n var _source = source;\n\n if (!_source && _nodes) {\n var node = _nodes[0];\n _source = node && node.loc && node.loc.source;\n }\n\n var _positions = positions;\n\n if (!_positions && _nodes) {\n _positions = _nodes.reduce(function (list, node) {\n if (node.loc) {\n list.push(node.loc.start);\n }\n\n return list;\n }, []);\n }\n\n if (_positions && _positions.length === 0) {\n _positions = undefined;\n }\n\n var _locations;\n\n if (positions && source) {\n _locations = positions.map(function (pos) {\n return Object(_language_location__WEBPACK_IMPORTED_MODULE_1__[\"getLocation\"])(source, pos);\n });\n } else if (_nodes) {\n _locations = _nodes.reduce(function (list, node) {\n if (node.loc) {\n list.push(Object(_language_location__WEBPACK_IMPORTED_MODULE_1__[\"getLocation\"])(node.loc.source, node.loc.start));\n }\n\n return list;\n }, []);\n }\n\n var _extensions = extensions || originalError && originalError.extensions;\n\n Object.defineProperties(this, {\n message: {\n value: message,\n // By being enumerable, JSON.stringify will include `message` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: true,\n writable: true\n },\n locations: {\n // Coercing falsey values to undefined ensures they will not be included\n // in JSON.stringify() when not provided.\n value: _locations || undefined,\n // By being enumerable, JSON.stringify will include `locations` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: Boolean(_locations)\n },\n path: {\n // Coercing falsey values to undefined ensures they will not be included\n // in JSON.stringify() when not provided.\n value: path || undefined,\n // By being enumerable, JSON.stringify will include `path` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: Boolean(path)\n },\n nodes: {\n value: _nodes || undefined\n },\n source: {\n value: _source || undefined\n },\n positions: {\n value: _positions || undefined\n },\n originalError: {\n value: originalError\n },\n extensions: {\n // Coercing falsey values to undefined ensures they will not be included\n // in JSON.stringify() when not provided.\n value: _extensions || undefined,\n // By being enumerable, JSON.stringify will include `path` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: Boolean(_extensions)\n }\n }); // Include (non-enumerable) stack trace.\n\n if (originalError && originalError.stack) {\n Object.defineProperty(this, 'stack', {\n value: originalError.stack,\n writable: true,\n configurable: true\n });\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, GraphQLError);\n } else {\n Object.defineProperty(this, 'stack', {\n value: Error().stack,\n writable: true,\n configurable: true\n });\n }\n}", "function GraphQLError( // eslint-disable-line no-redeclare\nmessage, nodes, source, positions, path, originalError, extensions) {\n // Compute list of blame nodes.\n var _nodes = Array.isArray(nodes) ? nodes.length !== 0 ? nodes : undefined : nodes ? [nodes] : undefined; // Compute locations in the source for the given nodes/positions.\n\n\n var _source = source;\n\n if (!_source && _nodes) {\n var node = _nodes[0];\n _source = node && node.loc && node.loc.source;\n }\n\n var _positions = positions;\n\n if (!_positions && _nodes) {\n _positions = _nodes.reduce(function (list, node) {\n if (node.loc) {\n list.push(node.loc.start);\n }\n\n return list;\n }, []);\n }\n\n if (_positions && _positions.length === 0) {\n _positions = undefined;\n }\n\n var _locations;\n\n if (positions && source) {\n _locations = positions.map(function (pos) {\n return Object(_language_location__WEBPACK_IMPORTED_MODULE_1__[\"getLocation\"])(source, pos);\n });\n } else if (_nodes) {\n _locations = _nodes.reduce(function (list, node) {\n if (node.loc) {\n list.push(Object(_language_location__WEBPACK_IMPORTED_MODULE_1__[\"getLocation\"])(node.loc.source, node.loc.start));\n }\n\n return list;\n }, []);\n }\n\n var _extensions = extensions || originalError && originalError.extensions;\n\n Object.defineProperties(this, {\n message: {\n value: message,\n // By being enumerable, JSON.stringify will include `message` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: true,\n writable: true\n },\n locations: {\n // Coercing falsey values to undefined ensures they will not be included\n // in JSON.stringify() when not provided.\n value: _locations || undefined,\n // By being enumerable, JSON.stringify will include `locations` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: Boolean(_locations)\n },\n path: {\n // Coercing falsey values to undefined ensures they will not be included\n // in JSON.stringify() when not provided.\n value: path || undefined,\n // By being enumerable, JSON.stringify will include `path` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: Boolean(path)\n },\n nodes: {\n value: _nodes || undefined\n },\n source: {\n value: _source || undefined\n },\n positions: {\n value: _positions || undefined\n },\n originalError: {\n value: originalError\n },\n extensions: {\n // Coercing falsey values to undefined ensures they will not be included\n // in JSON.stringify() when not provided.\n value: _extensions || undefined,\n // By being enumerable, JSON.stringify will include `path` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: Boolean(_extensions)\n }\n }); // Include (non-enumerable) stack trace.\n\n if (originalError && originalError.stack) {\n Object.defineProperty(this, 'stack', {\n value: originalError.stack,\n writable: true,\n configurable: true\n });\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, GraphQLError);\n } else {\n Object.defineProperty(this, 'stack', {\n value: Error().stack,\n writable: true,\n configurable: true\n });\n }\n}", "function pushError(){assert.throws(function(){r.push(new Buffer(1))})}", "function croak(msg) {\n //wow, we report location, it's amazing!\n throw new Error(msg + \" (\" + line + \":\" + col + \")\");\n }", "function xb(a,b){if(Error.captureStackTrace)Error.captureStackTrace(this,xb);else{var c=Error().stack;c&&(this.stack=c)}a&&(this.message=String(a));void 0!==b&&(this.cause=b)}", "createError(rule, code, message) {\n return {\n code,\n message,\n tagName: rule.tagName\n };\n }", "addAnalyzerIssueForPosition(messageId, messageText, sourceFile, pos, properties) {\n const lineAndCharacter = sourceFile.getLineAndCharacterOfPosition(pos);\n const options = {\n category: \"Extractor\" /* Extractor */,\n messageId,\n text: messageText,\n sourceFilePath: sourceFile.fileName,\n sourceFileLine: lineAndCharacter.line + 1,\n sourceFileColumn: lineAndCharacter.character + 1,\n properties\n };\n this._sourceMapper.updateExtractorMessageOptions(options);\n const extractorMessage = new ExtractorMessage_1.ExtractorMessage(options);\n this._messages.push(extractorMessage);\n return extractorMessage;\n }", "function makeError(type, id, message) {\n return {\n type: 'error',\n id,\n message: `${type} ${id}: ${message}`\n }\n}", "function createAfter(reference, message) {\n //create element to contain the error message\n let errorContent = document.createElement('span')\n //insert said message in the html\n errorContent.innerHTML = message\n reference.after(errorContent)\n }", "pushPosition(position) {\n\t\tthis.positionContainer.push(position);\n\t}", "createFailureAtNode(node, message) {\n const sourceFile = node.getSourceFile();\n this.failures.push({\n filePath: this.fileSystem.resolve(sourceFile.fileName),\n position: ts.getLineAndCharacterOfPosition(sourceFile, node.getStart()),\n message: message,\n });\n }", "convertStack(err) {\n let frames;\n\n if (type.array(err.stack)) {\n frames = err.stack.map((frame) => {\n if (type.string(frame)) return frame;\n else return frame.toString();\n });\n } else if (type.string(err.stack)) {\n frames = err.stack.split(/\\n/g);\n }\n\n return frames;\n }", "function ParseErr(message, str, indx) {\r\n var whitespace = str.slice(0, indx).split(/\\n/);\r\n var lineNo = whitespace.length;\r\n var colNo = whitespace[lineNo - 1].length + 1;\r\n message +=\r\n ' at line ' +\r\n lineNo +\r\n ' col ' +\r\n colNo +\r\n ':\\n\\n' +\r\n ' ' +\r\n str.split(/\\n/)[lineNo - 1] +\r\n '\\n' +\r\n ' ' +\r\n Array(colNo).join(' ') +\r\n '^';\r\n throw SqrlErr(message);\r\n}", "codeAroundError(startOfDef, problemIndex) {\n const range = 20;\n let before = Math.max(0, startOfDef-range);\n let after = Math.min(this.maxIndex+1, problemIndex);\n return `\"...${this.code.slice(before, after)}\"`;\n }", "function getErrorPopupTemplate\n(\n value,\n position\n)\n{\n var _popover;\n var _template = \"<div class=\\\"popover\\\"><div class=\\\"arrow\\\"></div>\";\n _template+=\"<div class=\\\"popover-inner\\\">\";\n _template+=\"<div class=\\\"popover-content\\\"><p></p></div></div></div>\";\n position = typeof(position) == undefined || position == null ? \"top\" : \n position; \n _popover = $(value.element).popover({\n trigger: \"manual\",\n placement: position,\n content: value.message,\n template: _template\n });\n _popover.data(\"popover\").options.content = value.message;\n return $(value.element).popover(\"show\");\n}", "function positionError(error) {\r\n var errorCode = error.code;\r\n var message = error.message;\r\n\r\n //alert(message);\r\n}", "function withErrorStack(error, stack) {\n // si estamos en desarrollo\n if (config.dev) {\n return { ...error, stack };\n }\n return error;\n}", "chatAddError(errorMessage, originalText) {\n // eslint-disable-next-line no-param-reassign\n errorMessage = UIUtil.escapeHtml(errorMessage);\n // eslint-disable-next-line no-param-reassign\n originalText = UIUtil.escapeHtml(originalText);\n\n $('#chatconversation').append(\n `${'<div class=\"errorMessage\"><b>Error: </b>Your message'}${\n originalText ? ` \"${originalText}\"` : ''\n } was not sent.${\n errorMessage ? ` Reason: ${errorMessage}` : ''}</div>`);\n $('#chatconversation').animate(\n { scrollTop: $('#chatconversation')[0].scrollHeight }, 1000);\n }", "function formatMessage(message, parentResult, options) {\n const type = message.severity === 2 ? kleur__default[\"default\"].red(\"error\") : kleur__default[\"default\"].yellow(\"warning\");\n const msg = `${kleur__default[\"default\"].bold(message.message.replace(/([^ ])\\.$/, \"$1\"))}`;\n const ruleId = kleur__default[\"default\"].dim(`(${message.ruleId})`);\n const filePath = formatFilePath(parentResult.filePath, message.line, message.column);\n const sourceCode = parentResult.source;\n /* istanbul ignore next: safety check from original implementation */\n const firstLine = [\n `${type}:`,\n `${msg}`,\n ruleId ? `${ruleId}` : \"\",\n sourceCode ? `at ${filePath}:` : `at ${filePath}`,\n ]\n .filter(String)\n .join(\" \");\n const result = [firstLine];\n /* istanbul ignore next: safety check from original implementation */\n if (sourceCode) {\n result.push(codeFrame.codeFrameColumns(sourceCode, {\n start: getStartLocation(message),\n end: getEndLocation(message, sourceCode),\n }, { highlightCode: false }));\n }\n if (options.showLink && message.ruleUrl) {\n result.push(`${kleur__default[\"default\"].bold(\"Details:\")} ${message.ruleUrl}`);\n }\n return result.join(\"\\n\");\n}", "newPosition(position) {\n this.position = position;\n }", "function insertMessage(message) {\n box = create_msg_bubble(\"left\", message);\n box.box.appendChild(box.text);\n $('.robot-content-top').stop().animate({scrollTop: msgContainer.height()}, 'slow');\n}", "function handleWarning(reason, position, code) {\n if (code !== 3) {\n ctx.file.message(reason, position)\n }\n }", "function errorFunction(position) {\n console.log('Error!');\n }", "createMessage(message) {\n\t\treturn this.query(knex.insert(util.filterKeys(MESSAGE_FIELDS, message)).into('message').toString()).catch(error => console.log(error, 'Message instert into database went wrong'));\n\t}", "ListsNetworkException (msg) {\n let error = new Error(msg);\n error.name = 'ListsNetworkException';\n //error.snappMessage = \"something?\";\n throw error;\n }", "function createShellMessage(options, content, metadata, buffers) {\n if (content === void 0) { content = {}; }\n if (metadata === void 0) { metadata = {}; }\n if (buffers === void 0) { buffers = []; }\n var msg = createMessage(options, content, metadata, buffers);\n return msg;\n }", "makeError(msg, id) {\n const err = new Error(msg);\n err.id = id;\n return err;\n }", "function formatMessage(message, parentResult, options) {\n const type = message.severity === 2 ? kleur_1.default.red(\"error\") : kleur_1.default.yellow(\"warning\");\n const msg = `${kleur_1.default.bold(message.message.replace(/([^ ])\\.$/, \"$1\"))}`;\n const ruleId = kleur_1.default.dim(`(${message.ruleId})`);\n const filePath = formatFilePath(parentResult.filePath, message.line, message.column);\n const sourceCode = parentResult.source;\n /* istanbul ignore next: safety check from original implementation */\n const firstLine = [\n `${type}:`,\n `${msg}`,\n ruleId ? `${ruleId}` : \"\",\n sourceCode ? `at ${filePath}:` : `at ${filePath}`,\n ]\n .filter(String)\n .join(\" \");\n const result = [firstLine];\n /* istanbul ignore next: safety check from original implementation */\n if (sourceCode) {\n result.push(code_frame_1.codeFrameColumns(sourceCode, {\n start: getStartLocation(message),\n end: getEndLocation(message, sourceCode),\n }, { highlightCode: false }));\n }\n if (options.showLink && message.ruleUrl) {\n result.push(`${kleur_1.default.bold(\"Details:\")} ${message.ruleUrl}`);\n }\n return result.join(\"\\n\");\n}", "function context (options, instance, stack = true) {\n // Attempt to use the options message as a `sprintf` format. Use the message\n // as is if `sprintf` fails.\n let message = options.message\n if (message == null) {\n message = instance.message = ''\n } else {\n message = instance.message = multiLine(message)\n try {\n instance.message = sprintf(message, options)\n message = instance.message.split('\\n').map((line, index) => index == 0 ? line : ` ${line}`).join('\\n')\n } catch (error) {\n instance.errors.push({\n code: Interrupt.Error.SPRINTF_ERROR,\n format: options.format,\n properties: options.properties,\n error: error\n })\n }\n }\n // The enumerable properties, if any, of the object using our special JSON.\n if (Object.keys(instance.displayed).length != 0) {\n message += '\\n\\n' + Interrupt.JSON.stringify(instance.displayed)\n }\n if (instance.errors.length != 0) {\n message += '\\n\\n' + Interrupt.JSON.stringify(instance.errors)\n }\n // **TODO** Without context messages we have more space. We could, if the\n // type is not an Error, serialize the cause as JSON. Parsing would be a\n // matter of detecting if it is an error, if not it is going to be JSON.\n // JSON will not look like an error, perhaps just plain `null` would be\n // confusing, but I doubt it.\n if (options.errors.length) {\n for (let i = 0, I = options.errors.length; i < I; i++) {\n const error = options.errors[i]\n const text = error instanceof Error ? Interrupt.stringify(error) : error.toString()\n const indented = text.replace(/^/gm, ' ')\n message += '\\n\\ncause:\\n\\n' + indented\n }\n }\n\n if (instance.tracers.length != 0) {\n message += `\\n\\ntrace:\\n\\n${\n instance.tracers.map(trace => ` at ${trace.file}:${trace.line}:${trace.column}`).join('\\n')\n }`\n }\n\n // A header for the stack trace unless the stack trace has been suppressed.\n if (stack && (options.$stack == null || options.$stack != 0)) {\n message += '\\n\\nstack:\\n'\n }\n\n return message\n}", "function appendMessage(data, position) {\n let messageElement = messageElementLi(data, position);\n messageContainer.appendChild(messageElement);\n\n // Scroll down\n messageContainer.scrollTop = messageContainer.scrollHeight;\n}", "function generateError(message) {\n store.addNewBookmark = !store.addNewBookmark\n return `\n <section class='error-content'>\n <button id=\"cancel-error\">X</button>\n <p>${message}</p>\n </section>`\n}", "push(type, char){\n if(this.isempty()){\n if(type==1){ //No use of storing backspace operation for empty stack\n return;\n }\n this.stack.push([type,char]);\n this.size++;\n return;\n }\n let top=this.stack[this.size-1];\n if(type==top[0] && top[1].length<this.buffer){\n top=this.stack.pop();\n top=char+top[1]; //sequence is very imp because char+top[1] means most recent character at beginning\n //so if intially we had \"cba\" and push for 'd' is demanded then top will be \"dcba\" ..stack is \"dcba\" for \n //message typed as \"abcd\". this is required for delete operation.\n this.stack.push([type,top]);\n }\n else{\n this.stack.push([type,char]);\n this.size++;\n }\n return this.stack[this.size-1];\n }", "function ParseErr(message, str, indx) {\r\n var whitespace = str.slice(0, indx).split(/\\n/);\r\n var lineNo = whitespace.length;\r\n var colNo = whitespace[lineNo - 1].length + 1;\r\n message +=\r\n ' at line ' +\r\n lineNo +\r\n ' col ' +\r\n colNo +\r\n ':\\n\\n' +\r\n ' ' +\r\n str.split(/\\n/)[lineNo - 1] +\r\n '\\n' +\r\n ' ' +\r\n Array(colNo).join(' ') +\r\n '^';\r\n throw EtaErr(message);\r\n}", "function withErrorStack(error,stack) {\n\n if (config.enviroment==='development') {\n return {...error,stack};\n }\n\n return error;\n\n}", "function assert(condition,message){\r\n\t\tif(!condition){\r\n\t\t\t//message//+=\" on line \"+lineNumber;\r\n\t\t\tconsole.log(message);\r\n\t\t\tvar error=new Error(message);\r\n\t\t\terror.name=\"ParseError\";\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}", "function posError(startPos, endPos, template) {\n var args = [];\n var i;\n for (i = 3; i < arguments.length; ++i)\n args.push(arguments[i]);\n throw new MicroXML.ParseError(source, startPos, endPos, template, args);\n }", "async handleNewPosition(position) {\n\t\ttry {\n\n\t\t\tlet entryOrders = [];\n\n\t\t\tfor (const entryNum in position.originalPosition.entries) {\n\t\t\t\tconst entry = position.originalPosition.entries[entryNum];\n\n\t\t\t\tLog.positions.debug(\n\t\t\t\t\t{\n\t\t\t\t\t\tmessage: \"Opening order for entry\",\n\t\t\t\t\t\tpositionId: position._id,\n\t\t\t\t\t\tentryNum: entryNum,\n\t\t\t\t\t\tentry: entry\n\t\t\t\t\t});\n\n\t\t\t\tconst orderSpec = {\n\t\t\t\t\texchange: position.originalPosition.exchange,\n\t\t\t\t\tpair: position.originalPosition.pair,\n\t\t\t\t\tdirection: position.originalPosition.direction,\n\t\t\t\t\tleverage: position.originalPosition.leverage,\n\t\t\t\t\tprice: entry.target,\n\t\t\t\t\tamount: entry.amount,\n\t\t\t\t\ttype: \"limit\",\n\t\t\t\t};\n\n\t\t\t\tconst orderId = await this.orderManager.createManagedOrder(orderSpec);\n\t\t\t\tentryOrders.push(orderId);\n\t\t\t}\n\n\t\t\t// update position status\n\t\t\tawait this.database.updateManagedPosition(\n\t\t\t\tposition._id,\n\t\t\t\t{\n\t\t\t\t\tentryOrders: entryOrders,\n\t\t\t\t\tstatus: Constants.PositionStatusEnum.ENTRIES_PLACED,\n\t\t\t\t});\n\n\t\t} catch(e) {\n\t\t\tLog.positions.error(\n\t\t\t\t{ \n\t\t\t\t\tmessage: \"Caught exception while trying to handle new position \"+ position._id,\n\t\t\t\t\tpositionId: position._id,\n\t\t\t\t\texception: e,\n\t\t\t\t});\n\t\t\t// TODO: here we may have created some but not all positions.\n\t\t\t// how should we clean up? should we retry?\n\t\t}\n\t}", "function crash(message) {\n throw new Error(`ERR (${state})/\"${buffer}\": ${message}`);\n }", "function crash(message) {\r\n throw new Error(`ERR (${state})/\"${buffer}\": ${message}`);\r\n }", "function crash(message) {\r\n throw new Error(`ERR (${state})/\"${buffer}\": ${message}`);\r\n }", "goToPosition(position) {\n\t\t//if we are already ina position clear the positionContainer\n\t\tif (this.presentPosition()) {\n\t\t\tthis.positionContainer.length = 0;\n\t\t}\n\t\t//if we find an 'entry' in a given position , we call it\n\t\tif (position.entry) {\n\t\t\tposition.entry(play);\n\t\t}\n\t\t//setting the current game position in the positionContainer\n\t\tthis.positionContainer.push(position);\n\t}", "function create(location, message) {\n return {\n location: location,\n message: message\n };\n }", "function create(location, message) {\n return {\n location: location,\n message: message\n };\n }" ]
[ "0.6381248", "0.5829679", "0.5817722", "0.5817722", "0.5817722", "0.5814672", "0.5766498", "0.5684867", "0.5679618", "0.54449147", "0.5392339", "0.5223852", "0.52174985", "0.50576764", "0.5057408", "0.5057408", "0.5032766", "0.5025934", "0.50057685", "0.4889266", "0.4858025", "0.48320192", "0.47733882", "0.47412357", "0.47349298", "0.4720542", "0.46984884", "0.46833107", "0.46550265", "0.4610402", "0.46065733", "0.46022686", "0.4583659", "0.45814067", "0.45726028", "0.4552072", "0.4540507", "0.4540507", "0.4540507", "0.4540507", "0.4540507", "0.4540507", "0.4535547", "0.4534049", "0.4526957", "0.4526957", "0.4526957", "0.452213", "0.45209077", "0.45113146", "0.4507092", "0.45004052", "0.4494065", "0.44841427", "0.44841427", "0.44834623", "0.44830585", "0.44770336", "0.44763952", "0.44526464", "0.44517377", "0.44258663", "0.4422389", "0.44132212", "0.43985268", "0.43889743", "0.43863472", "0.4381831", "0.43801194", "0.4378907", "0.437599", "0.4370757", "0.4366371", "0.43653235", "0.4360058", "0.43522176", "0.4345473", "0.43224946", "0.43089747", "0.4308543", "0.43072203", "0.429891", "0.4297736", "0.42967457", "0.42944703", "0.42924914", "0.42817983", "0.42731044", "0.42705694", "0.42492336", "0.42434454", "0.42404848", "0.42404848", "0.42362788", "0.42346853", "0.42346853" ]
0.56966686
10
Fail. Creates a vmessage, associates it with the file, and throws it.
function fail() { var message = this.message.apply(this, arguments); message.fatal = true; throw message; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fail(message) {\n throw new Error(message);\n }", "function fail(message) {\r\n\t throw new Error(message);\r\n\t}", "createFailureAtNode(node, message) {\n const sourceFile = node.getSourceFile();\n this.failures.push({\n filePath: this.fileSystem.resolve(sourceFile.fileName),\n position: ts.getLineAndCharacterOfPosition(sourceFile, node.getStart()),\n message: message,\n });\n }", "function fail(msg) { throw new Error(msg); }", "function fail(message) {\n throw new Error(message);\n}", "function fail(message) {\n throw new Error(message);\n}", "function fail() {\n var message = this.message.apply(this, arguments)\n\n message.fatal = true\n\n throw message\n}", "function fail() {\n var message = this.message.apply(this, arguments)\n\n message.fatal = true\n\n throw message\n}", "function fail() {\n var message = this.message.apply(this, arguments)\n\n message.fatal = true\n\n throw message\n}", "function fail() {\n var message = this.message.apply(this, arguments)\n\n message.fatal = true\n\n throw message\n}", "function fail() {\n var message = this.message.apply(this, arguments);\n\n message.fatal = true;\n\n throw message\n}", "function caml_failwith (msg) {\n caml_raise_with_string(caml_global_data[3], msg);\n}", "function fail$2() {\n var message = this.message.apply(this, arguments);\n\n message.fatal = true;\n\n throw message\n}", "function onFail(message) {\n }", "makeError(message) {\n var _a;\n let msg = (_a = this.fileName) !== null && _a !== void 0 ? _a : \"\";\n if (this.trackPosition) {\n if (msg.length > 0) {\n msg += \":\";\n }\n msg += `${this.line}:${this.column}`;\n }\n if (msg.length > 0) {\n msg += \": \";\n }\n return new Error(msg + message);\n }", "function message(reason, position, origin) {\n var filePath = this.path;\n var message = new VMessage(reason, position, origin);\n\n if (filePath) {\n message.name = filePath + ':' + message.name;\n message.file = filePath;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message;\n}", "function message(reason, position, origin) {\n var filePath = this.path;\n var message = new VMessage(reason, position, origin);\n\n if (filePath) {\n message.name = filePath + ':' + message.name;\n message.file = filePath;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message;\n}", "function message(reason, position, origin) {\n var filePath = this.path;\n var message = new VMessage(reason, position, origin);\n\n if (filePath) {\n message.name = filePath + ':' + message.name;\n message.file = filePath;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message;\n}", "function message(reason, position, origin) {\n var filePath = this.path;\n var message = new VMessage(reason, position, origin);\n\n if (filePath) {\n message.name = filePath + ':' + message.name;\n message.file = filePath;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message;\n}", "function message(reason, position, origin) {\n var filePath = this.path;\n var message = new VMessage(reason, position, origin);\n\n if (filePath) {\n message.name = filePath + ':' + message.name;\n message.file = filePath;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message;\n}", "function message(reason, position, origin) {\n var filePath = this.path\n var message = new VMessage(reason, position, origin)\n\n if (filePath) {\n message.name = filePath + ':' + message.name\n message.file = filePath\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function TestFail(message) {\n this.message = message || \"\";\n}", "function generateFailureMessage(msg, sentStr, receivedStr, sentChecksum, receivedChecksum) {\n return(\n `\n =========================\n ${msg} DETECTED\n input: ${sentStr} : ${sentChecksum}\n corrupted: ${receivedStr} : ${receivedChecksum}\n `);\n}", "function setFailed(message) {\r\n process.exitCode = ExitCode.Failure;\r\n error(message);\r\n}", "function setFailed(message) {\r\n process.exitCode = ExitCode.Failure;\r\n error(message);\r\n}", "function fail(message) {\n assert.fail(null, null, message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n }", "function bofError(msg) {\n throw new Error('Unsupported format, or corrupt file: ' + msg);\n }", "raise ( message, pos ) {\n\t\tconst err = new Error( this.sourceLocation( pos ) + ': ' + message );\n\t\terr.pos = this.completePosition( this.createPosition() );\n\t\tthrow err;\n\t}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "static fail(message) {\n return new StepResult(null, message);\n }", "function onFail(message) {\n console.log('Failed because: ' + message);\n }", "function buildVmFailHandler ({dispatch, vmName, msg, detailForNonexisting}) {\n return (data, exception) =>\n dispatch(vmActionFailed({\n name: vmName,\n detailForNonexisting, // used i.e. for failed Create VM\n connectionName: QEMU_SYSTEM,\n message: msg,\n detail: {\n data,\n exception: data ?\n (data.responseJSON && data.responseJSON.fault && data.responseJSON.fault.detail) ? data.responseJSON.fault.detail\n : ( data.responseJSON && data.responseJSON.detail ? data.responseJSON.detail\n : exception)\n : exception,\n }}));\n}", "function crash(message) {\r\n throw new Error(`ERR (${state})/\"${buffer}\": ${message}`);\r\n }", "function crash(message) {\r\n throw new Error(`ERR (${state})/\"${buffer}\": ${message}`);\r\n }", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin)\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin)\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin)\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin);\n\n if (this.path) {\n message.name = this.path + ':' + message.name;\n message.file = this.path;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message\n}", "function FAIL(message, resultCode) {\n LOG(message);\n throw Components.Exception(message, resultCode || Cr.NS_ERROR_INVALID_ARG);\n}", "function crash(message) {\n throw new Error(`ERR (${state})/\"${buffer}\": ${message}`);\n }", "function putJobFailure(message) {\n console.error('job failure: ', message)\n codepipeline.putJobFailureResult({\n jobId,\n failureDetails: {\n message: JSON.stringify(message),\n type: 'JobFailed',\n externalExecutionId: context.invokeid\n }\n }, (err, data) => context.fail(message))\n }", "function message(reason, position, ruleId) {\n var filePath = this.path;\n var range = stringify(position) || '1:1';\n var location;\n var err;\n\n location = {\n start: {line: null, column: null},\n end: {line: null, column: null}\n };\n\n if (position && position.position) {\n position = position.position;\n }\n\n if (position) {\n /* Location. */\n if (position.start) {\n location = position;\n position = position.start;\n } else {\n /* Position. */\n location.start = position;\n }\n }\n\n err = new VMessage(reason.message || reason);\n\n err.name = (filePath ? filePath + ':' : '') + range;\n err.file = filePath || '';\n err.reason = reason.message || reason;\n err.line = position ? position.line : null;\n err.column = position ? position.column : null;\n err.location = location;\n err.ruleId = ruleId || null;\n err.source = null;\n err.fatal = false;\n\n if (reason.stack) {\n err.stack = reason.stack;\n }\n\n this.messages.push(err);\n\n return err;\n}", "function onFail (message) {\n\t\talert ('Error occured: ' + message);\n\t}", "function raiseError(txt) {\r\n\tAssertionResult.setFailureMessage(txt);\r\n\tAssertionResult.setFailure(true);\r\n}", "function vxlActorGroupException(messages){\n this.messages = messages;\n}", "async function fails () {\n throw new Error('Contrived Error');\n }", "onWriteError(err, fileId, file) {\n console.error(`ufs: cannot write file \"${ fileId }\" (${ err.message })`);\n }" ]
[ "0.62669474", "0.62532586", "0.6132922", "0.6082876", "0.5987928", "0.5987928", "0.5881269", "0.5881269", "0.5881269", "0.5881269", "0.5850965", "0.57309186", "0.57105887", "0.55708826", "0.55331993", "0.5513839", "0.5513839", "0.5513839", "0.5513839", "0.5513839", "0.5501027", "0.5497712", "0.5489912", "0.5484464", "0.5484464", "0.5462988", "0.54555786", "0.54311186", "0.5411768", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5410367", "0.5383166", "0.5364718", "0.5351215", "0.5340981", "0.5340981", "0.5308418", "0.5308418", "0.5308418", "0.52939016", "0.52922785", "0.52786124", "0.5272835", "0.5257903", "0.52354574", "0.52302116", "0.5215557", "0.52055246", "0.52042496" ]
0.57952315
16
Info. Creates a vmessage, associates it with the file, and marks the fatality as null.
function info() { var message = this.message.apply(this, arguments); message.fatal = null; return message; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function info() {\n var message = this.message.apply(this, arguments)\n\n message.fatal = null\n\n return message\n}", "function info() {\n var message = this.message.apply(this, arguments)\n\n message.fatal = null\n\n return message\n}", "function info() {\n var message = this.message.apply(this, arguments)\n\n message.fatal = null\n\n return message\n}", "function info() {\n var message = this.message.apply(this, arguments)\n\n message.fatal = null\n\n return message\n}", "function info() {\n var message = this.message.apply(this, arguments);\n\n message.fatal = null;\n\n return message\n}", "function info$1() {\n var message = this.message.apply(this, arguments);\n\n message.fatal = null;\n\n return message\n}", "function message(reason, position, origin) {\n var filePath = this.path\n var message = new VMessage(reason, position, origin)\n\n if (filePath) {\n message.name = filePath + ':' + message.name\n message.file = filePath\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function message(reason, position, origin) {\n var filePath = this.path;\n var message = new VMessage(reason, position, origin);\n\n if (filePath) {\n message.name = filePath + ':' + message.name;\n message.file = filePath;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message;\n}", "function message(reason, position, origin) {\n var filePath = this.path;\n var message = new VMessage(reason, position, origin);\n\n if (filePath) {\n message.name = filePath + ':' + message.name;\n message.file = filePath;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message;\n}", "function message(reason, position, origin) {\n var filePath = this.path;\n var message = new VMessage(reason, position, origin);\n\n if (filePath) {\n message.name = filePath + ':' + message.name;\n message.file = filePath;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message;\n}", "function message(reason, position, origin) {\n var filePath = this.path;\n var message = new VMessage(reason, position, origin);\n\n if (filePath) {\n message.name = filePath + ':' + message.name;\n message.file = filePath;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message;\n}", "function message(reason, position, origin) {\n var filePath = this.path;\n var message = new VMessage(reason, position, origin);\n\n if (filePath) {\n message.name = filePath + ':' + message.name;\n message.file = filePath;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message;\n}", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin)\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin)\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin)\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin);\n\n if (this.path) {\n message.name = this.path + ':' + message.name;\n message.file = this.path;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message\n}", "function message$1(reason, position, origin) {\n var message = new VMessage$2(reason, position, origin);\n\n if (this.path) {\n message.name = this.path + ':' + message.name;\n message.file = this.path;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message\n}", "function MvFile() {\r\n}", "function info(message) {\r\n\tnotify(\"Information\", message);\r\n}", "function createMessage(message, vm, parent) {\n // if (Vuetify.config.silent) return\n if (parent) {\n vm = {\n _isVue: true,\n $parent: parent,\n $options: vm\n };\n }\n\n if (vm) {\n // Only show each message once per instance\n vm.$_alreadyWarned = vm.$_alreadyWarned || [];\n if (vm.$_alreadyWarned.includes(message)) return;\n vm.$_alreadyWarned.push(message);\n }\n\n return \"[Vuetify] \".concat(message) + (vm ? generateComponentTrace(vm) : '');\n}", "function createMessage(message, vm, parent) {\n if (framework_Vuetify.config.silent) return;\n\n if (parent) {\n vm = {\n _isVue: true,\n $parent: parent,\n $options: vm\n };\n }\n\n if (vm) {\n // Only show each message once per instance\n vm.$_alreadyWarned = vm.$_alreadyWarned || [];\n if (vm.$_alreadyWarned.includes(message)) return;\n vm.$_alreadyWarned.push(message);\n }\n\n return `[Vuetify] ${message}` + (vm ? generateComponentTrace(vm) : '');\n}", "function createMessage(message, vm, parent) {\n if (framework_Vuetify.config.silent) return;\n\n if (parent) {\n vm = {\n _isVue: true,\n $parent: parent,\n $options: vm\n };\n }\n\n if (vm) {\n // Only show each message once per instance\n vm.$_alreadyWarned = vm.$_alreadyWarned || [];\n if (vm.$_alreadyWarned.includes(message)) return;\n vm.$_alreadyWarned.push(message);\n }\n\n return `[Vuetify] ${message}` + (vm ? generateComponentTrace(vm) : '');\n}", "info(message) {\n return this.sendMessage(MessageType.Info, message);\n }", "function createInfoAlert() {\n viewFactory.createErrorAlert('Information', infoMessage);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n }", "function info(msg){if(PDFJS.verbosity>=PDFJS.VERBOSITY_LEVELS.infos){console.log('Info: '+msg);}} // Non-fatal warnings.", "function createMessage(message, vm, parent) {\n if (parent) {\n vm = {\n _isVue: true,\n $parent: parent,\n $options: vm\n };\n }\n\n if (vm) {\n // Only show each message once per instance\n vm.$_alreadyWarned = vm.$_alreadyWarned || [];\n if (vm.$_alreadyWarned.includes(message)) return;\n vm.$_alreadyWarned.push(message);\n }\n\n return `[Vuetify] ${message}` + (vm ? generateComponentTrace(vm) : '');\n}", "function info(msg) {\n if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.infos) {\n console.log('Info: ' + msg);\n }\n}", "function info(msg) {\n if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.infos) {\n console.log('Info: ' + msg);\n }\n}", "function info(msg) {\n if (verbosity >= VERBOSITY_LEVELS.infos) {\n console.log('Info: ' + msg);\n }\n }", "function info(message) {\r\n process.stdout.write(message + os.EOL);\r\n}", "function info(message) {\r\n process.stdout.write(message + os.EOL);\r\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os.EOL);\n}", "function info(message) {\n process.stdout.write(message + os$1.EOL);\n}", "function info(message) {\n process.stdout.write(message + os$1.EOL);\n}", "function VFile(options) {\n var prop\n var index\n\n if (!options) {\n options = {}\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options}\n } else if ('message' in options && 'messages' in options) {\n return options\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options)\n }\n\n this.data = {}\n this.messages = []\n this.history = []\n this.cwd = proc.cwd()\n\n // Set path related properties in the correct order.\n index = -1\n\n while (++index < order.length) {\n prop = order[index]\n\n if (own.call(options, prop)) {\n this[prop] = options[prop]\n }\n }\n\n // Set non-path related properties.\n for (prop in options) {\n if (order.indexOf(prop) < 0) {\n this[prop] = options[prop]\n }\n }\n}", "function VFile(options) {\n var prop\n var index\n\n if (!options) {\n options = {}\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options}\n } else if ('message' in options && 'messages' in options) {\n return options\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options)\n }\n\n this.data = {}\n this.messages = []\n this.history = []\n this.cwd = proc.cwd()\n\n // Set path related properties in the correct order.\n index = -1\n\n while (++index < order.length) {\n prop = order[index]\n\n if (own.call(options, prop)) {\n this[prop] = options[prop]\n }\n }\n\n // Set non-path related properties.\n for (prop in options) {\n if (order.indexOf(prop) < 0) {\n this[prop] = options[prop]\n }\n }\n}", "function info(message) {\n log('INFO', message);\n}", "static info(message) {\n\t\tthis.log(Logger.Level.info, message)\n\t}", "function VFile(options) {\n var prop\n var index\n var length\n\n if (!options) {\n options = {}\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options}\n } else if ('message' in options && 'messages' in options) {\n return options\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options)\n }\n\n this.data = {}\n this.messages = []\n this.history = []\n this.cwd = process.cwd()\n\n // Set path related properties in the correct order.\n index = -1\n length = order.length\n\n while (++index < length) {\n prop = order[index]\n\n if (own.call(options, prop)) {\n this[prop] = options[prop]\n }\n }\n\n // Set non-path related properties.\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop]\n }\n }\n}", "info (msg : string, ...args : mixed[]) {\n\t\tthis._print(\"info\", msg, ...args)\n\t}", "setMessage(info) {\n this.showRestartTip = info.showRestartTip;\n this.header.setText(info.header);\n this.message.setText(info.message);\n\n let headerWidth = this.header.getWidth();\n let messageWidth = this.message.getWidth();\n let longer = Math.max(headerWidth, messageWidth);\n let margin = 15;\n this.box.x = ((SCREEN.WIDTH - longer) / 2) - margin;\n this.box.width = longer + margin * 2;\n }", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function outputFileCreationInfo(file)\n{\n // Add the build information and header to the output file\n ccdd.writeToFileLn(file, \"# Created : \" + ccdd.getDateAndTime() + \"\\n# User : \" + ccdd.getUser() + \"\\n# Project : \" + ccdd.getProject() + \"\\n# Script : \" + ccdd.getScriptName());\n\n // Check if any table is associated with the script\n if (ccdd.getTableNumRows() != 0)\n {\n ccdd.writeToFileLn(file, \"# Table(s): \" + [].slice.call(ccdd.getTableNames()).sort().join(\",\\n# \"));\n }\n\n // Check if any groups is associated with the script\n if (ccdd.getAssociatedGroupNames().length != 0)\n {\n ccdd.writeToFileLn(file, \"# Group(s): \" + [].slice.call(ccdd.getAssociatedGroupNames()).sort().join(\",\\n# \"));\n }\n\n ccdd.writeToFileLn(file, \"\");\n}", "function popUpInfo(message) {\n\tvar p = new PopUp({\n\t\t\"message\": message,\n\t\t\"ok\": true,\n\t\t\"cancel\": false,\n\t\t\"custom\": false,\n\t\t\"close\": true,\n\t\t\"icon\": \"📣\"\n\t});\n\tp.create().then((result) => { }).catch((err) => console.log(err));\n}", "function createInfoNotification(message, seconds){\n\tcreateNotification(message, \"info\", seconds);\n}", "function moveToNewFile(message) {\n console.log(message);\n}" ]
[ "0.65584934", "0.65584934", "0.65584934", "0.65584934", "0.6528591", "0.6275661", "0.61959714", "0.61930555", "0.61930555", "0.61930555", "0.61930555", "0.61930555", "0.6156254", "0.6156254", "0.6156254", "0.61109775", "0.58577347", "0.5675953", "0.5599736", "0.549691", "0.5461374", "0.5461374", "0.54310465", "0.5394302", "0.5390062", "0.53833437", "0.5364812", "0.5356553", "0.5356553", "0.5252992", "0.5213358", "0.5213358", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.51955974", "0.5165827", "0.5165827", "0.5145102", "0.5145102", "0.5115324", "0.5112237", "0.5068724", "0.5062454", "0.50604624", "0.5052409", "0.5052409", "0.5052409", "0.5052409", "0.5052409", "0.5052409", "0.5042207", "0.50276256", "0.50045526", "0.499554" ]
0.6468086
8
Construct a new file.
function VFile(options) { var prop; var index; var length; if (!options) { options = {}; } else if (typeof options === 'string' || buffer(options)) { options = {contents: options}; } else if ('message' in options && 'messages' in options) { return options; } if (!(this instanceof VFile)) { return new VFile(options); } this.data = {}; this.messages = []; this.history = []; this.cwd = process.cwd(); /* Set path related properties in the correct order. */ index = -1; length = order.length; while (++index < length) { prop = order[index]; if (own.call(options, prop)) { this[prop] = options[prop]; } } /* Set non-path related properties. */ for (prop in options) { if (order.indexOf(prop) === -1) { this[prop] = options[prop]; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createFile() {\n var e = new emitter();\n\n fs.readFile('newdocument.txt', function (err) {\n if (err) throw err;\n e.emit('theProcess');\n });\n\n return e;\n}", "function createNewFile() {\n file = {\n name: 'novo-arquivo.txt',\n content: '',\n saved: false,\n path: app.getPath('documents') + '/novo-arquivo.txt'\n }\n\n mainWindow.webContents.send('set-file', file)\n}", "open() {\n this.close()\n\n const file = path.normalize(this._filename)\n const opts = {\n flags: this._append ? 'a' : 'w',\n encoding: 'utf8',\n }\n\n ensureDirectoryExistence(file)\n this._writer = fs.createWriteStream(file, opts)\n }", "function fileFactory(arg) {\n\t// Files can be constructed from either a siapath or a status object\n\t// returned from /renter/files||downloads\n\tvar f = Object.create(file);\n\tif (typeof arg === 'object'){\n\t\tObject.assign(f, arg);\n\t\tf.path = arg.siapath;\n\t} else if (typeof arg === 'string') {\n\t\tf.path = arg;\n\t} else {\n\t\tconsole.error('Unrecognized constructur argument: ', arguments);\n\t}\n\n\treturn f;\n}", "create() {\n this.proc.args.file = null;\n\n this.emit('new-file');\n\n this.updateWindowTitle();\n }", "static genEmptyFileObj() {\n return new FileObject();\n }", "function File() {}", "function createFile(){\n if (projectType == \"Basic\") {\n internalReference = idAgency + \"-\" + padToFour(orderNumber) + \"-\" + padToTwo(version) + \"-\" + padToTwo(revision);\n updateListItem(fileId,internalReference,documentType,description,dateCreated,diffusionDate,externalReference,localization,form,status);\n //Internal Reference as Full\n } else if (projectType == \"Full\") {\n internalReference = documentType + \"-\" + padToFour(projectCode) + \"-\" + padToTwo(avenant) + \"-\" + idAgency + \"-\" + padToFour(orderNumber) + \"-\" + padToTwo(version) + \"-\" + padToTwo(revision);\n updateListItem(fileId, internalReference, documentType, description, dateCreated, diffusionDate, externalReference, localization, form, status);\n //Internal Reference as Full Without Project \n } else {\n\n internalReference = documentType + \"-\" + idAgency + \"-\" + padToFour(orderNumber) + \"-\" + padToTwo(version) + \"-\" + padToTwo(revision);\n updateListItem(fileId, internalReference, documentType, description, dateCreated, diffusionDate, externalReference, localization, form, status);\n }\n }", "createFile() {\n try {\n fse.ensureDirSync(this.directory);\n } catch(e) {\n if ( e.code != 'EEXIST' ) throw e;\n }\n\n if (!utils.fileExists(this.file)) {\n fs.writeFileSync(this.file, this.serialize(this.defaultConfig));\n log.d('Created the default config file in ' + this.file);\n }\n }", "createNewfile(state, options) {\n //Get desired filename\n let name;\n if(options !== undefined && options.name !== undefined)\n name = getDefaultName(options.name);\n else\n name = getDefaultName();\n\n //Insert empty rows to fill up to the desired well count\n state.plate = plates[\"MWP 24\"];\n var values = [];\n for (let i = 0; i < state.plate.wells; i++) {\n values.push([0, 0]);\n }\n\n state.file = {\n substances: [\n { name: \"Water\", color: \"#6699ff\" },\n { name: \"Sample 1\", color: \"#66ff33\" },\n ],\n\n name: name,\n values: values,\n };\n }", "function createFile(fullPathToFile, newFilePath, newFileName, newFileParentPath, timestamp, markAsPermanentlyNotRelevant) {\n\n //if this should be ignored due to the st-ignore.json file\n if(!ignoreThisFileOrDir(newFilePath)) {\n \n //create an id for this file\n var newFileId = \"fileId-\" + branchId + \"_\" + autoGeneratedFileId;\n \n //get the id ready for the next file/dir\n autoGeneratedFileId++;\n\n //create a new file object\n var newFile = {\n id: newFileId,\n parentId: getIdFromDirPath(newFileParentPath),\n currentName: newFileName,\n isDeleted: false\n };\n\n //add the file to the object of all files\n allFiles[newFileId] = newFile;\n\n //make a connection between the file path and an id \n addFilePathToIdMap(newFilePath, newFileId);\n \n //create a new empty 2D array to hold insert events for the default file\n allInsertEventsByFile[newFileId] = [];\n\n //create a new file event\n var createFileEvent = {\n id: \"ev_\" + branchId + \"_\" + autoGeneratedEventId, \n timestamp: timestamp,\n type: \"Create File\",\n initialName: newFileName,\n fileId: newFileId,\n parentDirectoryId: newFile.parentId,\n createdByDevGroupId: currentDeveloperGroup.id\n };\n \n //increase the id so the next event has a unique id\n autoGeneratedEventId++;\n \n //if the user wants to mark this file as NOT relevant (because it is an existing file\n //that is being reconciled in a new project)\n if(markAsPermanentlyNotRelevant === true) {\n\n //pre-mark the event as not even possible to become relevant\n createFileEvent.permanentRelevance = \"never relevant\";\n }\n\n //add the event to the collection of all events\n codeEvents.push(createFileEvent);\n\n //occassionally a new file has something in it, for example, if a tool has generated the file\n //if the file has anything in it, take the contents and make them events in the system\n\n //open the file and read the text\n var fileText = fs.readFileSync(fullPathToFile, \"utf8\");\n \n //if there is anything in the new file\n if(fileText !== \"\") {\n\n //add the text into \n insertText(newFilePath, fileText, 0, 0, false, [], new Date().getTime(), markAsPermanentlyNotRelevant);\n }\n }\t \n}", "function createFile() {\n var message = 'create file randomly',\n params = {\n message: message,\n committer: {\n name: 'yukihirai0505',\n email: '[email protected]'\n },\n content: Utilities.base64Encode(message)\n },\n data = fetchJson(FILE_URL.replace(FILE_PATH_PLACEHOLDER, getRandomString()), 'PUT', params);\n Logger.log(data);\n}", "function makeTheFile(name, data){\n fs.writeFile('README.md', data, (err) => {\n if (err){\n console.log(err);\n }\n console.log(\"README has been successfully generated.\")\n })\n }", "function createFile(filename, content) {\n if (existsSync(filename)) return console.log(filename + ' already exists - exiting');\n const data = new Uint8Array(Buffer.from(content));\n writeFile(filename, data, (err) => {\n if (err) throw err;\n console.log(filename + ' created.');\n });\n}", "static createFile(evt, {path=null, str=\"\"}){\n // must have file path\n if(!path){\n let err = \"No file name provided (path is null).\";\n IpcResponder.respond(evt, \"file-create\", {err});\n return;\n }\n\n // figure file path data from file string \n let fileName = path.split(\"/\").pop();\n let dir = path.split(`/${fileName}`)[0];\n let knownFolder = FolderData.folderPaths.includes(path);\n\n // create the file \n FileUtils.createFile(path, str)\n .then(() => {\n // file created\n IpcResponder.respond(evt, \"file-create\", {dir, fileName, knownFolder});\n\n // update recent files \n FolderData.updateRecentFiles([path]);\n })\n .catch(err => {\n // error\n IpcResponder.respond(evt, \"file-create\", {err: err.message});\n });\n }", "function fileCreate(fileName, data) {\n fs.writeFile(fileName, data, err => {\n if (err) {\n return console.log(err);\n }\n console.log('Your readme has been generated!')\n});\n}", "function newFile() {\n\teditor.reset();\n\tpathToFileBeingEdited = undefined;\n\tparse();\n}", "constructor(filename) {\n if (!filename) {\n throw new Error(\"Creating a repository requires a new filename\");\n }\n this.filename = filename;\n //chek if the file exixts\n try {\n fs.accessSync(this.filename);\n //if not create a new file\n } catch (err) {\n fs.writeFileSync(this.filename, \"[]\");\n }\n }", "function createFile() {\r\n const iterator1 = stories[Symbol.iterator]();\r\n var combos = \"\";\r\n for (const item of iterator1) {\r\n combos = combos + item[0] + '\\n' + splitConstant + '\\n' + item[1] + '\\n' + splitConstant + '\\n';\r\n }\r\n var text = combos;\r\n var filename = 'stories.txt';\r\n var element = document.createElement('a');\r\n element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));\r\n element.setAttribute('download', filename);\r\n element.style.display = 'none';\r\n document.body.appendChild(element);\r\n element.click();\r\n document.body.removeChild(element);\r\n}", "function createNewSketchFile (){\n var newFile = MSDocument.new();\n newFile.setFileName(context.document.fileName().replace('.sketch','') + \" Library.sketch\")\n newFile.saveDocumentAs(newFile)\n log(newFile.fileName())\n return newFile\n}", "function File() {\n _classCallCheck(this, File);\n\n File.initialize(this);\n }", "createFile(path) {\n touch.sync(path.absolute);\n }", "static init() {\n fs.writeFile(file, '{}');\n }", "function createFakeFile() {\n const owner = ld.sample(owners);\n const startedAt = faker.date.past().getTime();\n\n return {\n uploadId: uuid.v4(),\n status: ld.sample(statusValues),\n startedAt,\n uploadedAt: startedAt + 1000,\n name: faker.commerce.productName(),\n files: JSON.stringify([]), // can insert real files, but dont care\n contentLength: ld.random(1, 2132311),\n parts: ld.random(1, 4),\n [FILES_OWNER_FIELD]: owner,\n };\n }", "function create( src, dst, opts ) {\n\n if( !src || !src.length )\n throw { fluenterror: HMSTATUS.createNameMissing, quit: true };\n\n _.each( src, function( t ) {\n var safeFmt = opts.format.toUpperCase();\n this.stat( HMEVENT.beforeCreate, { fmt: safeFmt, file: t } );\n MKDIRP.sync( PATH.dirname( t ) ); // Ensure dest folder exists;\n var RezClass = require('../core/' + safeFmt.toLowerCase() + '-resume' );\n RezClass.default().save(t);\n this.stat( HMEVENT.afterCreate, { fmt: safeFmt, file: t } );\n }, this);\n\n }", "getByName(name) {\r\n const f = new File(this);\r\n f.concat(`('${name}')`);\r\n return f;\r\n }", "async createFile(filePath, contents, newFileName = \"Untitled.spell\", die) {\n if (!die) die = getDier(this, \"creating file\", { projectId: this.projectId, filePath })\n\n if (!filePath) filePath = prompt(\"Name for the new file?\", newFileName)\n if (!filePath) return undefined\n die.params.filePath = filePath\n\n await this.loadOrDie(die)\n if (this.getFile(filePath)) die(\"File already exists.\")\n\n // Tell the server to create the file, which returns updated index\n try {\n const newIndex = await $fetch({\n url: `/api/projects/create/file`,\n contents: {\n projectId: this.projectId,\n filePath,\n contents: contents ?? `## This space intentionally left blank`\n },\n requestFormat: \"json\",\n format: \"json\"\n })\n this.setContents(newIndex)\n } catch (e) {\n die(\"Server error creating file\", e)\n }\n\n // Return the file\n return this.getFile(filePath) || die(\"Server didn't create file.\")\n }", "async newFile(options){\n const self = this;\n const validateConfig = await ObjectValidator.validate({ object: options, against: \"File_Creation\", });\n\n if(validateConfig.success){\n if(validateConfig.object.folder !== \"\"){\n await this.makeLocalDir(`${self.config.basePath}${self.config.basePath === \"\" ? \"\" : \"/\"}${validateConfig.object.folder.replace(\"FILE_EXTENSION_WISE\", \"\")}`);\n }\n\n if(validateConfig.object.request){\n // If an Http request is provided.\n let requestFiles = await this.getFilesFromHttpRequest(validateConfig.object.request);\n let FCFiles = [];\n\n for(let requestFile of requestFiles){\n let { contents, contentType, contentLength, readStream } = await this.getLocalFileContents(requestFile.path, false, null); // contents & readStream are same since 2nd parameter, decrypt, is false. If decrypt is true, contents is a pipeline.\n let isStream = true;\n let doEncrypt = false;\n let didEncrypt = false;\n\n if(contents){\n let finalContents = contents;\n if(this.file_protector !== null && validateConfig.object.isEncrypted === false){\n // If a file protector is assigned & passed value of isEncrypted is not true, encrypt the contents.\n doEncrypt = true;\n // Encrypt contents while writing the file.\n }\n\n let requestFileName = requestFile.originalFilename;\n let ext_regex = /(?:\\.([^.]+))?$/;\n let requestFileExt = ext_regex.exec(requestFileName)[1];\n let folderPath = validateConfig.object.folder.replace(\"FILE_EXTENSION_WISE\", requestFileExt.toString().toLowerCase());\n let fullFolderPath = await this.beautifyPath(folderPath, true);\n\n await this.makeLocalDir(fullFolderPath);\n\n let newLocalFileCreated = await this.makeLocalFile(`${fullFolderPath}${fullFolderPath == \"\" ? \"\" : \"/\"}${requestFileName}`, finalContents, readStream, doEncrypt, isStream, contentLength, false);\n if(newLocalFileCreated === true){\n if(doEncrypt === true){ didEncrypt = true; }\n\n let obj = { name: requestFileName.replace(\".\"+requestFileExt, \"\"), ext: requestFileExt, folder: folderPath, handler: self, isEncrypted: validateConfig.object.isEncrypted === true ? true : didEncrypt, };\n let newFCFile = await self.newFCFile(obj); // Wrap file values in a FCFile instance.\n\n Logger.log(\"New LSfile created\");\n newFCFile ? FCFiles.push(newFCFile) : false;\n }\n }else{ }\n }\n\n return FCFiles.length > 0 ? FCFiles : null;\n }else{\n let folderPath = validateConfig.object.folder.replace(\"FILE_EXTENSION_WISE\", validateConfig.object.ext.toString().toLowerCase());\n let fullFolderPath = await this.beautifyPath(folderPath, true);\n\n await this.makeLocalDir(fullFolderPath);\n\n let finalContents = validateConfig.object.contents;\n let doEncrypt = false;\n let didEncrypt = false;\n if(this.file_protector !== null && validateConfig.object.isEncrypted === false){\n // If a file protector is assigned & passed value of isEncrypted is not true, encrypt the contents.\n doEncrypt = true;\n // Encrypt contents while writing the file.\n }\n\n let newLocalFileCreated = await this.makeLocalFile(\n `${fullFolderPath}${fullFolderPath == \"\" ? \"\" : \"/\"}${validateConfig.object.name}.${validateConfig.object.ext}`,\n finalContents,\n validateConfig.object.readStream !== null ? validateConfig.object.readStream : validateConfig.object.isStream === true ? finalContents : null,\n doEncrypt,\n validateConfig.object.isStream,\n validateConfig.object.isStream === true ? validateConfig.object.contentLength : finalContents.length,\n false\n );\n\n if(newLocalFileCreated === true){\n if(doEncrypt === true){ didEncrypt = true; }\n\n let obj = { name: validateConfig.object.name, ext: validateConfig.object.ext, folder: folderPath, handler: self, isEncrypted: validateConfig.object.isEncrypted === true ? true : didEncrypt, };\n let newFCFile = await self.newFCFile(obj); // Wrap file values in a FCFile instance.\n\n Logger.log(\"New LSfile created\");\n return newFCFile;\n }\n\n Logger.log(\"New LSfile creation failed\");\n }\n }else{ Logger.log(\"New LSfile creation failed\"); }\n\n return null;\n }", "async createFile(name) {\n let normalizedDir = this.fullPath;\n if (normalizedDir.charAt(normalizedDir.length - 1) === path_1.sep) {\n normalizedDir = normalizedDir.slice(0, -1);\n }\n const fd = await util_1.promisify(fs_1.open)(`${normalizedDir}${path_1.sep}${name}`, 'w');\n await util_1.promisify(fs_1.close)(fd);\n this.context.socketService.notifyRefresh(this.path.replace(/\\\\/g, '/').replace(/\\/$/, \"\"));\n return this.context.getHierarchyItem(this.path + name);\n }", "function makeFile(info) {\n const { comment, upstream, config } = info\n return (\n `// ${comment}\\n` +\n '//\\n' +\n `// Auto-generated by ${packageJson.name}\\n` +\n `// based on rules from ${upstream}\\n` +\n '\\n' +\n '\"use strict\";\\n' +\n '\\n' +\n `module.exports = ${JSON.stringify(sortJson(config), null, 2)};\\n`\n )\n}", "constructor (filename) {\n super()\n this.filename = filename\n }", "constructor (path) {\n const f = new IO(path, 'r');\n this.is_base = true;\n\n // copy as tempfile\n this.file = IO.temp('w+');\n let d = f.read(BUFFER_SIZE);\n while (d.length > 0) {\n this.file.write(d);\n d = f.read(BUFFER_SIZE);\n }\n\n f.close();\n if (!Base.surely_formatted(this.file)) {\n throw new Error('Unsupported file passed.');\n }\n\n // TODO: close and remove the Tempfile.\n this.frames = new Frames(this.file);\n }", "_save() {\n let content = this.input.getContent().split(\"</div>\").join(\"\")\n .split(\"<div>\").join(\"\\n\");\n this.file.setContent(content);\n\n // create new file\n if (this.createFile)\n this.parentDirectory.addChild(this.file);\n }", "function File() {\n\t/**\n\t * The data of a file.\n\t */\n\tthis.data = \"\";\n\t/**\n\t * The name of the file.\n\t */\n\tthis.name = \"\";\n}", "function File() {\n\t/**\n\t * The data of a file.\n\t */\n\tthis.data = \"\";\n\t/**\n\t * The name of the file.\n\t */\n\tthis.name = \"\";\n}", "function createNewFile(fullpath, contents, testExt) {\n function _getUntitledFileSuggestion(dir, baseFileName, fileExt, isFolder) {\n var result = new $.Deferred();\n var suggestedName = baseFileName + fileExt;\n var dirEntry = new NativeFileSystem.DirectoryEntry(dir);\n\n result.progress(function attemptNewName(suggestedName, nextIndexToUse) {\n if (nextIndexToUse > 99) {\n //we've tried this enough\n result.reject();\n return;\n }\n\n //check this name\n var successCallback = function (entry) {\n //file exists, notify to the next progress\n result.notify(baseFileName + \"-\" + nextIndexToUse + fileExt, nextIndexToUse + 1);\n };\n var errorCallback = function (error) {\n //most likely error is FNF, user is better equiped to handle the rest\n result.resolve(suggestedName);\n };\n \n if (isFolder) {\n dirEntry.getDirectory(\n suggestedName,\n {},\n successCallback,\n errorCallback\n );\n } else {\n dirEntry.getFile(\n suggestedName,\n {},\n successCallback,\n errorCallback\n );\n }\n });\n\n //kick it off\n result.notify(baseFileName + fileExt, 1);\n\n return result.promise();\n }\n var basedir = fullpath.substring(0, fullpath.lastIndexOf(\"/\")),\n name = fullpath.substring(fullpath.lastIndexOf(\"/\") + 1),\n testname = name.substring(0, name.lastIndexOf('.js')) + testExt;\n var deferred = _getUntitledFileSuggestion(basedir, testname, \".js\", false);\n var createWithSuggestedName = function (suggestedName) {\n var result = ProjectManager.createNewItem(basedir, suggestedName, true, false);\n result.done(function (entry) {\n DocumentManager.getDocumentForPath(entry.fullPath).done(function (doc) {\n doc.setText(contents);\n });\n });\n };\n\n deferred.done(createWithSuggestedName);\n return deferred;\n }", "function create(path, mode, callback) {\n console.log(\"TODO: Implement create\", arguments);\n }", "function createFile(path, content) {\n fs.writeFileSync(path, content, { encoding: \"utf-8\" });\n}", "function createLog(){\n var a = \"log_\" + moment().format('YYMMDD-HHmm') + \".txt\";\n logName = a;\n fs.writeFile(a,\"Starting Log:\\n\",(err)=>{\n if(err) throw(err); \n });\n}", "create (file,data) {\n fs.open(`${baseDir}/${file}.json`,'wx',(err,identifier)=>{\n if(!err && identifier){\n //Overide default to place objects inside of an array\n //let jsonArray = [];\n\n //jsonArray.push(data);\n\n let stringData = JSON.stringify(data,null,3);\n\n fs.writeFile(identifier,stringData,(err)=>{\n if(!err){\n fs.close(identifier,(err) =>{\n if(!err) console.log('no errors');\n else console.log(err);\n })\n } else console.log(err);\n })\n }\n else console.log(err);\n });\n }", "function createFVSObject (fileContents) {\n // a. Hash the contents of the file\n // b. Use the first two characters of the hash as the directory in .fvs/objects\n // c. Check if the directory already exists! Do you know how to check if a directory exists in node?\n // Hint: you'll need to use a try/catch block\n // Another hint: look up fs.statSync\n // d. Write a file whose name is the rest of the hash, and whose contents is the contents of the file\n // e. Return the hash!\n}", "constructor (filename) {\n \n // Obtém conteúdo da template.\n this.template = fs.readFileSync(filename).toString(); \n }", "function createFile(srcURL, destURL) {\n fs.appendFile(destURL, '', function (err) {\n if (err) throw err;\n console.log('File Saved');\n });\n fs.copyFile(srcURL, destURL, (error) => {\n // incase of any error\n if (error) {\n console.error(error);\n return;\n }\n\n console.log(\"File Copied\");\n });\n}", "function FakeFile(path)\n{\n this.path = path;\n}", "function File() {\n this.lastFileName = \"untitled.map\";\n}", "createFile(text){\n this.model.push({text});\n\n // This change event can be consumed by other components which\n // can listen to this event via componentWillMount method.\n this.emit(\"change\")\n }", "function createFile() {\n const renderedHTML = render(teamMembers);\n fs.writeFileSync(outputPath, renderedHTML);\n}", "function File(info) {\n this.name = info.name;\n this.kind = info.kind;\n this.genre = info.genre;\n this.size = info.size;\n this.last_revision = info.commit_revision;\n this.author = info.commit_author;\n this.last_date = info.commit_date;\n this.id = info.index;\n this.commit_history = {};\n this.comments = [];\n}", "function createFile(){\n\n var reader = new FileReader();\n \n reader.readAsDataURL(blob)\n\n reader.onloadend = function () {\n\n var base64String = reader.result;\n\n // Remove the additional data at the front of the string\n\n var base64Substring = base64String.substr(base64String.indexOf(',') + 1)\n\n // Upload to the CSV Creator element\n context.uploadContent( filename, base64Substring, uploadFile);\n\n }\n\n }", "function newfile() {\n let newFile = document.querySelector(\".add-file\");\n\n fileDiv = document.createElement(\"div\");\n fileDiv.classList.add(`file-div-${fileCounter}`);\n\n buttonRemoveFile = document.createElement(\"button\");\n buttonRemoveFile.classList.add(`file-div-${fileCounter}`);\n buttonRemoveFile.setAttribute(\"type\", \"button\");\n buttonRemoveFile.innerHTML = \"Remove File -\";\n\n labelFileComplete = document.createElement(\"label\");\n labelFileComplete.setAttribute(\"for\", \"completed-file\");\n labelFileComplete.innerHTML = \"Completed\"\n fileCompleteRadio = document.createElement(\"input\");\n fileCompleteRadio.setAttribute(\"type\", \"checkbox\");\n fileCompleteRadio.setAttribute(\"id\", \"completed-file\");\n fileCompleteRadio.setAttribute(\"name\", `file-name-${fileCounter}`);\n fileCompleteRadio.setAttribute(\"value\", \"completed\");\n fileCompleteRadio.classList.add(\"create-checkbox\");\n\n labelFileName = document.createElement(\"label\");\n labelFileName.setAttribute(\"for\", \"file-name\");\n labelFileName.classList.add(`label-filename`);\n labelFileName.innerHTML = \"File name: \";\n \n inputFileName = document.createElement(\"input\");\n inputFileName.setAttribute(\"type\", \"text\");\n inputFileName.setAttribute(\"id\", `file-name-${fileCounter}`);\n inputFileName.setAttribute(\"name\", `file-name-${fileCounter}`);\n inputFileName.setAttribute(\"size\", \"50.5\");\n\n labelFileDesc = document.createElement(\"label\");\n labelFileDesc.setAttribute(\"for\", \"file-desc\");\n labelFileDesc.classList.add(\"label-filedesc\");\n labelFileDesc.innerHTML = \"File Description: \";\n\n inputFileDesc = document.createElement(\"textarea\");\n inputFileDesc.setAttribute(\"id\", `file-desc`);\n inputFileDesc.setAttribute(\"name\", `file-name-${fileCounter}`);\n\n newBreak = document.createElement(\"br\");\n oneMoreBreak = document.createElement(\"br\");\n secMoreBreak = document.createElement(\"br\");\n\n inputFileName.append(newBreak);\n\n divAddClass = document.createElement(\"div\");\n divAddClass.classList.add(`add-class-${fileCounter}`, \"add-class\");\n \n buttonAddClass = document.createElement(\"button\");\n buttonAddClass.classList.add(`${fileCounter}`);\n buttonAddClass.classList.add(`add-class-button`);\n buttonAddClass.setAttribute(\"type\", \"button\");\n buttonAddClass.innerHTML = \"Add Class +\";\n\n divAddClass.append(buttonAddClass);\n divAddClass.append(newBreak);\n fileDiv.append(labelFileName);\n fileDiv.append(inputFileName);\n fileDiv.append(fileCompleteRadio);\n fileDiv.append(labelFileComplete);\n fileDiv.append(buttonRemoveFile);\n fileDiv.append(secMoreBreak);\n fileDiv.append(labelFileDesc);\n fileDiv.append(oneMoreBreak);\n fileDiv.append(inputFileDesc);\n fileDiv.append(divAddClass);\n fileDiv.append(newBreak);\n newFile.append(fileDiv);\n fileCounter = fileCounter + 1;\n}", "constructor (fh, filename) {\n //\"\"\" initalize. \"\"\"\n //if hasattr(filename, 'read'):\n // if not hasattr(filename, 'seek'):\n // raise ValueError(\n // 'File like object must have a seek method')\n \n var superblock = new SuperBlock(fh, 0);\n var offset = superblock.offset_to_dataobjects;\n var dataobjects = new DataObjects(fh, offset);\n super('/', dataobjects, null);\n this.parent = this;\n\n this._fh = fh\n this.filename = filename || '';\n\n this.file = this;\n this.mode = 'r';\n this.userblock_size = 0;\n }", "constructor(file) {\n this._file = file\n this.size = file.size\n }", "function create() {\n\t// make the overarching dir for ease of copying data around\n\tif(!fs.existsSync(\"instructions.md\")){\n\t\tconsole.log(\"ERR : No instructions.md file. Exiting without finishing...\");\n\t\treturn 1;\n\t}\n\tif(!fs.existsSync(\"tests\")){\n\t\tconsole.log(\"ERR : No tests file. Exiting without finishing... \");\n\t\treturn 1;\n\t}\n\tif(!fs.existsSync(project)){\n\t\tfs.mkdirSync(project);\n\t\tfullpath = project + \"/\";\n\t\tconsole.log(\"INFO : Project folder created\");\n\t}\n\tObject.keys(students).forEach(function (key) {\n\t\tvar err = genDir(students[key].login);\n\t\tif(err) {\n\t\t\tconsole.log(\"ERR : Error during creation of directory for : \" + students[key].login);\n\t\t} else {\n\t\t\tconsole.log(\"INFO : Directory created for : \" + students[key].login);\n\t\t}\n\t});\n}", "async makeLocalFile(path, contents, readStream, doEncrypt, isStream, contentLength, isReplacing = false){\n // isReplacing, when true, stores the contents in a temp file and writes them to the file at path. isReplacing must be true when reading and writing from and to the same file.\n // readStream is null when isStream is false.\n\n let self = this;\n try{\n var contentStream = contents;\n const uniqueIV = crypto.randomBytes(16).toString('hex');\n\n if(isStream === false){\n const readData = doEncrypt === true ? Buffer.concat([Buffer.from(`(${uniqueIV})`), Buffer.isBuffer(contents) ? contents : Buffer.from(contents)]) : Buffer.isBuffer(contents) ? contents : Buffer.from(contents);\n contentStream = self.createDataReadStream(readData, self.config.encryptingSpeed);\n }\n\n try{ contentStream.pause(); }catch(error){ Logger.log(error); }\n try{ readStream.pause(); }catch(error){ Logger.log(error); }\n\n contentStream.on('end', function(){ contentStream.destroy(); });\n contentStream.on('error', function(error){ Logger.log(error); contentStream.destroy(); });\n\n let random = Math.floor(Math.random()*1000000000000000000000)+100000000000000000000;\n let finalPath = isReplacing === true ? `${self.config.basePath}/temp/temp-${random}.temp` : path;\n\n if(isReplacing === true){ await self.makeLocalDir(`${self.config.basePath}/temp`); }\n\n if(doEncrypt === true){\n // This condition is true, when making a new encrypted file or when replacing contents of a decrypted file with encrypted ones.\n\n // WHEN contents IS A STREAM (isStream === true) contentLength does not needs to be increased for encryptStream by 34 for IV since uniqueIV is not pushed into contentStream instead it's pushed into writeStream...\n // ...therefore it will not be processed in the encryptStream, due to which encrypt stream will only need to the length of contents without IV length.\n let encryptStream = self.createEncryptStream(self.config.encryptingSpeed, contentStream, contentLength+(isStream === true ? 0 : 34), uniqueIV);\n let writeStream = fs.createWriteStream(finalPath, {flags: 'a', highWaterMark: self.config.encryptingSpeed, });\n if(isStream === true){\n // If contents is a stream, contentStream is set to contents and a manual creation of contentStream is not done therefore it is required to pass the uniqueIV.\n writeStream.write(`(${uniqueIV})`);\n }\n\n try{ contentStream.resume(); }catch(error){ Logger.log(error); }\n try{ readStream.resume(); }catch(error){ Logger.log(error); }\n\n await pipelineWithPromise(contentStream, encryptStream, writeStream).catch(error => { Logger.log(error); });\n }else{\n if(isReplacing === true){\n // doEncrypt false and isReplacing true proves that an encrypted file is being replaced, in other words, a file is being decrypted.\n // contentStream is a pipeline passed from getLocalFileContents()\n // isStream is TRUE\n\n try{ contentStream.resume(); }catch(error){ Logger.log(error); }\n try{ readStream.resume(); }catch(error){ Logger.log(error); }\n\n await pipelineWithPromise(contentStream, fs.createWriteStream(finalPath, {flags: 'a', highWaterMark: self.config.writingSpeed, })).catch(error => { Logger.log(error); });\n }else{\n // contentStream is a read stream\n\n try{ contentStream.resume(); }catch(error){ Logger.log(error); }\n try{ readStream.resume(); }catch(error){ Logger.log(error); }\n\n await pipelineWithPromise(contentStream, fs.createWriteStream(finalPath, {flags: 'a', highWaterMark: self.config.writingSpeed, })).catch(error => { Logger.log(error); });\n }\n }\n\n if(isReplacing === true){\n try{\n let doesTempFileExists = await self.doesLocalPathExists(finalPath);\n if(doesTempFileExists){\n await pipelineWithPromise(fs.createReadStream(finalPath, { highWaterMark: self.config.readingSpeed, }), fs.createWriteStream(path, { highWaterMark: self.config.writingSpeed, })).catch(error => { Logger.log(error); });\n await self.deleteLocalFile(finalPath);\n }\n }catch(error){ Logger.log(error); return false; }\n }\n\n return true;\n }catch(error){ Logger.log(error); }\n return false;\n }", "static create() {\n\t\tlet name, muts, tag, attr\n\n\t\tcl(`Creating new atom. \"Ctrl+c\" to exit`.gray);\n\n\t\trl.question(`Name » `.green, atomName => {\n\t\t\tname = atomName;\n\n\t\t\trl.question(`Mutates » `.green, atomMutate => {\n\t\t\t\tmuts = atomMutate.split(' ');\n\n\t\t\t\trl.question(`Tag » `.green, atomTag => {\n\t\t\t\t\ttag = atomTag;\n\n\t\t\t\t\trl.question(`Attributes » `.green, atomAttr => {\n\t\t\t\t\t\tattr = atomAttr.split(' ');\n\n\t\t\t\t\t\tvar atom = new Atom(name, muts, tag, attr);\n\n\t\t\t\t\t\tAtom.save(atom);\n\t\t\t\t\t\trl.close();\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}", "function MyFile(name, size, ed2k){\n\tthis.find_crc = function(text){\n\t\tvar regx = /[\\[\\(]([a-f0-9]{8})[\\]\\)]/i;\n\t\tif(regx.test(text)) return (RegExp.$1).toLowerCase();\n\t\telse return('');\n\t}\n\tthis.find_version = function(text){\n\t\tvar regx = /(\\d)v(\\d)/;\n\t\tif(regx.test(text)) return (RegExp.$2)*1\n\t\telse return(1);\n\t}\n\tthis.find_filetype = function(text){\n\t\tvar regx = /\\.([a-z0-9]{2,5})$/i;\n\t\tif(regx.test(text)) return RegExp.$1.toLowerCase();\n\t}\n\tthis.find_group = function(text){\n\t\tvar regx = /(\\[|\\{)(.+?)(\\]|\\})(\\[|\\(|\\.|_).+$/i;\n\t\tif(regx.test(text)) return (RegExp.$2)\n\t\telse return('');\n\t}\n\tthis.crc = this.find_crc(name);\n\tthis.version = this.find_version(name);\n\tthis.filetype = this.find_filetype(name);\n\tthis.group = this.find_group(name);\n\tthis.size = size;\n}", "static create() {\n\t\tlet name, muts, atoms;\n\n\t\tcl(`Creating new molecule. \"Ctrl+c\" to exit`.gray);\n\n\t\trl.question(`Name » \\n`.green, molName => {\n\t\t\tname = molName;\n\n\t\t\trl.question(`Mutates (space separated)» \\n`.green, molMutate => {\n\t\t\t\tmuts = molMutate.split(' ');\n\n\t\t\t\trl.question(`Atoms » \\n`.green + `predefined:`.white + `${getAtomsList(MAINFILE)}\\n`.gray, molAtoms => {\n\t\t\t\t\tatoms = molAtoms.split(' ');\n\n\t\t\t\t\tvar molecule = new Molecule(name, muts, atoms);\n\n\t\t\t\t\tMolecule.save(molecule);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t}", "createFile() {\n const numberOfRepo = 30;\n const numberOfFollower = 3000;\n\n this.findHireableUsers(numberOfRepo, numberOfFollower, (hireableUsers) => {\n const content = {\n info: {\n followers: numberOfFollower,\n repo: numberOfRepo,\n },\n values: hireableUsers,\n };\n const wstream = fs.createWriteStream('hireableUsers.json');\n wstream.write(JSON.stringify(content, null, 2));\n wstream.end();\n\n const s = new Storage(this.credentials.username, this.credentials.token, 'aliens_client');\n s.publish('docs/data/hireableUsers.json', JSON.stringify(content, null, 2), 'new version of the file');\n });\n }", "static Create(opts, cb) {\n cb(null, new EmscriptenFileSystem(opts.FS));\n }", "function createNewFile() {\n winList.push(createWindow());\n}", "function writeFile(FPath, info, docName) {\n if ( $.os.search(/windows/i) !== -1 ) { // Detect line feed type\n fileLineFeed = \"Windows\";\n }\n else {\n fileLineFeed = \"Macintosh\";\n } \n try {\n var f = new File(FPath + \"/\" + docName + \".txt\");\n f.remove();\n f.open('a');\n f.lineFeed = fileLineFeed;\n f.write(info);\n f.close();\n }\n catch(e){}\n} //end function", "function File(contents, /*optional:*/ parent, name) {\n var file = this;\n\n // Link to the parent file.\n file.p = parent = parent || null;\n\n // The module object for this File, which will eventually boast an\n // .exports property when/if the file is evaluated.\n file.m = {\n // If this file was created with `name`, join it with `parent.m.id`\n // to generate a module identifier.\n id: name ? (parent && parent.m.id || \"\") + \"/\" + name : null\n };\n\n // Queue for tracking required modules with unmet dependencies,\n // inherited from the `parent`.\n file.q = parent && parent.q;\n\n // Each directory has its own bound version of the `require` function\n // that can resolve relative identifiers. Non-directory Files inherit\n // the require function of their parent directories, so we don't have\n // to create a new require function every time we evaluate a module.\n file.r = isObject(contents)\n ? makeRequire(file)\n : parent && parent.r;\n\n // Set the initial value of `file.c` (the \"contents\" of the File).\n fileMergeContents(file, contents);\n\n // When the file is a directory, `file.ready` is an object mapping\n // module identifiers to boolean ready statuses. This information can\n // be shared by all files in the directory, because module resolution\n // always has the same results for all files in a given directory.\n file.ready = fileIsDirectory(file) && {};\n }", "function _createLogFile(typeString) {\n var logFileDir = new Folder(_getDirString());\n if (!logFileDir.exists) {\n logFileDir.create();\n }\n\n var logFileName = typeString + \"_\" + _getDateString().replace(/[:]/g,'-')+ \".log\";\n var logFilePath = _getDirString() + logFileName;\n return new File(logFilePath);\n }", "function makeFile(exportBook){\n xlsx.writeFile(exportBook, __dirname + '/scouting.xlsx');\n}", "static new(callback) {\r\n FileWriterRemote.fileWriter.new(callback);\r\n }", "init() {\n fs.exists(this.filename, (exists) => {\n if (exists) {\n return;\n }\n // fs.appendFile('./url.csv', 'name,size,url\\n', 'utf8', (err) => {\n fs.appendFile('./url.csv', '', 'utf8', (err) => {\n if (err) throw err;\n logger.info('url.csv does not exist,create url.csv success!');\n });\n\n });\n return this;\n }", "createFile(dirname, filename, content, cb) {\n var mkdirp = require('mkdirp');\n //var asq = require(\"async\");\n\n mkdirp(dirname, function(err) {\n if (err) {\n console.error(\"err: \", err);\n if (typeof cb == 'function') {\n return cb(err);\n }\n } else {\n fs.writeFile(dirname + '/' + filename, content, function(err) {\n if (typeof cb == 'function') {\n return cb(err);\n }\n });\n }\n });\n }", "static txt ({ filepath, newFilepath, fileInfo }) {\n const info = '\\n\\nFile Info:\\n' +\n Object.keys(fileInfo)\n .map(k => `${k}: ${fileInfo[k]}`)\n .join('\\n')\n\n return fs.readFile(filepath)\n .then(file => fs.writeFile(newFilepath, file + info))\n }", "function File(stream) {\n this.stream = stream;\n this.closed = false;\n}", "async function makeFilePair(out, name, info) {\n const { comment, upstream, config } = info\n\n // Make normal version:\n out[`${name}.js`] = makeFile({\n comment: `${comment} for Standard.js`,\n upstream,\n config\n })\n\n // Make `lint` version:\n out[`lint/${name}.js`] = makeFile({\n comment: `${comment} for Standard.js (without style rules)`,\n upstream,\n config: filterStyleRules(config)\n })\n\n // Make `prettier` version:\n out[`prettier/${name}.js`] = makeFile({\n comment: `${comment} for Standard.js + Prettier`,\n upstream,\n config: filterStyleRules(config)\n })\n}", "createModelFile() {\n // check if the `users.js` file exists already\n if (!fs.existsSync(`${this.model}/users.js`)) {\n const file = path.join(__dirname, '../files/users.js')\n\n fs.readFile(file, \"utf-8\", (err, data) => {\n if (err) {\n console.log(err);\n return;\n }\n\n // write `userrs.js` file\n fs.writeFile(`${this.model}/users.js`, data, (err) => {\n if (err) {\n console.log('Error creating users.js file');\n return;\n }\n\n console.log(\"Successfully created users.js\");\n });\n });\n\n return;\n }\n\n console.log(`users.js already exists`);\n }", "function makeJobFile(config) {\n var job = {\"espruino\":{}};\n // assign commandline values\n for (var key in args) {\n switch (key) {\n case 'job': // remove job itself, and others set internally from the results\n case 'espruinoPrefix':\n case 'espruinoPostfix':\n break;\n default: job[key] = args[key]; // otherwise just output each key: value\n }\n // write fields of Espruino.Config passed as config\n for (var k in config) { if (typeof config[k]!=='function') job.espruino[k] = config[k]; };\n }\n // name job file same as code file with json ending or default and save.\n var jobFile = isNextValidJS(args.file) ? args.file.slice(0,args.file.lastIndexOf('.'))+'.json' : \"job.json\";\n\n if (!fs.existsSync(jobFile)) {\n log(\"Creating job file \"+JSON.stringify(jobFile));\n fs.writeFileSync(jobFile,JSON.stringify(job,null,2),{encoding:\"utf8\"});\n } else\n log(\"WARNING: File \"+JSON.stringify(jobFile)+\" already exists - not overwriting.\");\n}", "static fromDataTransferFile (dtFile) {\n return new File(dtFile.name, dtFile.path, dtFile.size,\n dtFile.lastModified, dtFile.lastModifiedDate)\n }", "constructor(formType) {\n this.buf = new Buffer(0);\n // file headder\n this._pushId('RIFF'); // magic\n this._pushUInt32(4); // size\n this._pushId(formType); // file type\n }", "function createFile(path) {\n if(!fs.existsSync(path)){\n log('creating file to :::', path);\n return fs.writeFileSync('./1-json.json', jsonBook);\n } \n else log('The file already exists');\n}", "function OutFile() {\r\n}", "createControllerFile() {\n // check if `auth.js` exists already in the controllers folder\n if (!fs.existsSync(`${this.controller}/auth.js`)) {\n const file = path.join(__dirname, '../files/auth.js');\n\n fs.readFile(file, \"utf-8\", (err, data) => {\n if (err) {\n console.log(err);\n return;\n }\n\n // write `auth.js` file\n fs.writeFile(`${this.controller}/auth.js`, data, (err) => {\n if (err) {\n console.log('Error creating auth.js file');\n return;\n }\n\n console.log(\"Successfully created auth.js\");\n });\n });\n\n return;\n }\n\n console.log(`auth.js already exists`);\n }", "function createConfig(p, c) {\n fs.writeFileSync(p, c, (err) => {\n if (err) {\n print(err);\n }\n print(\"The file was saved!\");\n });\n}", "static initialize(obj, file) {\n obj['file'] = file;\n }", "function File(filename,path){\n\tvar that=this;\n\tthis.filename = filename;\n\tthis.path = path;\n\tthis.created = Date.now();\n\tthis.last_run = null;\n\tthis.run_count = 0;\n\tfs.stat(path, function(err, stat) {\n\t\tif(err) {\n\t\t\tthrow err;\n\t\t}\n\t\tthat.size = stat.size;\n\t});\n\tfs.readFile(this.path, function (err, data) {\n\t\tthis.checksum = File.checksum(data);\n\t}.bind(this));\n}", "function recreateStoriesFile() {\r\n // deletes old file\r\n fs.unlink('stories.txt', function(err) {\r\n if (err) throw err;\r\n console.log('File successfully deleted!');\r\n });\r\n // iterate through hashtable with for each loop\r\n // where for each title (key) in the hashtable, we \r\n // add both the title and story (value) into a new file.\r\n for (let title of stories.keys()) {\r\n let story = stories.get(title);\r\n // the appendFile() method will create a new stories.txt file since the previous one was deleted.\r\n fs.appendFile('stories.txt', '\\n' + title + '\\n' + splitConstant + '\\n' + story + '\\n' + splitConstant, function(err) {\r\n if (err) {\r\n return console.error(err);\r\n }\r\n });\r\n }\r\n\r\n console.log('stories.txt file recreated!');\r\n}", "function getNewFilePath() {\n //choose a name\n var fileName = getCurrentDateTime() + \".txt\";\n \n if (!folderLocation) {\n folderLocation = os.tmpdir();\n folderLocation = path.join(folderLocation, 'vslogcat');\n }\n\n var filePath = path.join(folderLocation, fileName);\n console.log(\"File path is \" + filePath);\n return filePath;\n\n}", "function createFile(path, fileName) {\n if (!isExists(path, fileName)) {\n aqFile.Create(path + fileName); \n }\n}", "function createElementFileFromTemplate(outputPath, context, name) {\n createFileFromTemplate(outputPath, context, figureElementPath(name))\n}", "function createFiles(filename){\n // Date/Time in UTC\n var csvWriter = createCsvWriter({\n path: filename+'.csv',\n header: [\n {id: 'time', title: 'Time UTC (H/M/S)'},\n {id: 'temperature', title: 'Temperature'},\n {id: 'pressure', title: 'Pressure'},\n {id: 'altitude', title: 'Altitude'},\n {id: 'humidity', title: 'Humidity'},\n {id: 'magX', title: 'MagnetometerX'},\n {id: 'magY', title: 'MagnetometerY'},\n {id: 'magZ', title: 'MagnetometerZ'}\n ]\n });\n\n return csvWriter;\n}", "function addFile() {\n document.getElementById(\"chronovisor-converter-container\").appendChild(fileTemplate.cloneNode(true));\n maps.push(null);\n files.push(null);\n data.push(null);\n og_data.push(null);\n }", "createFile(user, repo, branch, path, content, accessToken) {\n debug(`${user}/${repo}: Creating file ${path} on branch ${branch}`)\n const url = API_URL_TEMPLATES.REPO_CONTENT\n .replace('${owner}', user)\n .replace('${repo}', repo) + `${path}`\n const message = `Create ${path}`\n const encodedContent = encode(content)\n return this.fetchPath('PUT', url, {message, branch, content: encodedContent}, accessToken)\n }", "function initEntryFile(){\n\n\tvar entries = [];\n\tfor(var i=0;i<2;i++){\n\t\tentries.push(gener.randomEntry());\n\t}\n\tvar data = { \"entries\": entries, \"tags\": [] };\n\tfs.writeFile('./SampleEntries.js', JSON.stringify(data, null, 2), function(err){ if(err){ console.log(\"Harness initEntryFile encountered err while writing.\");} });\n}", "function createFileWriter(fileEntry, callbackFunction) {\n\tfileEntry.createWriter(callbackFunction, fail);\n}", "function writeFile(fileObj, fileContent, encoding) {\n //var csvContent = 'data:text/csv;charset=utf-8,%EF%BB%BF'\n encoding = encoding || \"UTF-8\";\n var titleRow = [csvQuotes(\"Path\"),csvQuotes(\"Modified\"),csvQuotes(\"Office\"),csvQuotes(\"Project Name\"),csvQuotes(\"Project Number\"),csvQuotes(\"Location\"),csvQuotes(\"Practice Area\"),csvQuotes(\"Construction Type\"),csvQuotes(\"Size\"),csvQuotes(\"Estimated Cost\"),csvQuotes(\"Estimated Completion\"),csvQuotes(\"Sustainability\"),csvQuotes(\"Project Description\"),csvQuotes(\"Team\")];\n if (!fileObj.exists) fileContent2 = titleRow.toString() + \"\\n\" + fileContent;\n else fileContent2 = fileContent;\n \n fileObj = (fileObj instanceof File) ? fileObj : new File(fileObj); \n \n var parentFolder = fileObj.parent;\n if (!parentFolder.exists && !parentFolder.create()) \n throw new Error(\"Cannot create file in path \" + fileObj.fsName); \n \n fileObj.encoding = encoding; \n fileObj.open(\"a\"); \n fileObj.write(fileContent2); \n fileObj.close();\n \n return fileObj; \n}", "function makeTextFile(text) {\r\n var data = new Blob([text], { type: 'text/plain' });\r\n\r\n textFile = window.URL.createObjectURL(data);\r\n\r\n return textFile;\r\n}", "function File(moduleId, parent) {\n var file = this; // Link to the parent file.\n\n file.parent = parent = parent || null; // The module object for this File, which will eventually boast an\n // .exports property when/if the file is evaluated.\n\n file.module = new Module(moduleId);\n filesByModuleId[moduleId] = file; // The .contents of the file can be either (1) an object, if the file\n // represents a directory containing other files; (2) a factory\n // function, if the file represents a module that can be imported; (3)\n // a string, if the file is an alias for another file; or (4) null, if\n // the file's contents are not (yet) available.\n\n file.contents = null; // Set of module identifiers imported by this module. Note that this\n // set is not necessarily complete, so don't rely on it unless you\n // know what you're doing.\n\n file.deps = {};\n }", "function createObject(metadata) {\n\t return request.post(config.base + '/api/1/files/create_object/').set('Authorization', 'Token ' + config.token).send(metadata).then(processResponse);\n\t}", "function writefile(){\n\t\t\tvar txtFile = \"c:/test.txt\";\n\t\t\tvar file = new File([\"\"],txtFile);\n\t\t\tvar str = \"My string of text\";\n\n\t\t\tfile.open(\"w\"); // open file with write access\n\t\t\tfile.writeln(\"First line of text\");\n\t\t\tfile.writeln(\"Second line of text \" + str);\n\t\t\tfile.write(str);\n\t\t\tfile.close();\n\t\t}", "function writeToFile(filetype, data) {\n fs.writeFile(filetype, data, (err) =>\n err ? console.log(err) : console.log('Created your README!')\n )\n}", "constructor(dir, mainFileName) {\n this.dir = DIR + \"/\" + dir;\n this.file = mainFileName;\n }", "function FileHelper()\n{\n}", "get file() {\r\n return new File(this, \"file\");\r\n }", "function writeToFile(fileName, data) {\n\n fs.appendFile(\n fileName, \n generateMarkdown(data) ,\n function(err) {\n if(err) {\n return console.log(err);\n }\n \n console.log(\"Your README file is created successfully!\");\n })\n\n fs.appendFile(\n fileName, \n generateLicense(data) ,\n function(err) {\n if(err) {\n return console.log(err);\n }\n \n console.log(\"Your README file is created successfully!\");\n })\n\n \n\n \n}", "function createFile(params){\n if(checkFormat()){\n var filename = params[0].substr(0,60);\n var fileFound = false;\n var reachedEnd = false;\n var i = \"001\";\n while(!reachedEnd){\n if(sessionStorage.getItem(i)[0] === \"1\"){\n if (filename === sessionStorage.getItem(i).split(\"|\")[1].split(\"~\")[0]){\n fileFound = true;\n reachedEnd = true;\n }\n i = stringFormatAndInc(i);\n }\n else{\n reachedEnd = true;\n }\n }\n if(!fileFound){\n var dirSection = sessionStorage.getItem(MBR).substring(4,7);\n //var newDirSection = stringFormatAndInc(dirSection);\n \n var currentFileSection = sessionStorage.getItem(MBR).substring(8,11);\n //var newFileSection = stringFormatAndInc(currentFileSection);\n\n //regex to replace the amount of characters that filename will take up\n var re = new RegExp(\"^.{\"+filename.length+\"}\")\n var replacedData = sessionStorage.getItem(dirSection).substring(5).replace(re,filename);\n sessionStorage.setItem(currentFileSection,\"1---\"+FILE_DIVIDER+FILE_FILLER);\n sessionStorage.setItem(dirSection,\"1\"+currentFileSection+FILE_DIVIDER+replacedData);\n updateMBR();\n //sessionStorage.setItem(MBR,sessionStorage.getItem(MBR).replace(dirSection,newDirSection).replace(currentFileSection,newFileSection));\n \n \n _StdIn.putText(\"File Created!\");\n _StdIn.advanceLine();\n _OsShell.putPrompt();\n }\n else{\n if(params[3]){//FROM OS\n\n }else{\n _StdIn.putText(\"File Has Already Been Created!\");\n _StdIn.advanceLine();\n _OsShell.putPrompt();\n }\n }\n /*\n var data = params[1];\n var sections = Math.ceil(data.length/60);\n var dataSections = [];\n dataSections = data.match(/.{1,60}/g) || [];\n\n\n while(sections>0){\n if(sections === 1){\n fileSection = sessionStorage.getItem(MBR).substring(8,11);\n newSection = stringFormatAndInc(fileSection);\n sessionStorage.setItem(fileSection,\"1---|\"+data);\n sessionStorage.setItem(MBR,sessionStorage.getItem(MBR).replace(fileSection,newFileSection));\n }\n else{\n fileSection = sessionStorage.getItem(MBR).substring(8,11);\n newFileSection = stringFormatAndInc(fileSection);\n sessionStorage.setItem(fileSection,\"1\"+newFileSection+FILE_DIVIDER+data);\n sessionStorage.setItem(MBR,sessionStorage.getItem(MBR).replace(fileSection,newFileSection));\n }\n sections--;\n }*/\n\n /*for (var i=0; i<MAX_DIR_TRACK_LEN; i++) {\n for (var j=1; j<=MAX_BLOCK_LEN; j++) {\n if(j<=9){\n if(sessionStorage[\"00\"+j].substring(0,1)===\"0\"){\n sessionStorage[\"00\"+j] = \n }\n }\n else{\n if(sessionStorage[\"0\"+j].substring(0,1)===\"0\"){\n sessionStorage[\"0\"+j] = \n }\n }\n }\n }*/\n }\n}", "function createTextFile(fn, txt, server) {\n if (getTextFile(fn, server) !== null) {\n console.log(\"ERROR: createTextFile failed because the specified \" +\n \"server already has a text file with the same fn\");\n return;\n }\n var file = new TextFile(fn, txt);\n server.textFiles.push(file);\n return file;\n}" ]
[ "0.6732228", "0.65486455", "0.6370457", "0.617571", "0.6127362", "0.6070642", "0.6070063", "0.6053265", "0.6018561", "0.5999493", "0.59618163", "0.5958732", "0.59435254", "0.58879983", "0.588575", "0.58559304", "0.58342546", "0.5803781", "0.5784671", "0.577569", "0.57531786", "0.5752282", "0.568954", "0.5670714", "0.5656006", "0.5628678", "0.56192845", "0.5582207", "0.555671", "0.5536693", "0.5531558", "0.55040133", "0.5502389", "0.5480827", "0.5480827", "0.547401", "0.5472288", "0.5441719", "0.5440999", "0.54391104", "0.54338396", "0.5420453", "0.5281937", "0.52789915", "0.5278357", "0.52620125", "0.52435243", "0.5242163", "0.5224305", "0.51988524", "0.5194362", "0.5183164", "0.5168842", "0.5164712", "0.5164125", "0.5158547", "0.51573396", "0.5150557", "0.5148579", "0.51454693", "0.5142701", "0.51412535", "0.51317084", "0.5122753", "0.51149863", "0.51109284", "0.51086986", "0.50760835", "0.5066847", "0.5062436", "0.5043839", "0.5041389", "0.5033694", "0.5031279", "0.50227743", "0.5016986", "0.50143796", "0.50142515", "0.5012252", "0.501091", "0.5009631", "0.5007357", "0.500665", "0.50049865", "0.49923345", "0.4989123", "0.4986237", "0.4981216", "0.49753305", "0.49706724", "0.4961934", "0.4958755", "0.49525902", "0.49500126", "0.4948299", "0.4937616", "0.49364662", "0.4934641", "0.49337378", "0.49323997", "0.49313834" ]
0.0
-1
Get the value of the file.
function toString(encoding) { var value = this.contents || ''; return buffer(value) ? value.toString(encoding) : String(value); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getFile(){\n\n\t\treturn this.file;\n\t}", "Get(filename)\n {\n return \"\";\n }", "getText() {\r\n return this.clone(File, \"$value\", false).get(new TextParser(), { headers: { \"binaryStringResponseBody\": \"true\" } });\r\n }", "get file () {\n return this._file\n }", "function _valuefile(__dirname) {\n return path.join(__dirname, 'value');\n}", "get file() {\r\n return new File(this, \"file\");\r\n }", "get file() {\n return this.args.file;\n }", "function _getDataFromFile(){\n\tvar fileData = _openFIle();\n\treturn fileData;\n}", "get() {\n return this.filePointer.get();\n }", "get() {\n return this.filePointer.get();\n }", "function get(path) {\n return files[toKey(path)];\n }", "function getFileURL() {\n return urlVars['file'];\n}", "read() {\n return fs.readFileSync(this.filepath).toString();\n }", "read(file) {\n return this[FILES][file] || null;\n }", "getContents() {\n return _fs.default.readFileSync(this.filePath, \"utf8\");\n }", "async getFile() {\n return await jsonStorage.getItem(plantPath).then(item => {\n return item;\n\n }).catch(() => {\n return null;\n });\n }", "function valueOf() {\n return this.files\n}", "get value() {}", "get value() {}", "GetPath() {return this.filePath;}", "getBlob() {\r\n return this.clone(File, \"$value\", false).get(new BlobParser(), { headers: { \"binaryStringResponseBody\": \"true\" } });\r\n }", "async function getFile(id) {\n var file = await db.readDataPromise('file', { id: id })\n return file[0];\n}", "getJSON() {\r\n return this.clone(File, \"$value\", false).get(new JSONParser(), { headers: { \"binaryStringResponseBody\": \"true\" } });\r\n }", "getFile(filePath) {\n return this.getFileInfo(filePath)?.file\n }", "function getValue(location){\n if (location === null){\n return null;\n }\n if (location[0] === 'F'){\n var idx = parseInt(location.substring(1));\n return (fpRegFile[idx] || 0);\n }\n if (location[0] === '$'){\n var idx = parseInt(location.substring(1));\n \n var v = (intRegFile[idx] || 0);\n return v;\n }\n if (location[0] === '#'){\n return parseInt(location.substring(1));\n }\n var parsedInput = location.match(/(\\d*)\\(\\$(\\d+)\\)/);\n if (parsedInput){\n index = parseInt(intRegFile[parsedInput[2]]);\n offset = parseInt(parsedInput[1]);\n return (parseInt(dataMem[index+offset]) || 0);\n }\n \n throw new Error(\"Could not obtain a value from \\\"\" + location +\n \"\\\". Check that is is formatted correctly (see README)\");\n}", "getFileName() {\n return this.filename;\n }", "function getValue(location){\n if (location === null){\n return null;\n }\n if (location[0] === 'F'){\n var idx = parseInt(location.substring(1));\n return (fpRegFile[idx] || 0);\n }\n if (location[0] === '$'){\n var idx = parseInt(location.substring(1));\n \n var v = (intRegFile[idx] || 0);\n return v;\n }\n if (location[0] === '#'){\n return parseInt(location.substring(1));\n }\n var parsedInput = location.match(/(\\d*)\\(\\$(\\d)\\)/);\n if (parsedInput){\n index = parseInt(intRegFile[parsedInput[2]]);\n offset = parseInt(parsedInput[1]);\n return (parseInt(dataMem[index+offset]) || 0);\n }\n \n throw (\"Could not obtain a value from \\\"\" + location +\n \"\\\". Check that is is formatted correctly (see README)\");\n}", "file () {\n try {\n const file = this.currentFile()\n\n if (!file) throw createError({ code: 'ENOENT', message: 'No file selected' })\n return file\n } catch (e) {\n throw new Error(e)\n }\n }", "function _get(key){\n\tvar ret = null;\n\n\n\t// Pull from cache or re-read from fs.\n\t//console.log('key: ' + key)\n\t//console.log('use_zcache_p: ' + use_zcache_p)\n\tif( use_zcache_p ){\n\t ret = zcache[key];\n\t\t// console.log('_get CACHED: ', key, ret.slice(0, 10));\n\t}else{\n\t ret = afs.read_file(path_cache[key]);\n\t\t// console.log('_get FILE: ', key, path_cache[key], ' Length: ', ret.length);\n\t}\n\n\treturn ret;\n }", "read() {\n this.assertNotDisposed();\n return this.val;\n }", "function GetOutputValue(/**string*/ key, /**string*/ defValue)\r\n{\r\n\treturn Global.GetProperty(key, defValue, \"%WORKDIR%\\\\Output.xlsx\");\r\n}", "function GetOutputValue(/**string*/ key, /**string*/ defValue)\r\n{\r\n\treturn Global.GetProperty(key, defValue, \"%WORKDIR%\\\\Output.xlsx\");\r\n}", "function getContents(file) {\n\t// Ensure that the file's name is not null.\n\tif(file === null) {\n\t\tself.fail(\"The File object is null.\");\n\t}\n\tif(! file.exists()) {\n\t\tself.fail(\"The file does not exist: \" + file);\n\t}\n\t\n\tvar fileReader;\n\ttry {\n\t\tfileReader = new FileReader(file);\n\t}\n\tcatch(e) {\n\t\tself.fail(\"Could not open the file: \" + e);\n\t\treturn;\n\t}\n\t\n\treturn new String(FileUtils.readFully(fileReader));\n}", "set file(value) { this._file = value; }", "getBuffer() {\r\n return this.clone(File, \"$value\", false).get(new BufferParser(), { headers: { \"binaryStringResponseBody\": \"true\" } });\r\n }", "get() { // get() es como voy a formatear el valor\n return `http://localhost:8001/files/${this.path}`;\n }", "async getFile() {\n let responseData = 'nothing happend';\n try {\n const fileData = await readFile(this.path);\n responseData = fileData.toString('utf8');\n } catch (e) {\n try {\n const dirData = await readdir(this.path);\n responseData = dirData;\n } catch (err) {\n responseData = `no such file found in ${this.path}`;\n }\n } finally {\n return responseData;\n }\n }", "function getFileContents(filename){\r\n\t\r\n\tvar contents;\r\n\tcontents = fs.readFileSync(filename);\r\n\treturn contents;\r\n}", "function getTextFile(theFilename){\n return new Promise($.async(function (resolve, reject) {\n try {\n $.fs.readFile(theFilename, 'utf8', function (err, theContent) {\n if (err) {\n resolve(\"\")\n } else {\n resolve(theContent);\n }\n });\n }\n catch (error) {\n resolve(\"\")\n }\n \n }));\n}", "value() {\n return this.buffer;\n }", "function ReadFile(path)\n{\n\treturn _fs.readFileSync(path, \"utf8\").toString();\n}", "async getFileInfo() {\n return this.fileInfo;\n }", "static io_getfile(filename, fcn) {\n if (window.Settings.enableLog)\n WebUtils.log(\"Web.io_getfile({0})\".format(filename));\n Database.getfile(filename, fcn);\n }", "function get() {\n // 'touch' file\n fs.openSync(fileName, 'a+', (err, fd) => {\n err ? console.log(err) : fs.close(fd);\n });\n const rawData = fs.readFileSync(fileName).toString();\n return JSON.parse(rawData);\n}", "getFile(filePath, options) {\n console.log('api.getFile: ', filePath);\n return this.sendRequest({\n type: 'loadFile',\n filePath: filePath,\n options: options\n })\n .then(function(fileInfo) {\n return {\n filePath: filePath,\n contents: fileInfo.payload.contents\n }\n })\n .catch(function(errorInfo) {\n return undefined;\n });\n }", "function getSampleFileContent(){\n var output = ''\n\n fs.readFile('Sample.txt', 'utf8', function(err, data){\n if(err){ //if there are any error\n \n output = err;\n //console.log('error block');\n console.log(err);\n }\n else{\n \n output = data;\n console.log('data block');\n console.log(data)\n }\n console.log('File read completed...')\n return output;\n })\n }", "function get_file (file){\n return path.resolve(temp_dir + '/' + file);\n }", "function get(path) {\n return String(xml.get(path))\n}", "function filesisip_getVal(){\n\n var batas = document.getElementById(\"tot_file\");\n var totBatas = batas.options[batas.selectedIndex].value;\n\n return totBatas;\n}", "getFileData(filePath) {\n let data = null;\n const dataFilePath = path.join(path.dirname(this._uri.fsPath), filePath);\n if (fs.existsSync(dataFilePath)) {\n data = fs.readFileSync(dataFilePath, 'utf8');\n }\n else {\n this._logger.logMessage(logger_1.LogLevel.Error, 'getFileData():', `${filePath} doesn't exist`);\n }\n return data;\n }", "getFile(response) {\n return paths.getJSONFile(this.path, response);\n }", "function readFile (fullpath){\n\tvar result=\"\";\n\t$.ajax({\n\t\turl: fullpath,\n\t\tasync: false,\n\t\tdataType: \"text\",\n\t\tsuccess: function (data) {\n\t\t\tresult = data;\n\t\t}\n\t});\n\treturn result;\n}", "function readTextFile(address_of_cell)\r\n{\r\nif(typeof require !== 'undefined') XLSX = require('xlsx');\r\nvar workbook = XLSX.readFile('users.xlsx');\r\nvar first_sheet_name = workbook.SheetNames[0];\r\nvar worksheet = workbook.Sheets[first_sheet_name];\r\nvar desired_cell = worksheet[address_of_cell];\r\nvar desired_value = desired_cell.v;\r\nreturn desired_value;\r\n}", "read() {\n return JSON.parse(\n new File(this.path).read()\n );\n }", "function file(tr) {\r\n\t\tif (!tr) tr = mTbB.find(\"tr.selected:first\");\r\n\t\treturn getPath().contents[$(tr).attr(\"id\")];\r\n\t}", "function read_file(path_to_file){\n var data = fs.readFileSync(path_to_file).toString();\n return data;\n}", "value() {\n return this.buffer.slice(0, this.size);\n }", "async getb6(file) {\n return await (new Response(file)).text();\n }", "get() {\n const value = this.properties[name].get_value();\n return value;\n }", "async ReadAsset(ctx, key) {\n const value = await ctx.stub.getState(key); // get the asset from chaincode state\n if (!value) {\n throw new Error(`The asset ${key} does not exist`);\n }\n return value;\n }", "static async getFile(context, path) {\n const filePath = EncodeUtil_1.EncodeUtil.decodeUrlPart(context.repositoryPath + path_1.sep + path);\n try {\n await util_1.promisify(fs_1.access)(filePath, constants_1.F_OK);\n }\n catch (err) {\n return null;\n }\n const file = await util_1.promisify(fs_1.stat)(filePath);\n // This code blocks vulnerability when \"%20\" folder can be injected into path and file.Exists returns 'true'.\n if (!file.isFile()) {\n return null;\n }\n const davFile = new DavFile(filePath, context, path, file);\n if (await ExtendedAttributesExtension_1.ExtendedAttributesExtension.hasExtendedAttribute(davFile.fullPath, \"SerialNumber\")) {\n davFile.serialNumber = Number(await ExtendedAttributesExtension_1.ExtendedAttributesExtension.getExtendedAttribute(davFile.fullPath, \"SerialNumber\"));\n }\n if (await ExtendedAttributesExtension_1.ExtendedAttributesExtension.hasExtendedAttribute(davFile.fullPath, \"TotalContentLength\")) {\n davFile.totalContentLength = Number(await ExtendedAttributesExtension_1.ExtendedAttributesExtension.getExtendedAttribute(davFile.fullPath, \"TotalContentLength\"));\n }\n return davFile;\n }", "function getConfigValue(file, key) {\r\n try {\r\n var defaultvars = {\r\n maxqueue: 4,\r\n maxarray: 1023,\r\n maxrunning: 3,\r\n toursignup: 200,\r\n tourdq: 180,\r\n subtime: 90,\r\n touractivity: 200,\r\n breaktime: 120,\r\n absbreaktime: 600,\r\n remindertime: 30,\r\n channel: \"Tournaments\",\r\n errchannel: \"Developer's Den\",\r\n tourbotcolour: \"#3DAA68\",\r\n minpercent: 5,\r\n minplayers: 3,\r\n decayrate: 10,\r\n decaytime: 2,\r\n norepeat: 7,\r\n decayglobalrate: 2,\r\n tourbot: \"\\u00B1\"+Config.tourneybot+\": \",\r\n debug: false,\r\n points: true,\r\n winmessages: true\r\n };\r\n var configkeys = sys.getValKeys(configDir+file);\r\n if (configkeys.indexOf(key) == -1) {\r\n sendChanAll(\"No tour config data detected for '\"+key+\"', getting default value\", tourschan);\r\n if (defaultvars.hasOwnProperty(key))\r\n return defaultvars[key];\r\n else\r\n throw \"Couldn't find the key!\";\r\n }\r\n else {\r\n return sys.getVal(configDir+file, key);\r\n }\r\n }\r\n catch (err) {\r\n sendChanAll(\"Error in getting config value '\"+key+\"': \"+err, tourserrchan);\r\n return null;\r\n }\r\n}", "fileString() {\n return this.id + \" \" + this.type + \" \" + this.note + \" \" + this.amount;\n }", "async readFile(fileName) {\n const bytes = await this.idb.get(fileName, this.store);\n return bytes;\n }", "function getFilePath() {\n $('input[type=file]').change(function () {\n var filePath = $('#fileUpload').val();\n });\n}", "function getFile(fileName) {\n return fs.readFileSync(path.resolve(__dirname, fileName), \"utf-8\");\n}", "function getFile (file) {\n fakeAjax(file, function (text) {\n fileReceived(file, text)\n })\n}", "function getValuesFromFile(fileName, callbackFn) {\n\t\tfileName = fileName || 'data/images.json';\n\t\thttp.get(fileName).success(function (dataObj) {\n\t\t\tif (dataObj instanceof Array) {\n\t\t\t\tif (dataObj.length > 0) {\n\t\t\t\t\tconsole.log(\"FILE RETRIEVED : \", dataObj.length);\n\t\t\t\t\tcallbackFn(dataObj);\n\t\t\t\t}\n\t\t\t}\n\t\t}).error(function (err) {\n\t\t\tconsole.log(\"ERROR >> \", err);\n\t\t});\n\t}", "function get() {\n return _value;\n }", "async read(filepath) {\n try {\n return await this.reader(filepath, 'utf-8');\n } catch (error) {\n return undefined;\n }\n }", "value() {\n return this.buffer;\n }", "value() {\n return this.buffer;\n }", "value() {\n return this.buffer;\n }", "value() {\n return this.buffer;\n }", "readFromFile(fileName) {\n const fs = require(\"fs\");\n try {\n const data = fs.readFileSync(\"uploads/\" + fileName, \"utf8\");\n console.log(data);\n return data;\n } catch (err) {\n console.error(err);\n }\n }", "get fileName() {\n return this._fileName;\n }", "function getGoogleDriveFile() {\n console.log('checking if google drive file exists');\n console.log(\"readin files\");\n access_token = gapi.auth2.getAuthInstance().currentUser.get().getAuthResponse().access_token;\n\n console.log(fileId); //fileId = null;//temporary \n // If fileId is null then call list files to get file id by title\n if (fileId === null) {\n // If fileId is not set then get fileId first\n setFileID().done(function () {\n console.log(\"function returned file id setting\");\n // For first time fileId will be null so no need to read url if file id is null\n if (fileId !== null) {\n getGoogleDriveURL();\n }\n });\n } else {\n // If already fileId is set then get URL\n getGoogleDriveURL();\n }\n }", "GetValue()\n\t{\n\t\treturn this.value;\n\t}", "function readUploadedFile(){\n\tvar uploadedFile = document.getElementById(\"uploadFile\");\n}", "get cahceFile() {\n return Url.join(CACHE_STORAGE, this.#id);\n }", "get(fileID) {\n return this.ready.then(db => {\n const transaction = db.transaction([STORE_NAME], 'readonly');\n const request = transaction.objectStore(STORE_NAME).get(this.key(fileID));\n return waitForRequest(request);\n }).then(result => ({\n id: result.data.fileID,\n data: result.data.data\n }));\n }", "fileCall(path) {\n var fileStream = require('fs');\n var f = fileStream.readFileSync(path, 'utf8');\n return f;\n // var arr= f.split('');\n // return arr;\n }", "function getFile(file) {\n fakeAjax(file, function (text) {\n fileReceived(file, text);\n });\n }", "function GetFileBody(file) {\n\treturn fs.readFileSync(InputDir + file).toString('utf-8');\n}", "getValue() {\n return this.node.value;\n }", "async function getFile(fileId) {\n return await $.ajax({\n url: domain + \"/file/\" + encodeURIComponent(fileId),\n method: \"GET\",\n });\n }", "function get_file(fid) {\n var phpCmd = \"\";\n var response = \"still_no_answer\";\n if ( fid == 'config' ) {\n phpCmd = 'read_config_file';\n }\n else {\n return null;\n }\n var myREQ = new XMLHttpRequest();\n myREQ.open(method=\"GET\", url=\"php/functions.php?command=\" + phpCmd, async=false);\n myREQ.send();\n return (myREQ.responseText);\n}", "function getCurrentAudioFileId()\n{\n return parseInt(currentAudioFile.getAttribute('data-id'));\n}", "_reading(path) {\n\t\tconst readResult = new Promise((resolve, reject) => {\n\t\t\tfs.stat(path, (error, file) => {\n\t\t\t\tresolve(file);\n\t\t\t\treject(error);\n\t\t\t});\n\t\t});\n\t\treturn readResult;\n\t}", "function read_file(name){\n const fs = require('fs');\n if(!fs.existsSync(name))\n return(undefined);\n try {\n const data = fs.readFileSync(name, 'utf8')\n return(data);\n } catch (err) {\n console.error(err);\n return(undefined);\n }\n}", "get filePath() {\n return this.doc.path;\n }", "async function getFileContent(filePath) {\n return (await filePath) ? readFile(filePath) : null;\n}", "_getValue() {\n return this._value;\n }", "function fileContents (filePath, file) {\n return file.contents.toString('utf8');\n}", "readFile(mfs, file) {\n try {\n return mfs.readFileSync(path.join(this.confClient.output.path, file), \"utf-8\")\n } catch (error) {}\n }", "function fileContents(filePath, file) {\n return file.contents.toString('utf8');\n}", "getValue() {\n return this.value;\n }", "function getFile(url){\n var req = request.get(url, function(err, res){\n if (err) throw err;\n console.log('Response ok:', res.ok);\n console.log('Response text:', res.text);\n return res.text;\n });\n}", "getData(){\n return fetch('../status_file.txt')\n .then((response) => {\n // console.log(response);\n return response.text();\n })\n }", "function getValue(params) {\n const { path, key, ipcEvent, options } = { path: './', key: '', ipcEvent: null, options: {}, ...params };\n const db = getOpenedDB(path, ipcEvent);\n if (!db) {\n return;\n }\n db.get(key, options, function(err, value) {\n if (err) {\n if (err.notFound) {\n if (ipcEvent) {\n ipcEvent.returnValue = {\n status: 'failed',\n message: `${key} is not in ${path}`\n };\n }\n return;\n }\n _handleError(err, ipcEvent);\n return;\n }\n\n if (ipcEvent) {\n ipcEvent.returnValue = {\n status: 'success',\n value\n };\n } else {\n console.log(`${path} -> ${key}: ${value}`);\n }\n });\n}", "getValue()\n {\n return this.value;\n }" ]
[ "0.711178", "0.68999565", "0.6691765", "0.66412055", "0.6439003", "0.64349145", "0.6405714", "0.637939", "0.6368529", "0.6368529", "0.6324943", "0.6303016", "0.6242697", "0.60756075", "0.59203756", "0.58928937", "0.58921486", "0.5867203", "0.5867203", "0.5792994", "0.5783152", "0.57761586", "0.5751999", "0.57385087", "0.5694448", "0.5688512", "0.5670347", "0.565412", "0.5556546", "0.5543148", "0.5527035", "0.5527035", "0.5514399", "0.5513336", "0.5492583", "0.54895693", "0.54887235", "0.5488215", "0.54817283", "0.54573584", "0.5454413", "0.54486895", "0.54407805", "0.5436563", "0.54363346", "0.5376923", "0.53757405", "0.5362463", "0.5351611", "0.53488845", "0.53450817", "0.5343603", "0.53318477", "0.53291124", "0.532369", "0.5304099", "0.5298691", "0.5297707", "0.5294776", "0.52915573", "0.52904683", "0.52898616", "0.52828", "0.5281878", "0.5276761", "0.5269233", "0.5265732", "0.525857", "0.5251226", "0.523737", "0.52340025", "0.52340025", "0.52340025", "0.52340025", "0.5232979", "0.52325886", "0.52270925", "0.52226746", "0.5212328", "0.5206766", "0.5191702", "0.51877457", "0.51808065", "0.5180243", "0.5178614", "0.5177167", "0.5176838", "0.5176135", "0.51749384", "0.51746494", "0.5172907", "0.5171608", "0.51705647", "0.51702523", "0.51517063", "0.5144347", "0.5140767", "0.51405805", "0.5138275", "0.5134133", "0.5115784" ]
0.0
-1
Assert that `part` is not a path (i.e., does not contain `path.sep`).
function assertPart(part, name) { if (part.indexOf(path.sep) !== -1) { throw new Error('`' + name + '` cannot be a path: did not expect `' + path.sep + '`'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertPart(part, name) {\n if (part.indexOf(path.sep) !== -1) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + path.sep + '`'\n )\n }\n}", "function assertPart(part, name) {\n if (part.indexOf(path.sep) !== -1) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + path.sep + '`'\n );\n }\n}", "function assertPart(part, name) {\n if (part && part.indexOf(p.sep) > -1) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + p.sep + '`'\n )\n }\n}", "function assertPart(part, name) {\n if (part && part.indexOf(p.sep) > -1) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + p.sep + '`'\n )\n }\n}", "function assertPart(part, name) {\n if (part && part.indexOf(p.sep) > -1) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + p.sep + '`'\n )\n }\n}", "function assertPart$1(part, name) {\n if (part && part.indexOf(p$1.sep) > -1) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + p$1.sep + '`'\n )\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty');\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty');\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty');\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty');\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty');\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty');\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty');\n }\n}", "function assertNonEmpty$1(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}", "function assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));\n }\n}", "function ensureSlash(dep) {\n if (!_.startsWith(dep, '/')) dep = '/' + dep;\n return dep;\n}", "function assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));\n }\n}", "function assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));\n }\n}", "function assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));\n }\n}", "function assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));\n }\n}", "function isValidPath(p) {\n return isString(p) && /^\\/?[^\\/?#]*(\\/[^\\/?#]+)*\\/?(\\?[^#]*)?(#.*)?$/.test(p);\n }", "function assertPath(path) {\n if (typeof path !== \"string\") {\n throw new TypeError(\"Path must be a string. Received \" + JSON.stringify(path));\n }\n }", "function isValidPathStart(base) {\n if (!/^\\//.test(base)) {\n return false;\n }\n if ((base === '/') ||\n (base.length > 1 && base[1] !== '/' && base[1] !== '\\\\')) {\n return true;\n }\n throw new Error('The path start in the url is invalid.');\n}", "function relative(path) {\n const char = path.substr(0, 1);\n return char !== '/' && char !== '@';\n }", "function validateFields(validator, part, path) {\n if (_.has(part, 'fields')) {\n validator(part.fields, _.concat(path, 'fields'));\n }\n }", "function l(e,t){\"\"===e&&(e=\".\"),e=e.replace(/\\/$/,\"\");\n// XXX: It is possible to remove this block, and the tests still pass!\nvar n=o(e);return\"/\"==t.charAt(0)&&n&&\"/\"==n.path?t.slice(1):0===t.indexOf(e+\"/\")?t.substr(e.length+1):t}", "function checkArtifactFilePath(path) {\n if (!path) {\n throw new Error(`Artifact path: ${path}, is incorrectly provided`);\n }\n for (const invalidChar of invalidArtifactFilePathCharacters) {\n if (path.includes(invalidChar)) {\n throw new Error(`Artifact path is not valid: ${path}. Contains character: \"${invalidChar}\". Invalid characters include: ${invalidArtifactFilePathCharacters.toString()}.`);\n }\n }\n}", "function validatePath(relativePath, fileName){\n\n relativePath = unescape(relativePath);\n fileName = unescape(fileName);\n\n var fullPath = relativePath + fileName;\n // Check for .. in relative path\n var pathReg1 = /.*\\.\\..*/;\n // Check that the fileName doesn't contain / or \\\n var pathReg2 = /(.*(\\/|\\\\).*)/;\n // Further validation on the name mostly ensures characters are alphanumeric \n var pathReg3 = /^([a-zA-Z0-9_ .]|-)*$/;\n\n return !(pathReg1.exec(relativePath)\n || pathReg2.exec(fileName)\n || !pathReg3.exec(fileName)\n || pathReg1.exec(fullPath));\n}", "function prepareDebuggerPath(...parts) {\r\n return path.join(...parts)\r\n .replace('\\\\', '\\\\\\\\')\r\n .replace('.', '\\\\.');\r\n}", "function is_path(str) {\n let curr_char\n for (let i = 0; i < str.length; i ++) {\n curr_char = str.charCodeAt(i)\n if (!(curr_char == 95) &&\n !(curr_char > 45 && curr_char < 58) &&\n !(curr_char > 64 && curr_char < 91) &&\n !(curr_char > 96 && curr_char < 123)) {\n return false\n }\n }\n return true\n}", "function assertWellFormedAlbumPath(albumPath) {\n\tif (!albumPath.match(/^\\/(\\d\\d\\d\\d\\/(\\d\\d-\\d\\d\\/)?)?$/)) {\n\t\tthrow new BadRequestException(\"Malformed album path: '\" + albumPath + \"'\");\n\t}\n}", "function assertWellFormedAlbumPath(albumPath) {\n\tif (!albumPath.match(/^\\/(\\d\\d\\d\\d\\/(\\d\\d-\\d\\d\\/)?)?$/)) {\n\t\tthrow new BadRequestException(\"Malformed album path: '\" + albumPath + \"'\");\n\t}\n}", "function ensureTrailingDirectorySeparator(path) {\n if (path.charAt(path.length - 1) !== ts.directorySeparator) {\n return path + ts.directorySeparator;\n }\n return path;\n }", "function fromDotSeparatedString(path) {\n var found = path.search(RESERVED);\n if (found >= 0) {\n throw new __WEBPACK_IMPORTED_MODULE_1__util_error__[\"a\" /* FirestoreError */](__WEBPACK_IMPORTED_MODULE_1__util_error__[\"b\" /* Code */].INVALID_ARGUMENT, \"Invalid field path (\" + path + \"). Paths must not contain \" +\n \"'~', '*', '/', '[', or ']'\");\n }\n try {\n return new (FieldPath.bind.apply(FieldPath, [void 0].concat(path.split('.'))))();\n }\n catch (e) {\n throw new __WEBPACK_IMPORTED_MODULE_1__util_error__[\"a\" /* FirestoreError */](__WEBPACK_IMPORTED_MODULE_1__util_error__[\"b\" /* Code */].INVALID_ARGUMENT, \"Invalid field path (\" + path + \"). Paths must not be empty, \" +\n \"begin with '.', end with '.', or contain '..'\");\n }\n}", "function fromDotSeparatedString(path) {\n var found = path.search(RESERVED);\n if (found >= 0) {\n throw new __WEBPACK_IMPORTED_MODULE_1__util_error__[\"a\" /* FirestoreError */](__WEBPACK_IMPORTED_MODULE_1__util_error__[\"b\" /* Code */].INVALID_ARGUMENT, \"Invalid field path (\" + path + \"). Paths must not contain \" +\n \"'~', '*', '/', '[', or ']'\");\n }\n try {\n return new (FieldPath.bind.apply(FieldPath, [void 0].concat(path.split('.'))))();\n }\n catch (e) {\n throw new __WEBPACK_IMPORTED_MODULE_1__util_error__[\"a\" /* FirestoreError */](__WEBPACK_IMPORTED_MODULE_1__util_error__[\"b\" /* Code */].INVALID_ARGUMENT, \"Invalid field path (\" + path + \"). Paths must not be empty, \" +\n \"begin with '.', end with '.', or contain '..'\");\n }\n}", "function fromDotSeparatedString(path) {\n var found = path.search(RESERVED);\n if (found >= 0) {\n throw new __WEBPACK_IMPORTED_MODULE_1__util_error__[\"b\" /* FirestoreError */](__WEBPACK_IMPORTED_MODULE_1__util_error__[\"a\" /* Code */].INVALID_ARGUMENT, \"Invalid field path (\" + path + \"). Paths must not contain \" +\n \"'~', '*', '/', '[', or ']'\");\n }\n try {\n return new (FieldPath.bind.apply(FieldPath, [void 0].concat(path.split('.'))))();\n }\n catch (e) {\n throw new __WEBPACK_IMPORTED_MODULE_1__util_error__[\"b\" /* FirestoreError */](__WEBPACK_IMPORTED_MODULE_1__util_error__[\"a\" /* Code */].INVALID_ARGUMENT, \"Invalid field path (\" + path + \"). Paths must not be empty, \" +\n \"begin with '.', end with '.', or contain '..'\");\n }\n}", "function check_path(path) {\n if (escape_paths.length > 0) {\n for (let i = 0; i < escape_paths.length; i++) {\n if (path.includes(escape_paths[i])) {\n return true;\n }\n }\n return false;\n }\n return true;\n}", "function check_path(path) {\n if (escape_paths.length > 0) {\n for (let i = 0; i < escape_paths.length; i++) {\n if (path.includes(escape_paths[i])) {\n return true;\n }\n }\n return false;\n }\n return true;\n}", "function splitPath(p) {\n return p ? p.split(path.delimiter) : [];\n}", "function splitPath(p) {\n return p ? p.split(path.delimiter) : [];\n}", "function splitPath(p) {\n return p ? p.split(path.delimiter) : [];\n}", "function isRooted(p) {\n p = normalizeSeparators(p);\n if (!p) {\n throw new Error('isRooted() parameter \"p\" cannot be empty');\n }\n if (exports.IS_WINDOWS) {\n return (p.startsWith('\\\\') || /^[A-Z]:/i.test(p) // e.g. \\ or \\hello or \\\\hello\n ); // e.g. C: or C:\\hello\n }\n return p.startsWith('/');\n}", "function isRooted(p) {\n p = normalizeSeparators(p);\n if (!p) {\n throw new Error('isRooted() parameter \"p\" cannot be empty');\n }\n if (exports.IS_WINDOWS) {\n return (p.startsWith('\\\\') || /^[A-Z]:/i.test(p) // e.g. \\ or \\hello or \\\\hello\n ); // e.g. C: or C:\\hello\n }\n return p.startsWith('/');\n}", "function isRooted(p) {\n p = normalizeSeparators(p);\n if (!p) {\n throw new Error('isRooted() parameter \"p\" cannot be empty');\n }\n if (exports.IS_WINDOWS) {\n return (p.startsWith('\\\\') || /^[A-Z]:/i.test(p) // e.g. \\ or \\hello or \\\\hello\n ); // e.g. C: or C:\\hello\n }\n return p.startsWith('/');\n}", "function isRooted(p) {\n p = normalizeSeparators(p);\n if (!p) {\n throw new Error('isRooted() parameter \"p\" cannot be empty');\n }\n if (exports.IS_WINDOWS) {\n return (p.startsWith('\\\\') || /^[A-Z]:/i.test(p) // e.g. \\ or \\hello or \\\\hello\n ); // e.g. C: or C:\\hello\n }\n return p.startsWith('/');\n}", "function isRooted(p) {\n p = normalizeSeparators(p);\n if (!p) {\n throw new Error('isRooted() parameter \"p\" cannot be empty');\n }\n if (exports.IS_WINDOWS) {\n return (p.startsWith('\\\\') || /^[A-Z]:/i.test(p) // e.g. \\ or \\hello or \\\\hello\n ); // e.g. C: or C:\\hello\n }\n return p.startsWith('/');\n}", "function isRooted(p) {\n p = normalizeSeparators(p);\n if (!p) {\n throw new Error('isRooted() parameter \"p\" cannot be empty');\n }\n if (exports.IS_WINDOWS) {\n return (p.startsWith('\\\\') || /^[A-Z]:/i.test(p) // e.g. \\ or \\hello or \\\\hello\n ); // e.g. C: or C:\\hello\n }\n return p.startsWith('/');\n}", "function isRooted(p) {\n p = normalizeSeparators(p);\n if (!p) {\n throw new Error('isRooted() parameter \"p\" cannot be empty');\n }\n if (exports.IS_WINDOWS) {\n return (p.startsWith('\\\\') || /^[A-Z]:/i.test(p) // e.g. \\ or \\hello or \\\\hello\n ); // e.g. C: or C:\\hello\n }\n return p.startsWith('/');\n}", "function isRooted(p) {\n p = normalizeSeparators(p);\n if (!p) {\n throw new Error('isRooted() parameter \"p\" cannot be empty');\n }\n if (exports.IS_WINDOWS) {\n return (p.startsWith('\\\\') || /^[A-Z]:/i.test(p) // e.g. \\ or \\hello or \\\\hello\n ); // e.g. C: or C:\\hello\n }\n return p.startsWith('/');\n}", "function isRooted(p) {\n p = normalizeSeparators(p);\n if (!p) {\n throw new Error('isRooted() parameter \"p\" cannot be empty');\n }\n if (exports.IS_WINDOWS) {\n return (p.startsWith('\\\\') || /^[A-Z]:/i.test(p) // e.g. \\ or \\hello or \\\\hello\n ); // e.g. C: or C:\\hello\n }\n return p.startsWith('/');\n}", "function isRooted(p) {\n p = normalizeSeparators(p);\n if (!p) {\n throw new Error('isRooted() parameter \"p\" cannot be empty');\n }\n if (exports.IS_WINDOWS) {\n return (p.startsWith('\\\\') || /^[A-Z]:/i.test(p) // e.g. \\ or \\hello or \\\\hello\n ); // e.g. C: or C:\\hello\n }\n return p.startsWith('/');\n}", "function isRooted(p) {\n p = normalizeSeparators(p);\n if (!p) {\n throw new Error('isRooted() parameter \"p\" cannot be empty');\n }\n if (exports.IS_WINDOWS) {\n return (p.startsWith('\\\\') || /^[A-Z]:/i.test(p) // e.g. \\ or \\hello or \\\\hello\n ); // e.g. C: or C:\\hello\n }\n return p.startsWith('/');\n}", "function isFolder(path) {\n return path.substr(-1) === '/';\n }", "function endOfPath(input) {\n var lastSlash = input.lastIndexOf('/');\n if (lastSlash === -1 || lastSlash === input.length - 1) {\n // try to find the index using windows-style filesystem separators\n lastSlash = input.lastIndexOf('\\\\');\n if (lastSlash === -1 || lastSlash === input.length - 1) {\n return input;\n }\n }\n return input.substring(lastSlash + 1);\n}", "checkPath(expectedPath, path) {\n\t\tif (Array.isArray(expectedPath)) {\n\t\t\texpectedPath.forEach((chunk) => this.checkPath(chunk, path));\n\t\t} else {\n\t\t\tpath.should.contain(expectedPath);\n\t\t}\n\t}", "function partNode(node){\n if (node.isPart && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {\n node.currentText = node.firstChild.nodeValue;\n return !/[\\n\\t\\r]/.test(node.currentText);\n }\n return false;\n }", "function isEmptyString(val) {\n return String(val) === '' || String(val) === './';\n}", "function isEmptyString(val) {\n return String(val) === '' || String(val) === './';\n}", "function isEmptyString(val) {\n return String(val) === '' || String(val) === './';\n}", "function isEmptyString(val) {\n return String(val) === '' || String(val) === './';\n}", "function checkPathInDeployOption(path) {\n if (path[path.length - 1] === '/') {\n logger.error('Error: option deploy does not support directories: ' + path);\n process.exit(1);\n }\n}", "function safeTrimTrailingSeparator(p) {\n // Short-circuit if empty\n if (!p) {\n return '';\n }\n // Normalize separators\n p = normalizeSeparators(p);\n // No trailing slash\n if (!p.endsWith(path.sep)) {\n return p;\n }\n // Check '/' on Linux/macOS and '\\' on Windows\n if (p === path.sep) {\n return p;\n }\n // On Windows check if drive root. E.g. C:\\\n if (IS_WINDOWS && /^[A-Z]:\\\\$/i.test(p)) {\n return p;\n }\n // Otherwise trim trailing slash\n return p.substr(0, p.length - 1);\n}", "function safeTrimTrailingSeparator(p) {\n // Short-circuit if empty\n if (!p) {\n return '';\n }\n // Normalize separators\n p = normalizeSeparators(p);\n // No trailing slash\n if (!p.endsWith(path.sep)) {\n return p;\n }\n // Check '/' on Linux/macOS and '\\' on Windows\n if (p === path.sep) {\n return p;\n }\n // On Windows check if drive root. E.g. C:\\\n if (IS_WINDOWS && /^[A-Z]:\\\\$/i.test(p)) {\n return p;\n }\n // Otherwise trim trailing slash\n return p.substr(0, p.length - 1);\n}", "function safeTrimTrailingSeparator(p) {\n // Short-circuit if empty\n if (!p) {\n return '';\n }\n // Normalize separators\n p = normalizeSeparators(p);\n // No trailing slash\n if (!p.endsWith(path.sep)) {\n return p;\n }\n // Check '/' on Linux/macOS and '\\' on Windows\n if (p === path.sep) {\n return p;\n }\n // On Windows check if drive root. E.g. C:\\\n if (IS_WINDOWS && /^[A-Z]:\\\\$/i.test(p)) {\n return p;\n }\n // Otherwise trim trailing slash\n return p.substr(0, p.length - 1);\n}", "function safeTrimTrailingSeparator(p) {\n // Short-circuit if empty\n if (!p) {\n return '';\n }\n // Normalize separators\n p = normalizeSeparators(p);\n // No trailing slash\n if (!p.endsWith(path.sep)) {\n return p;\n }\n // Check '/' on Linux/macOS and '\\' on Windows\n if (p === path.sep) {\n return p;\n }\n // On Windows check if drive root. E.g. C:\\\n if (IS_WINDOWS && /^[A-Z]:\\\\$/i.test(p)) {\n return p;\n }\n // Otherwise trim trailing slash\n return p.substr(0, p.length - 1);\n}", "function safeTrimTrailingSeparator(p) {\n // Short-circuit if empty\n if (!p) {\n return '';\n }\n // Normalize separators\n p = normalizeSeparators(p);\n // No trailing slash\n if (!p.endsWith(path.sep)) {\n return p;\n }\n // Check '/' on Linux/macOS and '\\' on Windows\n if (p === path.sep) {\n return p;\n }\n // On Windows check if drive root. E.g. C:\\\n if (IS_WINDOWS && /^[A-Z]:\\\\$/i.test(p)) {\n return p;\n }\n // Otherwise trim trailing slash\n return p.substr(0, p.length - 1);\n}", "function safeTrimTrailingSeparator(p) {\n // Short-circuit if empty\n if (!p) {\n return '';\n }\n // Normalize separators\n p = normalizeSeparators(p);\n // No trailing slash\n if (!p.endsWith(path.sep)) {\n return p;\n }\n // Check '/' on Linux/macOS and '\\' on Windows\n if (p === path.sep) {\n return p;\n }\n // On Windows check if drive root. E.g. C:\\\n if (IS_WINDOWS && /^[A-Z]:\\\\$/i.test(p)) {\n return p;\n }\n // Otherwise trim trailing slash\n return p.substr(0, p.length - 1);\n}", "function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}", "function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}", "function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}", "function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}", "function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}", "function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}", "function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}", "function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}", "function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}", "function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}", "function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}", "function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}", "function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}", "function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}", "function formatSubPath (path: string): boolean | string {\n const trimmed: string = path.trim()\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}", "check(decl) {\n let value = decl.value\n return !value.includes('/') && !value.includes('span')\n }", "function s(e,t){\"\"===e&&(e=\".\"),e=e.replace(/\\/$/,\"\");// XXX: It is possible to remove this block, and the tests still pass!\nvar n=r(e);return\"/\"==t.charAt(0)&&n&&\"/\"==n.path?t.slice(1):0===t.indexOf(e+\"/\")?t.substr(e.length+1):t}", "function getRoot(path, sep) {\n if (sep === void 0) { sep = '/'; }\n if (!path) {\n return '';\n }\n var len = path.length;\n var code = path.charCodeAt(0);\n if (code === 47 /* Slash */ || code === 92 /* Backslash */) {\n code = path.charCodeAt(1);\n if (code === 47 /* Slash */ || code === 92 /* Backslash */) {\n // UNC candidate \\\\localhost\\shares\\ddd\n // ^^^^^^^^^^^^^^^^^^^\n code = path.charCodeAt(2);\n if (code !== 47 /* Slash */ && code !== 92 /* Backslash */) {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n var pos_1 = 3;\n var start = pos_1;\n for (; pos_1 < len; pos_1++) {\n code = path.charCodeAt(pos_1);\n if (code === 47 /* Slash */ || code === 92 /* Backslash */) {\n break;\n }\n }\n code = path.charCodeAt(pos_1 + 1);\n if (start !== pos_1 && code !== 47 /* Slash */ && code !== 92 /* Backslash */) {\n pos_1 += 1;\n for (; pos_1 < len; pos_1++) {\n code = path.charCodeAt(pos_1);\n if (code === 47 /* Slash */ || code === 92 /* Backslash */) {\n return path.slice(0, pos_1 + 1) // consume this separator\n .replace(/[\\\\/]/g, sep);\n }\n }\n }\n }\n }\n // /user/far\n // ^\n return sep;\n }\n else if ((code >= 65 /* A */ && code <= 90 /* Z */) || (code >= 97 /* a */ && code <= 122 /* z */)) {\n // check for windows drive letter c:\\ or c:\n if (path.charCodeAt(1) === 58 /* Colon */) {\n code = path.charCodeAt(2);\n if (code === 47 /* Slash */ || code === 92 /* Backslash */) {\n // C:\\fff\n // ^^^\n return path.slice(0, 2) + sep;\n }\n else {\n // C:\n // ^^\n return path.slice(0, 2);\n }\n }\n }\n // check for URI\n // scheme://authority/path\n // ^^^^^^^^^^^^^^^^^^^\n var pos = path.indexOf('://');\n if (pos !== -1) {\n pos += 3; // 3 -> \"://\".length\n for (; pos < len; pos++) {\n code = path.charCodeAt(pos);\n if (code === 47 /* Slash */ || code === 92 /* Backslash */) {\n return path.slice(0, pos + 1); // consume this separator\n }\n }\n }\n return '';\n}", "function getRoot(path, sep) {\n if (sep === void 0) { sep = '/'; }\n if (!path) {\n return '';\n }\n var len = path.length;\n var code = path.charCodeAt(0);\n if (code === 47 /* Slash */ || code === 92 /* Backslash */) {\n code = path.charCodeAt(1);\n if (code === 47 /* Slash */ || code === 92 /* Backslash */) {\n // UNC candidate \\\\localhost\\shares\\ddd\n // ^^^^^^^^^^^^^^^^^^^\n code = path.charCodeAt(2);\n if (code !== 47 /* Slash */ && code !== 92 /* Backslash */) {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n var pos_1 = 3;\n var start = pos_1;\n for (; pos_1 < len; pos_1++) {\n code = path.charCodeAt(pos_1);\n if (code === 47 /* Slash */ || code === 92 /* Backslash */) {\n break;\n }\n }\n code = path.charCodeAt(pos_1 + 1);\n if (start !== pos_1 && code !== 47 /* Slash */ && code !== 92 /* Backslash */) {\n pos_1 += 1;\n for (; pos_1 < len; pos_1++) {\n code = path.charCodeAt(pos_1);\n if (code === 47 /* Slash */ || code === 92 /* Backslash */) {\n return path.slice(0, pos_1 + 1) // consume this separator\n .replace(/[\\\\/]/g, sep);\n }\n }\n }\n }\n }\n // /user/far\n // ^\n return sep;\n }\n else if ((code >= 65 /* A */ && code <= 90 /* Z */) || (code >= 97 /* a */ && code <= 122 /* z */)) {\n // check for windows drive letter c:\\ or c:\n if (path.charCodeAt(1) === 58 /* Colon */) {\n code = path.charCodeAt(2);\n if (code === 47 /* Slash */ || code === 92 /* Backslash */) {\n // C:\\fff\n // ^^^\n return path.slice(0, 2) + sep;\n }\n else {\n // C:\n // ^^\n return path.slice(0, 2);\n }\n }\n }\n // check for URI\n // scheme://authority/path\n // ^^^^^^^^^^^^^^^^^^^\n var pos = path.indexOf('://');\n if (pos !== -1) {\n pos += 3; // 3 -> \"://\".length\n for (; pos < len; pos++) {\n code = path.charCodeAt(pos);\n if (code === 47 /* Slash */ || code === 92 /* Backslash */) {\n return path.slice(0, pos + 1); // consume this separator\n }\n }\n }\n return '';\n}", "function checkArtifactFilePath(path) {\n if (!path) {\n throw new Error(`Artifact path: ${path}, is incorrectly provided`);\n }\n for (const [invalidCharacterKey, errorMessageForCharacter] of invalidArtifactFilePathCharacters) {\n if (path.includes(invalidCharacterKey)) {\n throw new Error(`Artifact path is not valid: ${path}. Contains the following character: ${errorMessageForCharacter}\n \nInvalid characters include: ${Array.from(invalidArtifactFilePathCharacters.values()).toString()}\n \nThe following characters are not allowed in files that are uploaded due to limitations with certain file systems such as NTFS. To maintain file system agnostic behavior, these characters are intentionally not allowed to prevent potential problems with downloads on different file systems.\n `);\n }\n }\n}", "function checkArtifactFilePath(path) {\n if (!path) {\n throw new Error(`Artifact path: ${path}, is incorrectly provided`);\n }\n for (const [invalidCharacterKey, errorMessageForCharacter] of invalidArtifactFilePathCharacters) {\n if (path.includes(invalidCharacterKey)) {\n throw new Error(`Artifact path is not valid: ${path}. Contains the following character: ${errorMessageForCharacter}\n \nInvalid characters include: ${Array.from(invalidArtifactFilePathCharacters.values()).toString()}\n \nThe following characters are not allowed in files that are uploaded due to limitations with certain file systems such as NTFS. To maintain file system agnostic behavior, these characters are intentionally not allowed to prevent potential problems with downloads on different file systems.\n `);\n }\n }\n}", "function fixPath(path) {\n \n \n if(path.startsWith('\\\\\\\\') === false) {\n \n console.log('Path does not starts with \\\\\\\\. Throw error');\n throw \"Path does not starts with \\\\\\\\\";\n \n } else {\n \n // storing path slash into variable\t \n var result = '\\\\\\\\';\n for(var i = 0; i < path.length; i++) {\n \n // Current character is back slash or not\n if(path.charAt(i) === '\\\\') {\n \n // Is result ends with back slash?\n if(result.endsWith('\\\\') === false) {\n result += '\\\\';\n }\n } else {\n result += path.charAt(i);\n }\n }\n return result;\n \n }\n \n}", "function fromDotSeparatedString(path) {\n var found = path.search(RESERVED);\n if (found >= 0) {\n throw new FirestoreError(Code.INVALID_ARGUMENT, \"Invalid field path (\" + path + \"). Paths must not contain \" +\n \"'~', '*', '/', '[', or ']'\");\n }\n try {\n return new (FieldPath$1.bind.apply(FieldPath$1, [void 0].concat(path.split('.'))))();\n }\n catch (e) {\n throw new FirestoreError(Code.INVALID_ARGUMENT, \"Invalid field path (\" + path + \"). Paths must not be empty, \" +\n \"begin with '.', end with '.', or contain '..'\");\n }\n}", "function fromDotSeparatedString(path) {\n var found = path.search(RESERVED);\n if (found >= 0) {\n throw new FirestoreError(Code.INVALID_ARGUMENT, \"Invalid field path (\" + path + \"). Paths must not contain \" +\n \"'~', '*', '/', '[', or ']'\");\n }\n try {\n return new (FieldPath$1.bind.apply(FieldPath$1, [void 0].concat(path.split('.'))))();\n }\n catch (e) {\n throw new FirestoreError(Code.INVALID_ARGUMENT, \"Invalid field path (\" + path + \"). Paths must not be empty, \" +\n \"begin with '.', end with '.', or contain '..'\");\n }\n}" ]
[ "0.8634517", "0.86085933", "0.85808706", "0.85808706", "0.85808706", "0.83589625", "0.6666308", "0.6666308", "0.6666308", "0.6666308", "0.6664525", "0.6664525", "0.6664525", "0.6664525", "0.6664525", "0.6664525", "0.6664525", "0.6614382", "0.5684847", "0.56838113", "0.5673563", "0.5673563", "0.5673563", "0.5673563", "0.5543794", "0.5527682", "0.5376998", "0.5364822", "0.53228724", "0.52927536", "0.519195", "0.5125214", "0.51087135", "0.51037925", "0.51024306", "0.51024306", "0.5060472", "0.5017193", "0.5017193", "0.50065446", "0.49637014", "0.49637014", "0.49171904", "0.49171904", "0.49171904", "0.49159408", "0.49159408", "0.49159408", "0.49159408", "0.49159408", "0.49159408", "0.49159408", "0.49159408", "0.49159408", "0.49159408", "0.49159408", "0.4905775", "0.48931906", "0.48903355", "0.4864949", "0.4855144", "0.4855144", "0.4855144", "0.4855144", "0.48452857", "0.4838482", "0.4838482", "0.4838482", "0.4838482", "0.4838482", "0.4838482", "0.48307377", "0.48307377", "0.48307377", "0.48307377", "0.48307377", "0.48307377", "0.48307377", "0.48307377", "0.48307377", "0.48307377", "0.48307377", "0.48307377", "0.48307377", "0.48307377", "0.48181543", "0.4816815", "0.48162076", "0.48042268", "0.48042268", "0.47944233", "0.47944233", "0.47848725", "0.4777725", "0.4777725" ]
0.86380607
4
Assert that `part` is not empty.
function assertNonEmpty(part, name) { if (!part) { throw new Error('`' + name + '` cannot be empty'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}", "function assertNonEmpty$1(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}", "function assertPart(part, name) {\n if (part.indexOf(path.sep) !== -1) {\n throw new Error('`' + name + '` cannot be a path: did not expect `' + path.sep + '`');\n }\n}", "function assertPart(part, name) {\n if (part.indexOf(path.sep) !== -1) {\n throw new Error('`' + name + '` cannot be a path: did not expect `' + path.sep + '`');\n }\n}", "function assertPart(part, name) {\n if (part.indexOf(path.sep) !== -1) {\n throw new Error('`' + name + '` cannot be a path: did not expect `' + path.sep + '`');\n }\n}", "function assertPart(part, name) {\n if (part.indexOf(path.sep) !== -1) {\n throw new Error('`' + name + '` cannot be a path: did not expect `' + path.sep + '`');\n }\n}", "function assertPart(part, name) {\n if (part.indexOf(path.sep) !== -1) {\n throw new Error('`' + name + '` cannot be a path: did not expect `' + path.sep + '`');\n }\n}", "function assertPart(part, name) {\n if (part.indexOf(path.sep) !== -1) {\n throw new Error('`' + name + '` cannot be a path: did not expect `' + path.sep + '`');\n }\n}", "function assertPart(part, name) {\n if (part.indexOf(path.sep) !== -1) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + path.sep + '`'\n )\n }\n}", "function assertPart(part, name) {\n if (part.indexOf(path.sep) !== -1) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + path.sep + '`'\n );\n }\n}", "function assertPart$1(part, name) {\n if (part && part.indexOf(p$1.sep) > -1) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + p$1.sep + '`'\n )\n }\n}", "function assertPart(part, name) {\n if (part && part.indexOf(p.sep) > -1) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + p.sep + '`'\n )\n }\n}", "function assertPart(part, name) {\n if (part && part.indexOf(p.sep) > -1) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + p.sep + '`'\n )\n }\n}", "function assertPart(part, name) {\n if (part && part.indexOf(p.sep) > -1) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + p.sep + '`'\n )\n }\n}", "notEmpty (value, msg) {\n assert(!lodash.isEmpty(value), msg || `params must be not empty, but got ${value}`);\n }", "function isBlank (thing) {\n return (!thing || thing.length === 0)\n}", "function isEmpty(param) {\n if (!param || param.length === 0) {\n console.log('isEmpty');\n } else {\n console.log('isNotEmpty');\n }\n}", "function present( thing ) {\n return !blank(thing);\n}", "cannotBeEmpty(){\n\t\treturn this.addTest((obj) => {\n return new Validity(!!obj,\n `${this.name} cannot be empty`);\n });\n\t}", "function checkNewContainer(container, part, nextPart, toDelete) {\n if (container[part] === undefined) {\n if (toDelete) return false;\n if (typeof nextPart === 'number') container[part] = [];else container[part] = {};\n }\n return true;\n}", "isEmpty(editor, element) {\n var {\n children\n } = element;\n var [first] = children;\n return children.length === 0 || children.length === 1 && Text.isText(first) && first.text === '' && !editor.isVoid(element);\n }", "isEmpty(editor, element) {\n var {\n children\n } = element;\n var [first] = children;\n return children.length === 0 || children.length === 1 && Text.isText(first) && first.text === '' && !editor.isVoid(element);\n }", "isEmpty (value, msg) {\n assert(lodash.isEmpty(value), msg || `params must be empty, but got ${value}`);\n }", "function empty () {\n return !line || !line.trim()\n }", "function checkNewContainer(container, part, nextPart, toDelete) {\n if(container[part] === undefined) {\n if(toDelete) return false;\n\n if(typeof nextPart === 'number') container[part] = [];\n else container[part] = {};\n }\n return true;\n}", "function checkNewContainer(container, part, nextPart, toDelete) {\n if(container[part] === undefined) {\n if(toDelete) return false;\n\n if(typeof nextPart === 'number') container[part] = [];\n else container[part] = {};\n }\n return true;\n}", "function expectSomething(thing) {\n expect(thing).toBeDefined();\n expect(thing).not.toBeNull();\n if (typeof thing !== 'undefined'\n && thing !== null\n && typeof thing.length !== 'undefined') {\n expect(thing.length).not.toBe(0);\n }\n }", "function isNotEmpty(parm){\n \treturn !isEmpty(parm);\n }", "function checkNewContainer(container, part, nextPart, toDelete) {\n\t if(container[part] === undefined) {\n\t if(toDelete) return false;\n\t\n\t if(typeof nextPart === 'number') container[part] = [];\n\t else container[part] = {};\n\t }\n\t return true;\n\t}", "function checkNewContainer(container, part, nextPart, toDelete) {\n\t if(container[part] === undefined) {\n\t if(toDelete) return false;\n\t\n\t if(typeof nextPart === 'number') container[part] = [];\n\t else container[part] = {};\n\t }\n\t return true;\n\t}", "function validateParts(parts) {\r\n\t\t\tfor (var i = 0; i < parts.length; ++i) {\r\n\t\t\t\tif (!gl.isPositiveInteger(parts[i])) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}", "function isEmpty(elem)\n {\n /* getting the text */\n var str = elem.value;\n\n /* defining a regular expression for non-empty string */\n var regExp = /.+/;\n return !regExp.test(str);\n }", "function empty(elem){\n return !/\\w/.test(elem.text());\n}", "function segmentIsInvalid(segment) {\n return segment.subWordTextChunks.length === 0;\n }", "function validateParts(parts) {\n\t\tfor (let i = 0; i < parts.length; ++i) {\n\t\t\tif (!isPositiveInteger(parts[i])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "function isEmpty(){console.log(\"ERROR\");return (wordLen === 0)}", "function isBlocksEmpty(stringBlock){\n if (!stringBlock)\n return true;\n else\n return false;\n}", "function partNode(node){\n if (node.isPart && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {\n node.currentText = node.firstChild.nodeValue;\n return !/[\\n\\t\\r]/.test(node.currentText);\n }\n return false;\n }", "function checkElem(elem) {\n return elem && elem.length > 0;\n}", "function checkElem(elem) {\n return elem && elem.length > 0;\n}", "function isEmpty(element) {\n return (element.textContent.trim() && element.childElementCount == 0);\n}", "function isNotEmpty(elem) {\n var x = elem.val();\n return (x != null && x.trim() != '');\n}", "isEmpty() {\n const actualLength = this.getLength();\n this._node.__setLastDiff({\n actual: actualLength.toString(),\n timeout: this._node.getTimeout(),\n });\n return actualLength === 0;\n }", "function checkEmpty(year){\r\n\tvar terms = year.terms;\r\n\r\n\tfor(var i=0; i<terms.length; i++){\r\n\t\tif(terms[i].courses.length != 0){\r\n\t\t\treturn false;\r\n\t\t}\t\t\r\n\t}\t\r\n\treturn true;\r\n}", "function isEmpty() {\n return this.toString().length === 0;\n }", "function validateRequiredAttributes(part, path) {\n _.each(appLib.appModel.metaschema, (val, key) => {\n if (val.required && !_.has(part, key)) {\n errors.push(`Attribute ${path.join('.')} doesn't have required property \"${key}\"`);\n }\n });\n }", "function isFull() {\n for(let i in square) {\n if(square[i] === '') {\n return false;\n }\n }\n return true;\n}", "is_empty()\n\t{\n\t\tconst { value } = this.props\n\t\treturn !value || !value.trim()\n\t}", "empty () { return this.length === 0 }", "function empty(writer, value) {\n return !value || !value.length;\n}", "function containsBlankNode(quad) {\n return quad.subject.termType === \"BlankNode\" || quad.object.termType === \"BlankNode\";\n}", "isEmpty() {\n console.log(this.size === 0);\n }", "function isEmpty(box){\n return !box.hasClass('box-filled-1') && !box.hasClass('box-filled-2');\n }", "function empty(v) {\n return !v || !v.length;\n}", "get empty() { return this.sections.length == 0 || this.sections.length == 2 && this.sections[1] < 0; }", "function FieldIsEmpty(strInput) {\n\treturn TrimString(strInput).length == 0;\n}", "function bs_isEmpty(theVar) {\n\tif (bs_isNull(theVar)) return true;\n\tif (theVar == '') return true;\n\treturn false;\n}", "isEmpty () {\n return (!this || this.length === 0 || !this.trim());\n }", "function checkIfItemIsEmpty(item) {\n if(item.trim().length == 0){\n return true;\n }\n else {\n return false;\n }\n}", "function compoundWriteIsEmpty(compoundWrite) {\n return compoundWrite.writeTree_.isEmpty();\n}", "function compoundWriteIsEmpty(compoundWrite) {\n return compoundWrite.writeTree_.isEmpty();\n}", "function isNotEmpty(array) {\n return (array && array.length > 0)\n }", "function empty(campo){\n\tif(campo === '' || campo === undefined || campo === null || campo === false){\n\t\treturn true;\n\t}\n\t\n\treturn false;\n}", "function validateFields(validator, part, path) {\n if (_.has(part, 'fields')) {\n validator(part.fields, _.concat(path, 'fields'));\n }\n }", "function checkFeed(element) {\n expect(element).toBeDefined(); // Element must be defined...\n expect((element).length).toBeGreaterThan(0); // and have a length greater than 0...\n expect(element).not.toBe(''); // and not be an empty string.\n }", "isEmpty() {\n const text = this.editorState.getCurrentContent().getPlainText();\n return !text || _.trim(text).length === 0;\n }", "empty () {\n return !(this.length >= 1);\n }", "isEmpty (param) {\n if (param == null || param === '') {\n return true\n }\n return false\n }", "function is_field_empty(field) {\n if (field == undefined || field == '')\n return true;\n else\n return false;\n}", "function isNonEmptyString(val) { \r\n\treturn new FunctionalAssertionResult(\r\n\t\tfunction(v) { return v != null && typeof v == \"string\"; },\r\n\t\t[val],\r\n\t\t\"non-null string\"\r\n\t)\r\n}", "function isNotEmpty(field){\n return field.trim() !== ''\n}", "isEmpty() {\n return this.length() < 1;\n }", "function isEmpty(node) {\n\t if (!node.canHaveSubselections()) {\n\t return node.isGenerated() && !node.isRefQueryDependency();\n\t } else {\n\t return node.getChildren().every(isEmpty);\n\t }\n\t}", "function isEmpty(node) {\n\t if (!node.canHaveSubselections()) {\n\t return node.isGenerated() && !node.isRefQueryDependency();\n\t } else {\n\t return node.getChildren().every(isEmpty);\n\t }\n\t}", "function isEmpty(node) {\n\t if (!node.canHaveSubselections()) {\n\t return node.isGenerated() && !node.isRefQueryDependency();\n\t } else {\n\t return node.getChildren().every(isEmpty);\n\t }\n\t}", "function isEmpty(check_me) {\n return (check_me == null || check_me == \"undefined\" || check_me.length == 0);\n }", "isEmpty() {\n return this.storage.length === 0;\n }", "isEmpty() {\n\t\treturn this.#hiddenLevels.length === this.#hiddenSize;\n\t}", "function isBlank( element, index, array) {\n return (element === \"\" || undefined); \n }", "function isEmpty(space) {\n return space === null;\n}", "isEmpty() {\n return this.length() === 0;\n }", "isBagEmpty() {\n return this.bag.length == 0\n }", "function isEmpty( element ) {\n\tif( element.length < 1 ) {\n\t\treturn \"This field is required.\";\n\t}\n\treturn \"\";\n}", "function isFull(){\r\n for (let i = 0; i < gameField.length; i++){\r\n for (let j = 0; j < gameField[i].length; j++){\r\n if (gameField[i][j] === \"\"){\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n}", "isEmpty() {\n return this.size === 0;\n }", "isEmpty() {\n return this.size === 0;\n }", "isEmpty() {\n return this.size === 0;\n }", "isEmpty() {\n return this.size === 0;\n }", "isEmpty() {\n return this.size === 0;\n }", "isAbsent() {\n return this.length == 0;\n }", "isAbsent() {\n return this.length == 0;\n }" ]
[ "0.82078385", "0.82078385", "0.82078385", "0.82078385", "0.8098381", "0.6483384", "0.6483384", "0.6483384", "0.6483384", "0.6483384", "0.6483384", "0.64686406", "0.6467794", "0.64403224", "0.6432958", "0.6432958", "0.6432958", "0.62206465", "0.60916746", "0.5781566", "0.5772665", "0.57141966", "0.5623872", "0.5599044", "0.5599044", "0.5588902", "0.5585391", "0.55461663", "0.55461663", "0.55217975", "0.5436954", "0.5432204", "0.5432204", "0.54168564", "0.53885883", "0.53553194", "0.53518796", "0.532956", "0.5286324", "0.52783406", "0.5278208", "0.52613777", "0.52613777", "0.52507234", "0.52435386", "0.523715", "0.52195567", "0.52071404", "0.5203773", "0.51994413", "0.5187199", "0.51775163", "0.5176141", "0.5176001", "0.51701164", "0.51621157", "0.515569", "0.5151722", "0.513739", "0.5135897", "0.5134274", "0.5130386", "0.5129728", "0.5129728", "0.51261604", "0.51260734", "0.5122347", "0.5121561", "0.51211464", "0.5107584", "0.50926805", "0.50916255", "0.5086695", "0.5082752", "0.5079283", "0.507602", "0.507602", "0.507602", "0.5071612", "0.50679505", "0.5052905", "0.5052124", "0.50443983", "0.5032493", "0.5030479", "0.50291365", "0.5028688", "0.5016109", "0.5016109", "0.5016109", "0.5016109", "0.5016109", "0.50062484", "0.50062484" ]
0.82067513
9
For Node v0.10 support. Remove this eventually.
function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _node_p(){\n\tvar ret = false;\n\tif( anchor.environment() == 'Node.js' ){ ret = true; }\n\treturn ret;\n }", "function node_error(err) {\r\n node.error(err, err);\r\n }", "private public function m246() {}", "function NodeFsHandler() {}", "function NodeFsHandler() {}", "static reset(){\n _NODE_UID = 0;\n }", "static final private internal function m106() {}", "private internal function m248() {}", "function NodeHandler() { }", "function _isNodeInternal (line) {\n return ~line.indexOf('(timers.js:') ||\n ~line.indexOf('(node.js:') ||\n ~line.indexOf('(module.js:') ||\n ~line.indexOf('_stream_readable.js') ||\n ~line.indexOf('process._tickDomainCallback') ||\n ~line.indexOf('GeneratorFunctionPrototype.next (native)') ||\n ~line.indexOf('GeneratorFunctionPrototype.throw (native)') ||\n // co\n ~line.indexOf('/co/index.js') ||\n // koa-router\n ~line.indexOf('Object.dispatch') ||\n // bluebird\n ~line.indexOf('Promise._settlePromise') ||\n ~line.indexOf('Async._drainQueues') ||\n ~line.indexOf('Immediate.Async.drainQueues') ||\n false;\n}", "function Node() {}", "transient private protected internal function m182() {}", "function runIfNewNode( task ) {\n\t\treturn nodeV16OrNewer ? task : \"print_old_node_message:\" + task;\n\t}", "function isNode(){\r\n\treturn typeof module !== 'undefined' && module.exports;\r\n}", "function node_enable() {\n if(typeof process === 'object' && process + '' === '[object process]'){\n return true;\n }\n else{\n return false;\n }\n}", "function RNode() {}", "function RNode() {}", "function RNode() {}", "function noOp(err) { if (err) { throw err; } }", "function isNode() {\n return (typeof module !== 'undefined' && this.module !== module);\n}", "protected internal function m252() {}", "function version(){ return \"0.13.0\" }", "function NodeLogger() {}", "function NodeLogger() {}", "function NodeLogger() {}", "getHostNode() {}", "function NodeLogger() { }", "function NodeLogger() { }", "getNode() {\n throw new Error(\"Must be implemented\");\n }", "transient private internal function m185() {}", "function NodeLogger(){}", "function getBasicNodeMethods(){return['get','post','put','head','delete','options','trace','copy','lock','mkcol','move','purge','propfind','proppatch','unlock','report','mkactivity','checkout','merge','m-search','notify','subscribe','unsubscribe','patch','search','connect'];}", "static final protected internal function m110() {}", "getAllNodes () {\n client.getAllNodes(this.host, 4369, function (err, nodes) {\n if (err) {\n console.error(err)\n return\n }\n console.log(nodes)\n })\n }", "extend(config, ctx) {\n config.node = {\n console: true,\n fs: 'empty',\n net: 'empty',\n tls: 'empty',\n }\n }", "function is_node() {\r\n if (is_node_ === null)\r\n is_node_ = typeof global === \"object\"\r\n && typeof global.process === \"object\"\r\n && typeof global.process.versions === \"object\"\r\n && typeof global.process.versions.node !== \"undefined\";\r\n return is_node_;\r\n}", "function assertNodeEnv() {\r\n return assert(isNode, 'This feature is only available in NodeJS environments');\r\n }", "transient protected internal function m189() {}", "function RNode(){}", "upgrade() {}", "function _detectNodeCrypto(fn) {\n\t return forge.util.isNodejs && typeof _crypto[fn] === 'function';\n\t}", "function TNode() {}", "function TNode() {}", "function TNode() {}", "_handleNodeError(newValue,oldValue){if(typeof oldValue!==typeof void 0&&null!=newValue&&0!=newValue.length){// @todo, need support for a failed to load state; could be useful\n// if we go into an offline capability in the future\nthis._responseList[this.active]=newValue;this.activeNodeResponse=this._responseList[this.active];// set available because we don't have a failed state\nthis.items[this.active].metadata.status=\"available\";this.set(\"items.\"+this.active+\".metadata.status\",\"available\");this.notifyPath(\"items.\"+this.active+\".metadata.status\");// fire an event that this isn't really available so we know an issue occured\nthis.dispatchEvent(new CustomEvent(\"node-load-failed\",{bubbles:!0,cancelable:!0,composed:!0,detail:this.items[this.active]}))}}", "_read () {}", "_read () {}", "_read () {}", "function DWRUtil() { }", "_isValidContext() {\n const isNode = (typeof process !== 'undefined')\n && (typeof process.release !== 'undefined')\n && (process.release.name === 'node');\n return isNode;\n }", "function NWTNode() {\n\t\n}", "function getBasicNodeMethods() {\n return ['get', 'post', 'put', 'head', 'delete', 'options', 'trace', 'copy', 'lock', 'mkcol', 'move', 'purge', 'propfind', 'proppatch', 'unlock', 'report', 'mkactivity', 'checkout', 'merge', 'm-search', 'notify', 'subscribe', 'unsubscribe', 'patch', 'search', 'connect'];\n}", "_read() {}", "_read() {}", "static transient final private protected internal function m40() {}", "function getSystemNodeVers(cb) {\n exec('node -v', function(err, stdout) {\n if (err) {\n return cb(err, null);\n }\n cb(null, stdout.slice(1).replace('\\n',''));\n });\n}", "function r() {}", "function r() {}", "function r() {}", "function Node(){}", "transient private protected public internal function m181() {}", "static isNode(n) {\n return n && typeof n === \"object\" && typeof n.type === \"string\";\n }", "async initialize()\n\t{ \n\t\tthrow new Error(\"initialize() method not implemented\");\n\t}", "static transient final protected public internal function m46() {}", "extend (config, ctx) {\n config.node = {\n fs: 'empty'\n }\n }", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function isNode() {\n return typeof module !== 'undefined' &&\n module.exports &&\n typeof window === 'undefined';\n}", "initiator() {\n throw new Error('Not implemented');\n }", "static runningOnNode ()\n\t\t{ let ud = \"undefined\";\n\n\t\t\tif (typeof process === ud)\n\t\t\t{ return false;\n\t\t\t}\n\t\t\tif (! process )\n\t\t\t{ return false;\n\t\t\t}\n\t\t\tif (! process.versions )\n\t\t\t{ return false;\n\t\t\t}\n\t\t\tif (! process.versions.node )\n\t\t\t{ return false;\n\t\t\t}\n\t\t\tif (typeof __dirname === ud)\n\t\t\t{ return false;\n\t\t\t}\n\t\t\tif (typeof __filename === ud)\n\t\t\t{ return false;\n\t\t\t}\n\t\t\tif (typeof require === ud)\n\t\t\t{ return false;\n\t\t\t}\n\t\t\tif (require === null)\n\t\t\t{ return false;\n\t\t\t}\n\t\t\tif (! require.resolve)\n\t\t\t{ return false;\n\t\t\t}\n\t\t\tif (typeof module === ud)\n\t\t\t{ return false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}", "function node(){}", "async init( callback ) {\n throw \"implement me!\";\n }", "constructor() {\n this.startTime = Date.now();\n this.attributes = {\n \"version\": 0.5, \n \"lang\": \"node.js\",\n \"startTime\": this.startTime\n };\n\n this.inspectedCPU = false;\n this.inspectedMemory = false;\n this.inspectedContainer = false;\n this.inspectedPlatform = false;\n this.inspectedLinux = false;\n }", "function Node() {\n}", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function getLocalNodeVers(cb) {\n var nave_path = process.env.HOME + \"/.nave/installed/\";\n\n fs.readdir(nave_path, cb);\n}", "static get ERROR () { return 0 }", "static transient final private internal function m43() {}", "extend(config, {isDev, isClient}) {\n config.node = {\n fs: 'empty'\n }\n }", "static init() {\n\t\tprocess.on('unhandledRejection', (reason, p) => { throw reason });\n\t}", "static transient final protected internal function m47() {}", "_read() {\n }", "function getBasicNodeMethods() {\n return [\n 'get',\n 'post',\n 'put',\n 'head',\n 'delete',\n 'options',\n 'trace',\n 'copy',\n 'lock',\n 'mkcol',\n 'move',\n 'purge',\n 'propfind',\n 'proppatch',\n 'unlock',\n 'report',\n 'mkactivity',\n 'checkout',\n 'merge',\n 'm-search',\n 'notify',\n 'subscribe',\n 'unsubscribe',\n 'patch',\n 'search',\n 'connect'\n ];\n}", "function getBasicNodeMethods() {\n return [\n 'get',\n 'post',\n 'put',\n 'head',\n 'delete',\n 'options',\n 'trace',\n 'copy',\n 'lock',\n 'mkcol',\n 'move',\n 'purge',\n 'propfind',\n 'proppatch',\n 'unlock',\n 'report',\n 'mkactivity',\n 'checkout',\n 'merge',\n 'm-search',\n 'notify',\n 'subscribe',\n 'unsubscribe',\n 'patch',\n 'search',\n 'connect'\n ];\n}" ]
[ "0.5863474", "0.5705808", "0.568645", "0.55544066", "0.55544066", "0.5446477", "0.5434516", "0.5381192", "0.5356294", "0.53282356", "0.53189546", "0.52043676", "0.51996946", "0.5156968", "0.51501393", "0.51281303", "0.51281303", "0.51281303", "0.5112595", "0.5100047", "0.50906795", "0.5088863", "0.5087259", "0.5087259", "0.5087259", "0.5080389", "0.5072706", "0.5072706", "0.5068706", "0.50571835", "0.50298", "0.50214815", "0.501945", "0.50129956", "0.5000925", "0.4991448", "0.49863955", "0.49858886", "0.49840045", "0.4981576", "0.4970059", "0.4949551", "0.4949551", "0.4949551", "0.4927342", "0.49235627", "0.49235627", "0.49235627", "0.49222878", "0.49209145", "0.4916484", "0.48980445", "0.48758933", "0.48758933", "0.48750284", "0.4857348", "0.48530325", "0.48530325", "0.48530325", "0.4848229", "0.4847861", "0.48425364", "0.48396116", "0.48373815", "0.48351088", "0.48342466", "0.48342466", "0.48342466", "0.48342466", "0.48342466", "0.48342466", "0.48342466", "0.48342466", "0.48342466", "0.48342466", "0.48342466", "0.48342466", "0.48342466", "0.48302492", "0.48184085", "0.48170963", "0.4817076", "0.48170155", "0.48130047", "0.48075417", "0.48001215", "0.48001215", "0.48001215", "0.48001215", "0.48001215", "0.48001215", "0.48001215", "0.47976673", "0.4785643", "0.477728", "0.47741026", "0.47708902", "0.47680405", "0.47660002", "0.47642508", "0.47642508" ]
0.0
-1
Run `fns`. Last argument must be a completion handler.
function run() { var index = -1 var input = slice.call(arguments, 0, -1) var done = arguments[arguments.length - 1] if (typeof done !== 'function') { throw new Error('Expected function as last argument, not ' + done) } next.apply(null, [null].concat(input)) /* Run the next `fn`, if any. */ function next(err) { var fn = fns[++index] var params = slice.call(arguments, 0) var values = params.slice(1) var length = input.length var pos = -1 if (err) { done(err) return } /* Copy non-nully input into values. */ while (++pos < length) { if (values[pos] === null || values[pos] === undefined) { values[pos] = input[pos] } } input = values /* Next or done. */ if (fn) { wrap(fn, next).apply(null, input) } else { done.apply(null, [null].concat(input)) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runAll(whenFn, fns, resolveIdx) {\n //var deferred = when.defer();\n return whenFn(fns)\n .then(\n function(results) {\n return results[resolveIdx];\n },\n function(err) {\n return when.reject(err);\n }\n );\n}", "function run() {\n var index = -1;\n var input = slice$3.call(arguments, 0, -1);\n var done = arguments[arguments.length - 1];\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input));\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index];\n var params = slice$3.call(arguments, 0);\n var values = params.slice(1);\n var length = input.length;\n var pos = -1;\n\n if (err) {\n done(err);\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos];\n }\n }\n\n input = values;\n\n // Next or done.\n if (fn) {\n wrap$2(fn, next).apply(null, input);\n } else {\n done.apply(null, [null].concat(input));\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function executeValidateFns(fns, payload) {\n \n if (fns.length === 1) {\n return fns[0](payload);\n }\n\n const { error, value } = fns.pop()(payload);\n\n if (error) {\n return { error };\n }\n\n return executeValidateFns(fns, value);\n}", "function run(fn) {\n if (fn)\n fn(next);\n else\n callback(null, results);\n }", "function executeFunctions() {\n\t\tvar len = functions.length;\n\n\t\tfunctionsExecuted = true;\n\n\t\tfor ( var x = 0; x < len; x++ ) {\n\t\t\tfunctions[x]();\n\t\t}\n\n\t}", "function invoke(fns, value) {\n return fns.reduce(callWith, value);\n}", "function seq (_fns) {\n var fns = _fns.slice()\n var callCount = 0\n return function () {\n var next = fns.shift()\n callCount++\n if (!next) {\n throw new Error('Received too many calls. Expected ' + _fns.length + ' got ' + callCount)\n }\n return next.apply(this, arguments)\n }\n}", "function multiFunction(options, done) {\n // iterate inputs\n // load input\n // print input as header (after load in case input provides a name)\n // iterate functions\n // thrash next function with input\n // print thrash result with function's name as tail\n // repeat until all functions are used with input\n // repeat until all inputs are used with all functions\n\n try { // catches require() error\n\n // TODO: accept return result to check if we had an error?\n iterateFns(options)\n\n done()\n\n } catch(error) {\n done(error)\n }\n\n}", "function run(...input) {\n var index = -1\n var done = input.pop()\n\n if (typeof done !== 'function') {\n throw new TypeError('Expected function as last argument, not ' + done)\n }\n\n next(null, ...input)\n\n // Run the next `fn`, if any.\n function next(...values) {\n var fn = fns[++index]\n var error = values.shift()\n var pos = -1\n\n if (error) {\n done(error)\n return\n }\n\n // Copy non-nullish input into values.\n while (++pos < input.length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n // Next or done.\n if (fn) {\n wrap(fn, next)(...values)\n } else {\n done(null, ...values)\n }\n }\n }", "runCallbacks(callbacks, args) {\r\n for (let i = 0; i < callbacks.length; i++) {\r\n if (typeof callbacks[i] !== 'function') continue;\r\n callbacks[i].apply(null, args);\r\n }\r\n }", "function call(functions, scope) {\n\n // Allow the passing of an unwrapped function.\n // Leaves other code a more comprehensible.\n if (!$.isArray(functions)) {\n functions = [functions];\n }\n\n $.each(functions, function () {\n if (typeof this === 'function') {\n this.call(scope);\n }\n });\n }", "function next(err, result) {\n if (err)\n return callback(err, results);\n results.push(result);\n if (fns.length)\n run(fns.shift());\n else\n callback(null, results);\n }", "function routine (fn, sets, context) {\n const master = []\n\n if (typeof context === 'undefined') {\n context = fn\n }\n\n for (const args of sets) {\n master.push(fn.apply(context, Array.isArray(args) ? args : [args]))\n }\n\n return Promise.all(master)\n}", "function main(...fns) {return fns.reduce(pipe)}", "static async _runReturnHandlers(handlers) {\n for (const handler of handlers) {\n await new Promise((resolve, reject) => {\n handler((err) => (err ? reject(err) : resolve()));\n });\n }\n }", "function runSomeFunctionsWithCompose(...fns) {\n return fns.reduce(compose)\n}", "function pipe(...fns) {\n const fnArguments = Array(...fns)\n return function(x) {\n let result = null;\n console.log(fns)\n fnArguments.forEach(fn => {\n if(!result) {\n result = fn(x)\n } else {\n result = fn(result)\n }\n console.log(result)\n })\n\n return result\n }\n \n}", "function runHookFunctions (i, hooksList, data, doneAll){\n hooksList[i](data, function afterRunHookFN (err){\n if (err) return doneAll(err);\n // next hook indice\n i++;\n\n if (i < hooksList.length) {\n // run hook if have hooks\n runHookFunctions(i, hooksList, data, doneAll);\n } else {\n // done all\n doneAll();\n }\n });\n}", "function runFuns(funArr){\n for(let el of funArr){\n sep(); \n var label = el[0], f = el[1]; \n console.log('Running ' + label);\n f();\n }\n}", "function testFunctions()\n{\n let _count = 100;\n const _getFn = () =>\n {\n const _n = _count++;\n return (cb) => setTimeout(\n () => cb(null, _n),\n Math.random() * 50\n );\n };\n jfSync(\n [\n _getFn(),\n _getFn(),\n _getFn(),\n _getFn(),\n _getFn()\n ],\n (error, data) => checkData([100, 101, 102, 103, 104])\n );\n}", "function executeDeferChain(fns, args, d, i) {\n var returnObj;\n d = d || $q.defer();\n i = i || 0;\n if (i === 0) {\n fns = _.filter(fns, function (fn) {\n return !(_.isUndefined(fn) || _.isNull(fn));\n });\n }\n if (fns && i < fns.length) {\n try {\n returnObj = fns[i].apply(undefined, args);\n $q.when(returnObj, function () {\n executeDeferChain(fns, args, d, i + 1);\n }, d.reject);\n } catch (e) {\n d.reject(e);\n }\n } else {\n d.resolve();\n }\n return d.promise;\n }", "function doAll(/* args */){\n\t\tvar fn = Array.prototype.shift.call(arguments);\n\t\tif(!arguments.length) {\n\t\t\treturn fn();\n\t\t} else {\n\t\t\tfn();\n\t\t\treturn doAll.apply(null, arguments);\n\t\t}\n\t}", "function functionChain(successValue, failValue, fns) {\n for (var i = 0; i < fns.length; i++) {\n var o = fns[i][0][fns[i][1]].apply(fns[i][0], fns[i][2]);\n if (o === failValue) {\n return o;\n }\n }\n return successValue;\n }", "function runTasks(tasks) {\n debug('run tasks');\n var task; while (task = tasks.shift()) task();\n}", "function runTasks(tasks) {\n debug('run tasks');\n var task; while (task = tasks.shift()) task();\n}", "function pipe(...fns) {\n return arg => fns.reduce((fn1, fn2) => fn2(fn1), arg)\n}", "function runSomeFunctionsWithPipe(...fns) {\n return fns.reduce(pipe)\n}", "function executeFunctionsUntilMatch(functionMaps, keys, arg, context) {\n var e_1, _a, e_2, _b;\n keys = Array.isArray(keys) ? keys : [keys];\n try {\n for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {\n var key = keys_1_1.value;\n var _loop_1 = function (functionMap) {\n var func = functionMap[key];\n if (func == null)\n return \"continue\";\n // Save a \"continue\" flag if necessary\n var shouldContinue = false;\n var result = func(arg, __assign(__assign({}, context), { emitContinue: function () {\n shouldContinue = true;\n } }));\n // Return a result if not undefined\n if (result != null) {\n return { value: { value: result, shouldContinue: shouldContinue } };\n }\n };\n try {\n // Loop through each function\n for (var functionMaps_1 = (e_2 = void 0, __values(functionMaps)), functionMaps_1_1 = functionMaps_1.next(); !functionMaps_1_1.done; functionMaps_1_1 = functionMaps_1.next()) {\n var functionMap = functionMaps_1_1.value;\n var state_1 = _loop_1(functionMap);\n if (typeof state_1 === \"object\")\n return state_1.value;\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (functionMaps_1_1 && !functionMaps_1_1.done && (_b = functionMaps_1.return)) _b.call(functionMaps_1);\n }\n finally { if (e_2) throw e_2.error; }\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return undefined;\n}", "function pipeline(args, callback)\n{\n\tvar funcs, uarg, rv, next;\n\n\tmod_assert.equal(typeof (args), 'object', '\"args\" must be an object');\n\tmod_assert.ok(Array.isArray(args['funcs']),\n\t '\"args.funcs\" must be specified and must be an array');\n\n\tfuncs = args['funcs'].slice(0);\n\tuarg = args['arg'];\n\n\trv = {\n\t 'operations': funcs.map(function (func) {\n\t\treturn ({\n\t\t 'func': func,\n\t\t 'funcname': func.name || '(anon)',\n\t\t 'status': 'waiting'\n\t\t});\n\t }),\n\t 'successes': [],\n\t 'ndone': 0,\n\t 'nerrors': 0\n\t};\n\n\tif (funcs.length === 0) {\n\t\tsetImmediate(function () { callback(null, rv); });\n\t\treturn (rv);\n\t}\n\n\tnext = function (err, result) {\n\t\tif (rv['nerrors'] > 0 ||\n\t\t rv['ndone'] >= rv['operations'].length) {\n\t\t\tthrow new mod_verror.VError('pipeline callback ' +\n\t\t\t 'invoked after the pipeline has already ' +\n\t\t\t 'completed (%j)', rv);\n\t\t}\n\n\t\tvar entry = rv['operations'][rv['ndone']++];\n\n\t\tmod_assert.equal(entry['status'], 'pending');\n\n\t\tentry['status'] = err ? 'fail' : 'ok';\n\t\tentry['err'] = err;\n\t\tentry['result'] = result;\n\n\t\tif (err)\n\t\t\trv['nerrors']++;\n\t\telse\n\t\t\trv['successes'].push(result);\n\n\t\tif (err || rv['ndone'] == funcs.length) {\n\t\t\tcallback(err, rv);\n\t\t} else {\n\t\t\tvar nextent = rv['operations'][rv['ndone']];\n\t\t\tnextent['status'] = 'pending';\n\n\t\t\t/*\n\t\t\t * We invoke the next function on the next tick so that\n\t\t\t * the caller (stage N) need not worry about the case\n\t\t\t * that the next stage (stage N + 1) runs in its own\n\t\t\t * context.\n\t\t\t */\n\t\t\tsetImmediate(function () {\n\t\t\t\tnextent['func'](uarg, next);\n\t\t\t});\n\t\t}\n\t};\n\n\trv['operations'][0]['status'] = 'pending';\n\tfuncs[0](uarg, next);\n\n\treturn (rv);\n}", "async addAll(functions, options) {\n return Promise.all(functions.map(async function_ => this.add(function_, options)));\n }", "function parallel(args, callback)\n{\n\tvar funcs, rv, doneOne, i;\n\n\tmod_assert.equal(typeof (args), 'object', '\"args\" must be an object');\n\tmod_assert.ok(Array.isArray(args['funcs']),\n\t '\"args.funcs\" must be specified and must be an array');\n\tmod_assert.equal(typeof (callback), 'function',\n\t 'callback argument must be specified and must be a function');\n\n\tfuncs = args['funcs'].slice(0);\n\n\trv = {\n\t 'operations': new Array(funcs.length),\n\t 'successes': [],\n\t 'ndone': 0,\n\t 'nerrors': 0\n\t};\n\n\tif (funcs.length === 0) {\n\t\tsetImmediate(function () { callback(null, rv); });\n\t\treturn (rv);\n\t}\n\n\tdoneOne = function (entry) {\n\t\treturn (function (err, result) {\n\t\t\tmod_assert.equal(entry['status'], 'pending');\n\n\t\t\tentry['err'] = err;\n\t\t\tentry['result'] = result;\n\t\t\tentry['status'] = err ? 'fail' : 'ok';\n\n\t\t\tif (err)\n\t\t\t\trv['nerrors']++;\n\t\t\telse\n\t\t\t\trv['successes'].push(result);\n\n\t\t\tif (++rv['ndone'] < funcs.length)\n\t\t\t\treturn;\n\n\t\t\tvar errors = rv['operations'].filter(function (ent) {\n\t\t\t\treturn (ent['status'] == 'fail');\n\t\t\t}).map(function (ent) { return (ent['err']); });\n\n\t\t\tif (errors.length > 0)\n\t\t\t\tcallback(new mod_verror.MultiError(errors), rv);\n\t\t\telse\n\t\t\t\tcallback(null, rv);\n\t\t});\n\t};\n\n\tfor (i = 0; i < funcs.length; i++) {\n\t\trv['operations'][i] = {\n\t\t\t'func': funcs[i],\n\t\t\t'funcname': funcs[i].name || '(anon)',\n\t\t\t'status': 'pending'\n\t\t};\n\n\t\tfuncs[i](doneOne(rv['operations'][i]));\n\t}\n\n\treturn (rv);\n}", "async addAll(functions, options) {\n return Promise.all(functions.map(async (function_) => this.add(function_, options)));\n }", "async addAll(functions, options) {\n return Promise.all(functions.map(async (function_) => this.add(function_, options)));\n }", "async function runHandlers(handlers) {\n try {\n await batchProcess(0, handlers)\n } catch (errs) {\n report('one or more errors occurred in change handlers', handlers, errs)\n }\n}", "function run (fun1) {\n fun1()\n}", "function oneAtATime(fns){\n fns = slice.call(fns);\n var fn = shift.call(fns);\n if(!fn) {\n return;\n }\n return fn().then(function(val){\n return fns.length\n ? oneAtATime(fns)\n : val;\n });\n}", "function run (fun) {\n fun() \n}", "executeFunction(fn, args) { return fn(...args); }", "executeFunction(fn, args) { return fn(...args); }", "function executeTasks() {\n var tasks = Array.prototype.concat.apply([], arguments);\n var task = tasks.shift();\n task(function() {\n if (tasks.length > 0) {\n executeTasks.apply(this, tasks);\n }\n });\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 run(fun){\n fun()\n}", "function run(fun){\n fun()\n}", "function call(fn, args) {\n if (args.length === 2) {\n return fn(args[0], args[1]);\n }\n\n if (args.length === 1) {\n return fn(args[0]);\n }\n\n return fn();\n}", "function _reversefns(fns, args) {\n\t\tif (fns)\n\t\t\t//we group methods together if their parents are the same\n\t\t\t//then we invoke them in the normal order (not reverse), s.t.,\n\t\t\t//child invokes firsd, but also superclass invoked first (first register, first call if same object)\n\t\t\tfor (var j = fns.length, k = j - 1, i, f, oldp, newp; j >= 0;) {\n\t\t\t\tif (--j < 0 || (oldp != (newp=fns[j][1].parent) && oldp)) {\n\t\t\t\t\tfor (i = j; ++i <= k;) {\n\t\t\t\t\t\tf = fns[i];\n\t\t\t\t\t\tf[0].apply(f[1], args);\n\t\t\t\t\t}\n\t\t\t\t\tk = j;\n\t\t\t\t}\n\t\t\t\toldp = newp;\n\t\t\t}\n\t}", "function myOtherrunFunctions(b,c){\r\n console.log(\"I'm another function that will run two other functions.\");\r\n b();\r\n c(); \r\n}", "executeFunction(fn, args) {\n return fn(...args);\n }", "executeFunction(fn, args) {\n return fn(...args);\n }", "step_func_done(func) { func(); }", "function sequence(...fns) {\n return function(...args) {\n return fns.reduce((prev, curr) => curr(prev), args);\n };\n}", "function runCmds(cmds) {\n if (cmds.length==1) return cmds[0]();\n return cmds[0]( runCmds(cmds.slice(1)) );\n }", "function run( str, fn, ret, args ){\n\t\t\t\treturn runFn( str, fn, ret, args || [], isAsync, reject, brackets );\n\t\t\t}", "function runFn( str, fn, returnHandle, args, isAsync, reject, brackets ){\n\t\t\tvar result,\n\t\t\t\t//custom resolve handle which updates the result variable to the resolved value\n\t\t\t\tresolveHandle = function( val ){\n\t\t\t\t\tresult = val;\n\t\t\t\t},\n\t\t\t\thasError = false,\n\t\t\t\t//custom reject handle to run the initial reject function and set hasError to true\n\t\t\t\trejectHandle = function( err ){\n\t\t\t\t\treject( err );\n\t\t\t\t\thasError = true;\n\t\t\t\t};\n\t\t\t\n\t\t\t//To run the given function with the given resolve and reject handles\n\t\t\tfunction run( resolve, reject ){\n\t\t\t\tvar close,\n\t\t\t\t\t//create a new extraction\n\t\t\t\t\tX = new Extraction( isAsync, reject, str, brackets );\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\tTo finish and resolve using the return handle\n\t\t\t\t\tInput :\n\t\t\t\t\t\t- content : handle string\n\t\t\t\t*/\n\t\t\t\tfunction finish( content ){\n\t\t\t\t\t//the nest is the Extraction base nest (or an empty nest if there is an error)\n\t\t\t\t\tvar nest = hasError ? new Nest() : X.Nest.public,\n\t\t\t\t\t\t//get the return value by running the returnHandle in the context of the nest with the handled string as the input argument\n\t\t\t\t\t\tvalue = returnHandle.call( nest, content);\n\t\t\t\t\t\t\n\t\t\t\t\t//resolve with the return value\n\t\t\t\t\tresolve( value );\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//run the given function with the given arguments\n\t\t\t\tfn.apply( X, args );\n\t\t\t\t\n\t\t\t\t//try to close the Extraction\n\t\t\t\tclose = X.tryClose();\n\t\t\t\t\n\t\t\t\t//if Async, then 'close' is a Promise, so run the finish function when resolved\n\t\t\t\tif( isAsync ) close.then(finish,reject);\n\t\t\t\t//otherwise, finish using 'close' as the input argument\n\t\t\t\telse finish( close );\n\t\t\t}\n\t\t\n\t\t\t//if in async mode, then run the function inside a Promise\n\t\t\tif( isAsync ) return new Promise( run )\n\t\t\t//otherwise, run the function using the custom resolve and reject handles\n\t\t\trun( resolveHandle, rejectHandle );\n\t\t\t//and return the result\n\t\t\treturn result; \n\t\t}", "function normalizeFns(fns) {\n Object.keys(fns).forEach(function(key) {\n var handler = fns[key];\n if (typeof handler === 'function') {\n fns[key] = {\n enter: handler,\n leave: noop\n };\n }\n });\n}", "function _HandleFunctions(pstrTok, pStack, pdtFormat, parrVars)\n {\n var varTmp, varTerm, varTerm2, objTmp, varFormat;\n var objOp1, objOp2, objFormat;\n var arrArgs;\n var intCntr;\n\n\n\n if (!pstrTok.isFunction)\n throw \"Unsupported function token [\" + pstrTok.val + \"]\";\n\n varTmp = pstrTok.val;\n arrArgs = new Array();\n varTerm = Tokenizer.ARG_TERMINAL;\n while ( !pStack.IsEmpty() )\n {\n varTerm = pStack.Pop();\n if (!varTerm.isArgTerminal)\n arrArgs[arrArgs.length] = varTerm;\n else\n break;\n }\n\n // console.log( 'testing functions ', varTmp, arrArgs );\n\n switch (varTmp)\n {\n case \"ARRAY\" :\n var arrArray=new Array();\n \n objTmp = 0;\n intCntr = arrArgs.length;\n while (--intCntr >= 0)\n {\n varTerm = arrArgs[intCntr];\n if (varTerm.isVariable)\n {\n objTmp = parrVars[varTerm.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm.val + \"] not defined\";\n else\n varTerm = objTmp;\n }\n arrArray=arrArray.concat(Tokenizer.toArray(varTerm.val));\n }\n pStack.Push(Tokenizer.makeToken(arrArray,Tokenizer.TOKEN_TYPE.ARRAY));\n break;\n case \"TODAY\" :\n pStack.Push(Tokenizer.makeToken(DateParser.currentDate(), Tokenizer.TOKEN_TYPE.DATE));\n break;\n case \"ACOS\" :\n case \"ASIN\" :\n case \"ATAN\" :\n throw \"Function [\" + varTmp + \"] is not implemented!\";\n break;\n case \"ABS\" :\n case \"CHR\" :\n case \"COS\" :\n case \"FIX\" :\n case \"HEX\" :\n case \"LOG\" :\n case \"RAND\" :\n case \"ROUND\" :\n case \"SIN\" :\n case \"SQRT\" :\n case \"TAN\" :\n\n if (varTmp != \"RAND\")\n {\n if (arrArgs.length < 1)\n throw varTmp + \" requires at least one argument!\";\n else if (arrArgs.length > 1)\n throw varTmp + \" requires only one argument!\";\n }\n else\n {\n if (arrArgs.length < 1)\n throw varTmp + \" requires at least one argument!\";\n else if (arrArgs.length > 2)\n throw varTmp + \" requires at most two arguments!\";\n }\n varTerm = arrArgs[0];\n if (varTerm.isVariable)\n {\n objTmp = parrVars[varTerm.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm.val + \"] not defined\";\n else\n varTerm = objTmp;\n }\n \n objTmp = varTerm.val;\n\n if( varTerm.val !== 0 && !varTerm.val )\n throw varTmp + \" operates on numeric operands only!\";\n \n else if ( isNaN( +varTerm.val ) )\n throw varTmp + \" operates on numeric operands only!\";\n else\n {\n\n objTmp = Tokenizer.toNumber(varTerm.val);\n if (varTmp == \"RAND\")\n {\n rand_max=Math.floor(objTmp);\n if (arrArgs.length == 2)\n {\n varTerm = arrArgs[1];\n if (varTerm.isVariable)\n {\n objTmp = parrVars[varTerm.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm.val + \"] not defined\";\n else\n varTerm = objTmp;\n }\n \n if (!varTerm.isNumber)\n throw varTmp + \" operates on numeric operands only!\";\n \n objTmp = Tokenizer.toNumber(varTerm.val);\n \n rand_min=Math.floor(objTmp);\n }\n }\n }\n \n if (varTmp == \"ABS\")\n pStack.Push(Tokenizer.makeToken(Math.abs(objTmp),Tokenizer.TOKEN_TYPE.NUMBER));\n else if (varTmp == \"CHR\"){\n // TODO check what happens when $objTmp is empty; what does fromCharCode() return?\n\n pStack.Push(Tokenizer.makeToken(String.fromCharCode(objTmp),Tokenizer.TOKEN_TYPE.STRING_LITERAL));\n }\n else if (varTmp == \"COS\")\n pStack.Push(Tokenizer.makeToken(Math.cos(objTmp),Tokenizer.TOKEN_TYPE.NUMBER));\n else if (varTmp == \"FIX\")\n pStack.Push(Tokenizer.makeToken(Math.floor(objTmp),Tokenizer.TOKEN_TYPE.NUMBER));\n else if (varTmp == \"HEX\")\n pStack.Push(Tokenizer.makeToken(objTmp.toString(16),Tokenizer.TOKEN_TYPE.STRING_LITERAL));\n else if (varTmp == \"LOG\")\n pStack.Push(Tokenizer.makeToken(Math.log(objTmp),Tokenizer.TOKEN_TYPE.NUMBER));\n else if (varTmp == \"RAND\")\n pStack.Push(Tokenizer.makeToken(Math.round(rand_min+(rand_max-rand_min)*Math.random()),Tokenizer.TOKEN_TYPE.NUMBER));\n else if (varTmp == \"ROUND\")\n pStack.Push(Tokenizer.makeToken(Math.round(objTmp),Tokenizer.TOKEN_TYPE.NUMBER));\n else if (varTmp == \"SIN\")\n pStack.Push(Tokenizer.makeToken(Math.sin(objTmp),Tokenizer.TOKEN_TYPE.NUMBER));\n else if (varTmp == \"SQRT\")\n pStack.Push(Tokenizer.makeToken(Math.sqrt(objTmp),Tokenizer.TOKEN_TYPE.NUMBER));\n else if (varTmp == \"TAN\")\n pStack.Push(Tokenizer.makeToken(Math.tan(objTmp),Tokenizer.TOKEN_TYPE.NUMBER));\n break;\n case \"STR\" :\n if (arrArgs.length < 1)\n throw varTmp + \" requires at least one argument!\";\n else if (arrArgs.length > 2)\n throw varTmp + \" requires at most two arguments!\";\n varTerm = arrArgs[arrArgs.length-1];\n if (varTerm.isVariable)\n {\n objTmp = parrVars[varTerm.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm.val + \"] not defined\";\n else\n varTerm = objTmp;\n }\n // if date, output formated date string\n if (varTerm.isDate)\n {\n var format='';\n if (arrArgs.length==2)\n {\n varFormat = arrArgs[0];\n if (varFormat.isVariable)\n {\n objTmp = parrVars[varFormat.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varFormat.val + \"] not defined\";\n else\n varFormat = objTmp;\n }\n \n if (!varFormat.isStringLiteral)\n throw \"format argument for \" + varTmp + \" must be a string!\";\n format=varFormat.val;\n }\n pStack.Push(Tokenizer.makeToken(DateParser.formatDate(varTerm.val, format),Tokenizer.TOKEN_TYPE.STRING_LITERAL));\n }\n else // just convert to string\n pStack.Push(Tokenizer.makeToken(varTerm.val.toString(),Tokenizer.TOKEN_TYPE.STRING_LITERAL));\n break;\n case \"ASC\" :\n\n if (arrArgs.length > 1)\n throw varTmp + \" requires only one argument!\";\n else if (arrArgs.length < 1)\n throw varTmp + \" requires at least one argument!\";\n varTerm = arrArgs[0];\n if (varTerm.isVariable)\n {\n objTmp = parrVars[varTerm.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm.val + \"] not defined\";\n else\n varTerm = objTmp;\n }\n if( varTerm.isNumber )\n {\n varTerm.val = varTerm.val.toString();\n varTerm.isStringLiteral = true;\n }\n\n if (!varTerm.isStringLiteral)\n throw varTmp + \" requires a string type operand!\";\n else\n {\n\t\t\t\t\t\tif ( varTerm.val ) {\n\t\t\t\t\t\t\tpStack.Push(Tokenizer.makeToken(varTerm.val.charCodeAt(0),Tokenizer.TOKEN_TYPE.NUMBER));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpStack.Push(Tokenizer.makeToken(0,Tokenizer.TOKEN_TYPE.NUMBER));\n\t\t\t\t\t\t}\n }\n break;\n case \"REGEX\" :\n if (arrArgs.length < 1)\n throw varTmp + \" requires at least one argument!\";\n else if (arrArgs.length > 2)\n throw varTmp + \" requires at most two arguments!\";\n \n varTerm = arrArgs[arrArgs.length-1];\n if (varTerm.isVariable)\n {\n objTmp = parrVars[varTerm.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm.val + \"] not defined\";\n else\n varTerm = objTmp;\n }\n \n if (!varTerm.isStringLiteral)\n throw varTmp + \" operates on string type operands!\";\n \n var opts=Tokenizer.EMPTY_STRING;\n if (arrArgs.length==2)\n {\n opts = arrArgs[0];\n if (opts.isVariable)\n {\n objTmp = parrVars[opts.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + opts.val + \"] not defined\";\n else\n opts = objTmp;\n }\n \n if (!opts.isStringLiteral)\n throw varTmp + \" operates on string type operands!\";\n }\n pStack.Push(Tokenizer.makeToken(Functions.Regex(varTerm.val.toString(), opts.val.toString()),Tokenizer.TOKEN_TYPE.REGEX));\n break;\n case \"LCASE\" :\n case \"UCASE\" :\n case \"NUM\" :\n\n if (arrArgs.length < 1)\n throw varTmp + \" requires at least one argument!\";\n else if (arrArgs.length > 1)\n throw varTmp + \" requires only one argument!\";\n\n varTerm = arrArgs[0];\n if (varTerm.isVariable)\n {\n objTmp = parrVars[varTerm.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm.val + \"] not defined\";\n else\n varTerm = objTmp;\n }\n\n if( varTerm.isNumber )\n {\n varTerm.val = varTerm.val.toString();\n varTerm.isStringLiteral = true;\n }\n\n if (!varTerm.isStringLiteral && varTmp != \"NUM\")\n throw varTmp + \" requires a string type operand!\";\n else\n {\n if (varTmp == \"LCASE\")\n {\n pStack.Push(Tokenizer.makeToken(varTerm.val.toLowerCase(),Tokenizer.TOKEN_TYPE.STRING_LITERAL));\n }\n else if (varTmp == \"UCASE\")\n {\n pStack.Push(Tokenizer.makeToken(varTerm.val.toUpperCase(),Tokenizer.TOKEN_TYPE.STRING_LITERAL));\n }\n else if (varTmp == \"NUM\")\n {\n objTmp=Tokenizer.toNumber(varTerm.val)+0.0;\n if (isNaN(objTmp))\n throw varTmp + \" cannot convert [\" + varTerm.val + \"] to number!\";\n pStack.Push(Tokenizer.makeToken(objTmp,Tokenizer.TOKEN_TYPE.NUMBER));\n }\n }\n break;\n case \"LEN\" :\n if (arrArgs.length < 1)\n throw varTmp + \" requires at least one argument!\";\n else if (arrArgs.length > 1)\n throw varTmp + \" requires only one argument!\";\n\n varTerm = arrArgs[0];\n if (varTerm.isVariable)\n {\n objTmp = parrVars[varTerm.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm.val + \"] not defined\";\n else\n varTerm = objTmp;\n }\n\n if (!varTerm.isArray && !varTerm.isStringLiteral)\n throw varTmp + \" requires a string or array type operand!\";\n else\n {\n pStack.Push(Tokenizer.makeToken(varTerm.val.length,Tokenizer.TOKEN_TYPE.NUMBER));\n }\n break;\n case \"USER\" :\n if (arrArgs.length < 1)\n throw varTmp + \" requires at least one argument!\";\n else if (arrArgs.length > 1)\n throw varTmp + \" requires only one argument!\";\n\n varTerm = arrArgs[0];\n if (varTerm.isVariable)\n {\n objTmp = parrVars[varTerm.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm.val + \"] not defined\";\n else\n varTerm = objTmp;\n }\n\n if (!varTerm.isStringLiteral)\n throw varTmp + \" requires a string type operand!\";\n else\n {\n pStack.Push(Tokenizer.makeToken(Functions.User(varTerm.val),Tokenizer.TOKEN_TYPE.STRING_LITERAL));\n }\n break;\n case \"COOKIE\" :\n if (arrArgs.length < 1)\n throw varTmp + \" requires at least one argument!\";\n else if (arrArgs.length > 1)\n throw varTmp + \" requires only one argument!\";\n\n varTerm = arrArgs[0];\n if (varTerm.isVariable)\n {\n objTmp = parrVars[varTerm.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm.val + \"] not defined\";\n else\n varTerm = objTmp;\n }\n\n if (!varTerm.isStringLiteral)\n throw varTmp + \" requires a string type operand!\";\n else\n {\n //console.log(varTerm.val,varTerm.val.length);\n pStack.Push(Tokenizer.makeToken(Functions.Cookie(varTerm.val),Tokenizer.TOKEN_TYPE.STRING_LITERAL));\n }\n break;\n case \"CONTAINS\" :\n // console.log( 'testing functions ', varTmp, arrArgs );\n if (arrArgs.length < 2)\n throw varTmp + \" requires at least two arguments!\";\n else if (arrArgs.length > 2)\n throw varTmp + \" requires only two arguments!\";\n\n varTerm = arrArgs[1];\n if (varTerm.isVariable)\n {\n objTmp = parrVars[varTerm.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm.val + \"] not defined\";\n else\n varTerm = objTmp;\n }\n varTerm2 = arrArgs[0];\n if (varTerm2.isVariable)\n {\n objTmp = parrVars[varTerm2.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm2.val + \"] not defined\";\n else\n varTerm2 = objTmp;\n }\n\n if ( !varTerm.isArray )\n throw varTmp + \" requires an array as first argument!\";\n else\n {\n var found=false;\n /*var ii=varTerm.val.length;\n while(--ii>=0)\n {\n if (varTerm.val[ii]==varTerm2.val)\n {\n found=true;\n break;\n }\n }*/\n found=Functions.Contains(varTerm.val, varTerm2.val);\n pStack.Push(Tokenizer.makeToken(found,Tokenizer.TOKEN_TYPE.BOOLEAN));\n }\n break;\n case \"DATE\" :\n if (arrArgs.length < 2)\n throw varTmp + \" requires at least two arguments!\";\n else if (arrArgs.length > 2)\n throw varTmp + \" requires only two arguments!\";\n\n varTerm = arrArgs[1];\n if (varTerm.isVariable)\n {\n objTmp = parrVars[varTerm.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm.val + \"] not defined\";\n else\n varTerm = objTmp;\n }\n varFormat = arrArgs[0];\n if (varFormat.isVariable)\n {\n objFormat = parrVars[varFormat.val];\n if (objFormat == undefined || objFormat == null)\n throw \"Variable [\" + varFormat.val + \"] not defined\";\n else\n varFormat = objFormat;\n }\n\n var dateobj={};\n if (\n (!varTerm.isStringLiteral) || \n (!varFormat.isStringLiteral)\n )\n throw varTmp + \" requires string type operands!\";\n else if (!Tokenizer.isDate(varTerm.val, varFormat.val, dateobj))\n throw varTmp + \" can not convert [\" + varTerm.val + \"] to a valid date with format [\" + varFormat.val + \"]!\";\n else\n {\n if (dateobj.date)\n pStack.Push(Tokenizer.makeToken(dateobj.date,Tokenizer.TOKEN_TYPE.DATE));\n else\n throw varTmp + \" unknown error\";\n }\n break;\n case \"empty\":\n case \"EMPTY\":\n if (arrArgs.length < 1)\n throw varTmp + \" requires at least one arguments!\";\n else if (arrArgs.length > 1)\n throw varTmp + \" requires only one arguments!\";\n\n varFormat = arrArgs[0];\n\n\n if( varFormat.isEmpty === true )\n {\n pStack.Push( Tokenizer.makeToken(true,Tokenizer.TOKEN_TYPE.BOOLEAN) );\n }\n else if( varFormat.isArray === true && varFormat.val.length === 0 )\n {\n pStack.Push( Tokenizer.makeToken(true,Tokenizer.TOKEN_TYPE.BOOLEAN) );\n }\n else if( varFormat.isStringLiteral === true && varFormat.val === \"\" )\n {\n pStack.Push( Tokenizer.makeToken(true,Tokenizer.TOKEN_TYPE.BOOLEAN) );\n }\n else if( varFormat.isDate && !varFormat.val )\n {\n pStack.Push( Tokenizer.makeToken(true,Tokenizer.TOKEN_TYPE.BOOLEAN) );\n }\n else\n {\n pStack.Push( Tokenizer.makeToken(false,Tokenizer.TOKEN_TYPE.BOOLEAN) );\n }\n\n\n break;\n case \"LEFT\" :\n case \"RIGHT\" :\n if (arrArgs.length < 2)\n throw varTmp + \" requires at least two arguments!\";\n else if (arrArgs.length > 2)\n throw varTmp + \" requires only two arguments!\";\n\n for (intCntr = 0; intCntr < arrArgs.length; intCntr++)\n {\n varTerm = arrArgs[intCntr];\n if (varTerm.isVariable)\n {\n objTmp = parrVars[varTerm.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm.val + \"] not defined\";\n else\n varTerm = objTmp;\n }\n\n if( varTerm.isNumber )\n {\n arrArgs[1].val = arrArgs[1].val.toString()\n varTerm.isStringLiteral = true;\n }\n\n if (intCntr == 0 && !varTerm.isNumber)\n throw varTmp + \" operator requires numeric length!\";\n else if (intCntr == 1 && !varTerm.isStringLiteral)\n throw varTmp + \" operator requires a string operand!\";\n arrArgs[intCntr] = varTerm;\n }\n varTerm = arrArgs[1].val.toString();\n objTmp = Tokenizer.toNumber(arrArgs[0].val);\n if (varTmp == \"LEFT\")\n {\n pStack.Push(Tokenizer.makeToken(varTerm.substring(0, objTmp),Tokenizer.TOKEN_TYPE.STRING_LITERAL));\n }\n else\n {\n pStack.Push(Tokenizer.makeToken(varTerm.substr((varTerm.length - objTmp), objTmp),Tokenizer.TOKEN_TYPE.STRING_LITERAL));\n }\n break;\n case \"MID\" :\n case \"IIF\" :\n\n if (arrArgs.length < 3)\n throw varTmp + \" requires at least three arguments!\";\n else if (arrArgs.length > 3)\n throw varTmp + \" requires only three arguments!\";\n\n\n\n for (intCntr = 0; intCntr < arrArgs.length; intCntr++)\n {\n varTerm = arrArgs[intCntr];\n if (varTerm.isVariable)\n {\n objTmp = parrVars[varTerm.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm.val + \"] not defined\";\n else\n varTerm = objTmp;\n }\n\n if( varTerm.isNumber )\n {\n arrArgs[2].val = arrArgs[2].val.toString()\n varTerm.isStringLiteral = true;\n }\n\n if (varTmp == \"MID\" && intCntr <= 1 && !varTerm.isNumber)\n throw varTmp + \" operator requires numeric lengths!\";\n else if (varTmp == \"MID\" && intCntr == 2 && !varTerm.isStringLiteral)\n throw varTmp + \" operator requires a string input!\";\n //else if (varTmp == \"IIF\" && intCntr == 2 && !varTerm.isBoolean && !varTerm.isNumber)\n //throw varTmp + \" operator requires boolean condition!\";\n arrArgs[intCntr] = varTerm;\n }\n if (varTmp == \"MID\")\n {\n varTerm = arrArgs[2].val.toString();\n objOp1 = Tokenizer.toNumber(arrArgs[1].val);\n objOp2 = Tokenizer.toNumber(arrArgs[0].val);\n pStack.Push(Tokenizer.makeToken(varTerm.substring(objOp1, objOp2),Tokenizer.TOKEN_TYPE.STRING_LITERAL));\n }\n else\n {\n\n varTerm = Tokenizer.toBoolean(arrArgs[2].val);\n\n if (varTerm)\n {\n objOp1 = arrArgs[1];\n }\n\n else\n {\n objOp1 = arrArgs[0];\n }\n\n pStack.Push(objOp1);\n }\n break;\n case \"AVG\" :\n case \"MAX\" :\n case \"MIN\" :\n if (arrArgs.length < 1)\n throw varTmp + \" requires at least one operand!\";\n\n var _arr=[];\n intCntr = arrArgs.length;\n while (--intCntr>=0)\n {\n varTerm = arrArgs[intCntr];\n if (varTerm.isVariable)\n {\n objTmp = parrVars[varTerm.val];\n if (objTmp == undefined || objTmp == null)\n throw \"Variable [\" + varTerm.val + \"] not defined\";\n else\n varTerm = objTmp;\n }\n\n if( jQuery.isArray( varTerm.val ) )\n {\n varTerm.isArray = true;\n }\n else if( varTerm.val !== '' || isNaN( +varTerm.val ) === false )\n {\n varTerm.isNumber = true;\n }\n\n if (!varTerm.isNumber && !varTerm.isArray)\n throw varTmp + \" requires numeric or array operands only!\";\n\n if (!varTerm.isArray)\n _arr=_arr.concat(Tokenizer.toArray(Tokenizer.toNumber(varTerm.val)));\n else\n _arr=_arr.concat(varTerm.val);\n }\n intCntr = -1;\n objTmp = 0;\n while (++intCntr < _arr.length)\n {\n varTerm = _arr[intCntr];\n if (varTmp == \"AVG\")\n objTmp += varTerm;\n else if (varTmp == \"MAX\")\n {\n if (intCntr == 0) \n objTmp = varTerm;\n else if (objTmp < varTerm)\n objTmp = varTerm;\n }\n else if (varTmp == \"MIN\")\n {\n if (intCntr == 0) \n objTmp = varTerm;\n else if (objTmp > varTerm)\n objTmp = varTerm;\n }\n }\n if (varTmp == \"AVG\" && _arr.length)\n pStack.Push(Tokenizer.makeToken(objTmp/_arr.length,Tokenizer.TOKEN_TYPE.NUMBER));\n else if (varTmp == \"AVG\")\n pStack.Push(Tokenizer.makeToken(0,Tokenizer.TOKEN_TYPE.NUMBER));\n else\n pStack.Push(Tokenizer.makeToken(objTmp,Tokenizer.TOKEN_TYPE.NUMBER));\n break;\n }\n }", "function chain() {\n var functions = Array.prototype.slice.call(arguments, 0);\n if (functions.length > 0) {\n var firstFunction = functions.shift();\n var firstPromise = firstFunction.call();\n firstPromise.done(function () {\n chain.apply(null, functions);\n });\n }\n }", "function chain() {\n var functions = Array.prototype.slice.call(arguments, 0);\n if (functions.length > 0) {\n var firstFunction = functions.shift();\n var firstPromise = firstFunction.call();\n firstPromise.done(function () {\n chain.apply(null, functions);\n });\n }\n }", "function chain() {\n var functions = Array.prototype.slice.call(arguments, 0);\n if (functions.length > 0) {\n var firstFunction = functions.shift();\n var firstPromise = firstFunction.call();\n firstPromise.done(function () {\n chain.apply(null, functions);\n });\n }\n }", "function compose(...fns) {\n return (...args) => {\n return fns.reduceRight((leftFn, rightFn) => {\n return leftFn instanceof Promise\n ? Promise.resolve(leftFn).then(rightFn)\n : rightFn(leftFn);\n }, args[0]);\n };\n}", "function makeChainedCallback(i, fns, results, cb) {\n return function(err, result) {\n if (err) {\n return cb(err);\n }\n results[i] = result;\n if (fns[i + 1]) {\n return fns[i + 1](makeChainedCallback(i + 1, fns, results, cb));\n } else {\n return cb(null, results);\n }\n };\n }", "async function run(funsAndArgs) {\n console.log('😌');\n let result = false;\n try {\n for (const [fun, args] of funsAndArgs) {\n console.log(`🙋 ${fun.name} ${args.join(' ')}`);\n if (!await fun(args)) {\n console.log(`🙅 ${fun.name}`);\n return;\n }\n console.log(`🙆 ${fun.name}`);\n }\n result = true;\n } catch (e) {\n console.error(e);\n } finally {\n console.log(result ? `🎉 ${rot13('Nqinapr Nhfgenyvn!')} 🇳🇿` : '😱');\n }\n return result;\n}", "function invoke(itfn, title, fn) {\n return itfn.call(this, title, function(done) {\n var failure = null;\n\n try {\n var promise = fn.call(this);\n if (promise && (typeof(promise.then) === 'function')) {\n promise.then(function(success) {\n if (failure != null) done(failure);\n else if (success === successInstance) done();\n else done(new Error(\"Not notified of completion: call 'done()' on the last promise\"));\n }, function(failure) {\n console.warn(\"Rejected: \", failure);\n done(failure);\n })\n } else if (promise === successPromise) {\n done(new Error(\"The completion notification 'done()' must be called as a function\"));\n done();\n } else {\n done(new Error(\"Test did not return a Promise\"));\n }\n } catch (error) {\n console.warn(\"Failed:\", error);\n done(failure = error);\n }\n });\n }", "function executeHandlers(arg) {\n var i;\n for (i = 0; i < notifyHandlers.length; i++) {\n try {\n notifyHandlers[i](arg);\n } catch (err) {\n console.error('Error in promise notify handler');\n console.error(err);\n }\n }\n }", "function run(fun) {\n fun(); // Executa a funcao passada como parametro\n}", "function invokeConfigFn(tasks) {\n for(var i in tasks) {\n if(tasks.hasOwnProperty(i) && /^f/.test(typeof tasks[i])) {\n tasks[i](grunt);\n }\n }\n }", "function executeCallbacks() {\n while (callbacks.length > 0) {\n var callback = callbacks.shift();\n callback();\n }\n}", "function then(fn_done, fn_fail) {\r\n done(fn_done);\r\n fail(fn_fail);\r\n }", "function runCallbacks() {\n\n\t\tcallbacks.forEach(function (callback) {\n\t\t\tcallback();\n\t\t});\n\n\t\trunning = false;\n\t}", "step_func(func) { func(); }", "function callFunctions(){\n addition(10, 20);\n subtraction(30, 10);\n}", "function fuse(fn1, fn2, opt_excludeRetArgs) {\r\n var fns = slice(arguments), l = fns.length;\r\n opt_excludeRetArgs = typeOf(fns[l - 1], 'Function') ? 0 : (l--, fns.pop());\r\n return function() {\r\n for (var arrArgs = slice(arguments), extraArgs = [], me = this, i = 0, ret; i < l; i++) {\r\n ret = fns[i].apply(me, arrArgs.concat(extraArgs));\r\n if (!opt_excludeRetArgs) {\r\n extraArgs.push(ret);\r\n }\r\n }\r\n return ret;\r\n };\r\n }", "function runHandlers(queue, value) {\n\t\tfor (var i = 0; i < queue.length; i++) {\n\t\t\tqueue[i](value);\n\t\t}\n\t}", "function pipe(value, ...fns) {\n if (!arguments.length) {\n throw new Error('expected one value argument and least one function argument');\n }\n if (!fns.length) {\n throw new Error(\n 'expected at least one (and probably more) function arguments'\n );\n }\n\n var result = fns[0](value);\n var len = fns.length;\n for (var i = 1; i < len; i++) {\n result = fns[i](result);\n }\n return result;\n}", "function test() {\n console.log('TEST SUITE');\n for(let i=0; i < testFuncs.length; i++) {\n let test = testFuncs[i];\n try {\n test();\n console.log('(' + i + ')' + test.name + ': PASS')\n } catch(e) {\n console.log('(' + i + ')' + test.name + ': FAIL');\n console.log(e);\n }\n }\n}", "function compose(fns) {\n\n\n}", "function chain(client, fns, index) {\n if (index === fns.length) return;\n\n var client = arguments[0];\n var fns = arguments[1];\n var index = arguments[2];\n\n\n var callback = function(err, result) {\n var extras = []\n extras.push(client);\n extras.push(fns);\n extras.push(index+1);\n\n for (var j = 2 ; j < arguments.length ; j++) {\n extras.push(arguments[j]);\n }\n\n extras.push(err);\n extras.push(result);\n\n if (err) {\n console.log(err);\n } else {\n chain.apply(this, extras)\n }\n }\n\n var varArgs = [];\n varArgs.push(client);\n varArgs.push(callback);\n\n for (var j = 3 ; j < arguments.length ; j++) {\n varArgs.push(arguments[j]);\n }\n\n //console.log(index);\n fns[index].apply(this, varArgs);\n}", "function executeActions(actions, state, callback) {\n // console.log(\"executeActions\", actions);\n const action = actions.shift();\n action.on('result', (result) => {\n if (result.success) {\n // TODO update state\n if (actions.length > 0) {\n executeActions(actions, state, callback);\n } else {\n // we are done\n callback(null, {\n program: null,\n state: state,\n result: result.result\n });\n }\n } else {\n // an error happened; abort sequence\n callback({\n msg: 'action execution failed',\n action,\n error: result.error\n }, null);\n }\n });\n action.on('status', console.log);\n action.on('feedback', console.log);\n action.execute();\n}", "function _runner(dependencies){\n //check if attr 'success-function' exist and not empty\n if(typeof dependencies !== typeof undefined && dependencies !== false && dependencies !== \"\") {\n var classList = dependencies.split(/\\s+/);\n $.each(classList, function(index, item) {\n if( typeof item !== typeof undefined && typeof item === 'function'){\n window[item]();\n }\n });\n }\n\n }", "function inparallel(parallel_functions, final_function) {\n n = parallel_functions.length;\n for(i = 0; i < n; ++i) {\n parallel_functions[i](function() {\n n--;\n if(n == 0) { \n final_function();\n } \n });\n }\n}", "function _apply(f, thisArg, args) {\n\t\treturn Promise.all(args).then(function(args) {\n\t\t\treturn f.apply(thisArg, args);\n\t\t});\n\t}", "function _apply(f, thisArg, args) {\n\t\treturn Promise.all(args).then(function(args) {\n\t\t\treturn f.apply(thisArg, args);\n\t\t});\n\t}", "function _apply(f, thisArg, args) {\n\t\treturn Promise.all(args).then(function(args) {\n\t\t\treturn f.apply(thisArg, args);\n\t\t});\n\t}", "function _apply(f, thisArg, args) {\n\t\treturn Promise.all(args).then(function(args) {\n\t\t\treturn f.apply(thisArg, args);\n\t\t});\n\t}", "function bindFunctions (namespace, functions=[]) {\n let ns = getNamespace(namespace);\n functions.forEach(fnDef => {\n let { name: method, successCallbackIndex: success, failureCallbackIndex: failure } = fnDef;\n let name = `${namespace}.${method}`;\n exportFunction(JETPACK.RPC.bind(null, { name, success, failure }), ns, { defineAs: method });\n });\n}", "function thenRun() {\n\tconst args = Array.prototype.slice.call(arguments);\n\treturn () => run.apply(null, args);\n}", "function callJSFunctions (data) {\n\tvar calls = JSON.parse(data);\n\n\tfor (var i=0; i<calls.length; i++) {\n\t\tvar call = calls[i];\n\n\t\t// now call function, this avoids eval, which is evil!\n\t\tif (call.data) {\n\t\t\tvar fn = processFunctionScope(call.func);\n\t\t\tfn(call.data);\n\t\t} else if (call.args) {\n\t\t\tvar fn = processFunctionScope(call.func);\n\t\t\tfn.apply(this, call.args);\n\t\t} else {\n\t\t\tvar fn = processFunctionScope(call.func);\n\t\t\tfn();\n\t\t}\n\t}\n}", "function build(fns) {\n var maxlength = 0;\n for (var i = 0; i < fns.length; i++) {\n maxlength = Math.max(maxlength, fns[i].length);\n }\n\n // Build up parameter string.\n var paramArr = [];\n for (var i = 0; i < maxlength; i++) {\n paramArr.push('a' + i);\n }\n var params = paramArr.length ? ',' + paramArr.toString() : '';\n\n // Build code.\n var code = [];\n code.push('var result, tmp;');\n var call = '].call(self' + params + '); \\n' +\n 'result = tmp !== undefined ? tmp : result;';\n for (var i = 0; i < fns.length; i++) {\n code.push('tmp = fns[' + i + call);\n }\n code.push('return result');\n\n var result = Function('fns,self' + params, code.join('\\n'));\n return result.bind(null, fns);\n }", "function validate(t, tc, scheme, deadline) {\n var fns = scheme;\n var cursor = 0;\n var allEvents = [];\n var eventList = [];\n var timedOut = false;\n\n var timer = setTimeout(function() {\n timedOut = true;\n t.fail('timeout');\n tc.removeAllListeners('event');\n tc.removeAllListeners('sut-died');\n tc.shutdown();\n t.end();\n }, deadline);\n\n tc.on('sut-died', function(code) {\n clearTimeout(timer);\n t.fail('SUT crashed (code: ' + code + ')');\n tc.removeAllListeners('event');\n tc.removeAllListeners('sut-died');\n tc.shutdown();\n t.end();\n });\n\n // flatten so arrays gets expanded and fns becomes one-dimensional\n fns = _.flatten(fns, true);\n\n // try to run the fn that the cursor points to. The function indicates that it has\n // succeeded by yielding an updated eventList. If succeeded the cursor progresses\n // to the next function.\n var inProgress = false;\n var progressFromCursor = function() {\n if (timedOut) return;\n if (inProgress) return;\n inProgress = true;\n\n if(cursor >= fns.length) {\n progressionComplete();\n\n inProgress = false;\n return;\n }\n\n if(!fns[cursor].isPrinted) {\n fns[cursor].isPrinted = true;\n var name = fns[cursor].name || fns[cursor].callerName;\n console.log('* starting ' + name);\n }\n\n fns[cursor](eventList, function(result) {\n if (result === null) {\n //wait for more events\n inProgress = false;\n return;\n }\n\n eventList = result;\n cursor++;\n\n inProgress = false;\n progressFromCursor(true);\n });\n };\n\n tc.on('event', function(event) {\n eventList.push(event);\n allEvents.push(event);\n progressFromCursor();\n });\n\n function progressionComplete() {\n clearTimeout(timer);\n t.ok(true, 'validate done: all functions passed');\n tc.shutdown();\n tc.removeAllListeners('event');\n tc.removeAllListeners('sut-died');\n\n /* Validate all events */\n var jsonValidator = createEventValidator(t);\n _.each(allEvents, jsonValidator);\n\n t.end();\n }\n}", "function consecCall(fnArray) {\n\t\n\tvar prevDef = null;\n\t$.each(fnArray, function(index, fn) {\n\t\tvar def = $.Deferred();\n\t\t$.when( prevDef ).done( function() { return fn(def); });\n\t\tprevDef = def;\n\t});\n\treturn prevDef;\n}", "function executeUploaded() {\n console.log('Running acceptance test invocations');\n Promise.all(\n arns.map(arn => {\n return lambda\n .invoke({\n InvocationType: 'RequestResponse',\n FunctionName: arn,\n Payload: JSON.stringify({ test: true })\n })\n .promise();\n })\n )\n .then(([fn1, fn2, fn3, fn4]) => {\n const bool = every([\n fn1.StatusCode === 200,\n fn1.Payload === '\"callback\"',\n fn2.StatusCode === 200,\n fn2.Payload === '\"context.succeed\"',\n fn3.StatusCode === 200,\n fn3.FunctionError === 'Handled',\n fn3.Payload === JSON.stringify({ errorMessage: 'context.fail' }),\n fn4.StatusCode === 200,\n fn4.Payload === '\"context.done\"'\n ]);\n if (bool) {\n console.log('Acceptance test passed.');\n return process.exit(0);\n }\n console.error('Acceptance test failed.');\n console.error('Results: ', JSON.stringify([fn1, fn2, fn3, fn4]));\n return process.exit(1);\n })\n .catch(err => {\n console.error(err);\n process.exit(1);\n });\n}" ]
[ "0.68478644", "0.66488874", "0.65061486", "0.65061486", "0.65061486", "0.65061486", "0.65061486", "0.65061486", "0.6376086", "0.617489", "0.59881306", "0.5942612", "0.5926571", "0.58897847", "0.5781694", "0.57793677", "0.56860965", "0.56757015", "0.5613648", "0.5584616", "0.5568763", "0.5517414", "0.5515395", "0.5452807", "0.5437213", "0.54308164", "0.5423556", "0.53515863", "0.5347042", "0.53275377", "0.53275377", "0.53006756", "0.5231318", "0.5228111", "0.5227348", "0.5201284", "0.5192399", "0.5192207", "0.5192207", "0.517272", "0.5167116", "0.5166477", "0.5158815", "0.51575524", "0.51575524", "0.514877", "0.5134024", "0.5134024", "0.5134024", "0.5120629", "0.5120629", "0.5120629", "0.5115743", "0.51113045", "0.5110164", "0.5108302", "0.5108302", "0.5102119", "0.5092931", "0.50765926", "0.50590354", "0.5048933", "0.503767", "0.50334096", "0.5030472", "0.5030472", "0.5030472", "0.50257534", "0.5018845", "0.50173736", "0.49863172", "0.4958714", "0.4950149", "0.4943971", "0.4934699", "0.49126285", "0.49112105", "0.4907669", "0.49056676", "0.4905187", "0.4904545", "0.49025896", "0.48981032", "0.4878979", "0.4877693", "0.48716155", "0.48678774", "0.48627028", "0.48511094", "0.48511094", "0.48511094", "0.48511094", "0.4842265", "0.48296577", "0.48281065", "0.48129636", "0.48099804", "0.47970158", "0.47957516" ]
0.65281355
3
Run the next `fn`, if any.
function next(err) { var fn = fns[++index] var params = slice.call(arguments, 0) var values = params.slice(1) var length = input.length var pos = -1 if (err) { done(err) return } /* Copy non-nully input into values. */ while (++pos < length) { if (values[pos] === null || values[pos] === undefined) { values[pos] = input[pos] } } input = values /* Next or done. */ if (fn) { wrap(fn, next).apply(null, input) } else { done.apply(null, [null].concat(input)) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function run(fn) {\n if (fn)\n fn(next);\n else\n callback(null, results);\n }", "function next(err, result) {\n if (err)\n return callback(err, results);\n results.push(result);\n if (fns.length)\n run(fns.shift());\n else\n callback(null, results);\n }", "function fx_run_next(fx) {\n var chain = fx.ch, next = chain.shift();\n if ((next = chain[0])) {\n next[1].$ch = true;\n next[1].start.apply(next[1], next[0]);\n }\n}", "function run() {\n var index = -1;\n var input = slice$3.call(arguments, 0, -1);\n var done = arguments[arguments.length - 1];\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input));\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index];\n var params = slice$3.call(arguments, 0);\n var values = params.slice(1);\n var length = input.length;\n var pos = -1;\n\n if (err) {\n done(err);\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos];\n }\n }\n\n input = values;\n\n // Next or done.\n if (fn) {\n wrap$2(fn, next).apply(null, input);\n } else {\n done.apply(null, [null].concat(input));\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n /* Run the next `fn`, if any. */\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n /* Copy non-nully input into values. */\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n /* Next or done. */\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n /* Run the next `fn`, if any. */\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n /* Copy non-nully input into values. */\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n /* Next or done. */\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "next() {}", "foreach(func){\n var data, _next;\n _next = this.next;\n this.next = null;\n\n while( (data = this.process()) != null )\n func(data);\n\n this.next = _next;\n }", "function wrap(fn, next) {\n return function () {\n fn(next);\n };\n}", "next () {}", "function next()\n {\n if(execute_index<execute_1by1.length)\n {\n execute_1by1[execute_index++].call(null, req, res, next);\n //execute_index+1 shouldn't do after call, because it's recursive call\n }\n }", "function next(err) {\n var fn = fns[++index];\n var params = slice$3.call(arguments, 0);\n var values = params.slice(1);\n var length = input.length;\n var pos = -1;\n\n if (err) {\n done(err);\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos];\n }\n }\n\n input = values;\n\n // Next or done.\n if (fn) {\n wrap$2(fn, next).apply(null, input);\n } else {\n done.apply(null, [null].concat(input));\n }\n }", "function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }", "function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }", "function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }", "function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }", "function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }", "function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }", "step_func(func) { func(); }", "function next() {\n\t\t\tcounter = pending = 0;\n\t\t\t\n\t\t\t// Check if there are no steps left\n\t\t\tif (steps.length === 0) {\n\t\t\t\t// Throw uncaught errors\n\t\t\t\tif (arguments[0]) {\n\t\t\t\t\tthrow arguments[0];\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// Get the next step to execute\n\t\t\tvar fn = steps.shift(), result;\n\t\t\tresults = [];\n\t\t\t\n\t\t\t// Run the step in a try..catch block so exceptions don't get out of hand.\n\t\t\ttry {\n\t\t\t\tlock = TRUE;\n\t\t\t\tresult = fn.apply(next, arguments);\n\t\t\t} catch (e) {\n\t\t\t\t// Pass any exceptions on through the next callback\n\t\t\t\tnext(e);\n\t\t\t}\n\t\t\t\n\t\t\tif (counter > 0 && pending == 0) {\n\t\t\t\t// If parallel() was called, and all parallel branches executed\n\t\t\t\t// synchronously, go on to the next step immediately.\n\t\t\t\tnext.apply(NULL, results);\n\t\t\t} else if (result !== undefined) {\n\t\t\t\t// If a synchronous return is used, pass it to the callback\n\t\t\t\tnext(undefined, result);\n\t\t\t}\n\t\t\tlock = FALSE;\n\t\t}", "function runNext() {\n var test = tests[at++];\n if (test) {\n setTimeout( function() {\n compare(test.func,\n window[test.func],\n window[test.func + \"_backported\"],\n test.driver);\n runNext();\n }, 20);\n }\n }", "Next() {}", "function next(...args) {\n\t\t// if the next function has been defined\n\t\tif (typeof utils.queue[utils.i + 1] !== 'undefined') {\n\t\t\targs.unshift(next);\n\t\t\tutils.i++;\n\t\t\treturn utils.queue[utils.i](...args);\n\t\t}\n\n\t\t// if there are no more function, next will re-init fang group\n\t\treturn init(args);\n\t}", "function doSth(fn) {\n fn(1);\n}", "function next(ctx) {\r\n ctx.current++\r\n if (ctx.current < ctx.mds.length) {\r\n\r\n ctx.mds[ctx.current](ctx,next)\r\n\r\n }\r\n else {\r\n ctx.f(ctx)\r\n }\r\n}", "function next() {\n\t\n\tif (currentTransformStep === transformSteps.length) {\n\t\tconsole.log('all transformations performed')\n\t}\n\telse\n\t\ttransformSteps[currentTransformStep++]()\n\t\t\n}", "function scheduleOne(fn) {\n if (!fn.scheduled) {\n fn.scheduled = 0;\n }\n else if (fn.scheduled > 0) {\n return\n }\n fn.scheduled += 1;\n rAF(function() {\n fn.scheduled -= 1;\n fn();\n });\n }", "function next() {\n counter = pending = 0;\n\n // Check if there are no steps left\n if (steps.length === 0) {\n // Throw uncaught errors\n if (arguments[0]) {\n throw arguments[0];\n }\n return;\n }\n\n // Get the next step to execute\n var fn = steps.shift();\n results = [];\n\n // Run the step in a try..catch block so exceptions don't get out of hand.\n try {\n lock = true;\n var result = fn.apply(next, arguments);\n } catch (e) {\n // Pass any exceptions on through the next callback\n next(e);\n }\n\n if (counter > 0 && pending == 0) {\n // If parallel() was called, and all parallel branches executed\n // synchronously, go on to the next step immediately.\n next.apply(null, results);\n } else if (result !== undefined) {\n // If a synchronous return is used, pass it to the callback\n next(undefined, result);\n }\n lock = false;\n }", "function fn() {}", "function step() {\n var f = script.shift();\n if(f) {\n f(stack, step);\n }\n else {\n return cb(null, stack.pop());\n }\n }", "function once(fn){\n\tvar firstExecution = true;\n\tvar result;\n\treturn function(){\n\t\tif(firstExecution){\n\t\t\tresult = fn();\n\t\t\tfirstExecution = false;\n\t\t\treturn result;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n}", "step_func_done(func) { func(); }", "function run(...input) {\n var index = -1\n var done = input.pop()\n\n if (typeof done !== 'function') {\n throw new TypeError('Expected function as last argument, not ' + done)\n }\n\n next(null, ...input)\n\n // Run the next `fn`, if any.\n function next(...values) {\n var fn = fns[++index]\n var error = values.shift()\n var pos = -1\n\n if (error) {\n done(error)\n return\n }\n\n // Copy non-nullish input into values.\n while (++pos < input.length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n // Next or done.\n if (fn) {\n wrap(fn, next)(...values)\n } else {\n done(null, ...values)\n }\n }\n }", "function next(err, result) {\n console.log('**Run in next:' + typeof(result));\n// throw exception if task encounters an error.\n if (err) throw err;\n\n// Next task comes from array of task.\n var currentTask = tasks.shift();\n\n if (currentTask) {\n// Execute current task.\n currentTask(result);\n }\n}", "function next(...values) {\n var fn = fns[++index]\n var error = values.shift()\n var pos = -1\n\n if (error) {\n done(error)\n return\n }\n\n // Copy non-nullish input into values.\n while (++pos < input.length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n // Next or done.\n if (fn) {\n wrap(fn, next)(...values)\n } else {\n done(null, ...values)\n }\n }", "function run (fun) {\n fun() \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 run(fun) {\n fun()\n}", "function run(fun) {\n fun()\n}", "function run(fun) {\n fun()\n}", "function next(cb, name) {\n setTimeout(cb, 0);\n return 0;\n}", "advance() {\n\t\tlet f = this.actions.shift()\n\t\tif (f) f()\n\t}", "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 forEach(seq,fn) { for (var i=0,n=seq&&seq.length;i<n;i++) fn(seq[i]); }", "function passThru (fn) {\n return fn();\n}", "function doFoo(fn) {\r\n return fn();\r\n}", "function run(fun){\n fun()\n}", "function run(fun){\n fun()\n}", "function run(fun){\n fun()\n}", "function run(genFn) {\n const it = genFn();\n\n function _next(err, val) {\n if (err) it.throw(err); //throw err to be caught in generator\n\n //get the generator object\n //a) the first time through val === undefined as yield returns what is returned from the thunk\n //b) next time through `val` will be the value passed as the second arg to the\n // node callback signature\n // - essentially this will \"dependency inject\" the async value from the `yield`\n const cont = it.next(val);\n\n if (cont.done) return;\n\n const cb = cont.value; //yielded function from Thunk that takes a callback as only arg\n\n //call the callback which exposes data inside the generator\n //the \"confusing\" part is that `_next` is the cb passed as the second arg to `fs.readFile`\n //so it will only be called again when `fs.readFile` calls it's cb\n //therefore, the generator is paused at the yield, until `_next` is called by `fs.readFile`\n //and therefore the generator object `.next` method is called advancing the\n //generator and resulting in generator obj `{value: ..., done: true}`\n cb(_next);\n }\n\n _next(); //start the generator\n}", "function each(collection, fn) {\n var i = 0,\n length = collection.length,\n cont;\n\n for(i; i < length; i++) {\n cont = fn(collection[i], i);\n if(cont === false) {\n break; //allow early exit\n }\n }\n }", "function each(collection, fn) {\n var i = 0,\n length = collection.length,\n cont;\n\n for(i; i < length; i++) {\n cont = fn(collection[i], i);\n if(cont === false) {\n break; //allow early exit\n }\n }\n }", "function each(collection, fn) {\n var i = 0,\n length = collection.length,\n cont;\n\n for(i; i < length; i++) {\n cont = fn(collection[i], i);\n if(cont === false) {\n break; //allow early exit\n }\n }\n }", "function each(collection, fn) {\n var i = 0,\n length = collection.length,\n cont;\n\n for(i; i < length; i++) {\n cont = fn(collection[i], i);\n if(cont === false) {\n break; //allow early exit\n }\n }\n }", "function each(collection, fn) {\n var i = 0,\n length = collection.length,\n cont;\n\n for(i; i < length; i++) {\n cont = fn(collection[i], i);\n if(cont === false) {\n break; //allow early exit\n }\n }\n }", "function each(collection, fn) {\n var i = 0,\n length = collection.length,\n cont;\n\n for(i; i < length; i++) {\n cont = fn(collection[i], i);\n if(cont === false) {\n break; //allow early exit\n }\n }\n }", "function next(o, a) {\n\t\t\tvar func = funcs.shift();\n\t\t\tif (func){\n\t\t\t\to.next = next;\n\t\t\t\tfunc(o, a);\n\t\t\t}\n\t\t}", "function next() {\n\t\t\t\tif (eventIDs.length) {\n\t\t\t\t\tsetTimeout(process, 1000);\n\t\t\t\t}\n\t\t\t}", "function next() {\n\t\t\t\tif (eventIDs.length) {\n\t\t\t\t\tsetTimeout(process, 1000);\n\t\t\t\t}\n\t\t\t}", "function next(){\n if(!debug){_next();}\n}", "nextstep(step) {}", "function next(){\n if(!debug){_next()};\n}", "function each(collection, fn) {\n var i = 0,\n length = collection.length,\n cont;\n\n for(i; i < length; i++) {\n cont = fn(collection[i], i);\n if(cont === false) {\n break; //allow early exit\n }\n }\n }", "function seq (_fns) {\n var fns = _fns.slice()\n var callCount = 0\n return function () {\n var next = fns.shift()\n callCount++\n if (!next) {\n throw new Error('Received too many calls. Expected ' + _fns.length + ' got ' + callCount)\n }\n return next.apply(this, arguments)\n }\n}", "function justInvoke(fn) {\n return fn();\n}", "function once (fn) {\n var done = false\n return function (err, val) {\n if(done) return\n done = true\n fn(err, val)\n }\n}", "function once (fn) {\n var done = false\n return function (err, val) {\n if(done) return\n done = true\n fn(err, val)\n }\n}", "function each(collection, fn) {\n\t var i = 0,\n\t length = collection.length,\n\t cont;\n\n\t for(i; i < length; i++) {\n\t cont = fn(collection[i], i);\n\t if(cont === false) {\n\t break; //allow early exit\n\t }\n\t }\n\t }", "function each(collection, fn) {\n\t var i = 0,\n\t length = collection.length,\n\t cont;\n\n\t for(i; i < length; i++) {\n\t cont = fn(collection[i], i);\n\t if(cont === false) {\n\t break; //allow early exit\n\t }\n\t }\n\t }", "function each(collection, fn) {\n\t var i = 0,\n\t length = collection.length,\n\t cont;\n\n\t for(i; i < length; i++) {\n\t cont = fn(collection[i], i);\n\t if(cont === false) {\n\t break; //allow early exit\n\t }\n\t }\n\t }", "function each(collection, fn) {\n var i = 0,\n length = collection.length,\n cont;\n\n for (i; i < length; i++) {\n cont = fn(collection[i], i);\n if (cont === false) {\n break; //allow early exit\n }\n }\n }", "function next() {\n\t\t\tif (aTests.length) {\n\t\t\t\treturn runTest(aTests.shift());\n\t\t\t} else if (!iRunningTests) {\n\t\t\t\toTotal.element.classList.remove(\"hidden\");\n\t\t\t\toTotal.element.firstChild.classList.add(\"running\");\n\t\t\t\tsummary(Date.now() - iStart);\n\t\t\t\tif (oFirstFailedTest) {\n\t\t\t\t\tselect(oFirstFailedTest);\n\t\t\t\t}\n\t\t\t}\n\t\t}", "next() {\n let item = this.rbIter.data();\n\n if (item) {\n let ret = {\n value: item,\n done: false\n };\n\n this.rbIter[this.nextFunc]();\n\n return ret;\n } else {\n return {\n done: true\n }\n }\n }", "function fn() {\n\t\t }", "function loaded(fn, goal) {\n var count = 0;\n\n return function () {\n count++;\n if (count === goal) {\n fn();\n }\n };\n }", "function each(collection, fn) {\n\t\t var i = 0,\n\t\t length = collection.length,\n\t\t cont;\n\t\t\n\t\t for(i; i < length; i++) {\n\t\t cont = fn(collection[i], i);\n\t\t if(cont === false) {\n\t\t break; //allow early exit\n\t\t }\n\t\t }\n\t\t }", "function runNextHandler(nextHandler, e) {\n\n //If e.cancel, then exit process\n if (e.cancel) return;\n\n //If e.delay, then wait\n else if (e.delay) {\n setTimeout(function () { nextHandler(e); }, e.delay);\n delete e.delay;\n }\n\n //Run normally\n else nextHandler(e);\n\n }", "function runFuns(funArr){\n for(let el of funArr){\n sep(); \n var label = el[0], f = el[1]; \n console.log('Running ' + label);\n f();\n }\n}", "function runFunctionIfPossible(funt){\n\tif(funt){funt();}\n}", "function myEach(arr, fn) {\n var tasksNo = arr.length;\n for (var i =0; i < tasksNo; i++){\n fn(arr[i]);\n }\n}", "function tryToRun(fn, times, onFailed) {\r\n times = ~~times || 5;\r\n var delayTime = 250;\r\n function nextCycle() {\r\n if (!times--) {\r\n if (onFailed)\r\n { onFailed(); }\r\n return;\r\n }\r\n try {\r\n if (fn())\r\n { return; }\r\n }\r\n catch (e) { }\r\n setTimeout(nextCycle, delayTime);\r\n delayTime *= 2;\r\n }\r\n setTimeout(nextCycle, 0);\r\n }", "function ejecutarFuncion( fn ){\n // se ejecuta la funcion\n if ( fn() === 1) {\n return true;\n } else {\n return false;\n }\n\n return true;\n}", "function handleOneNext() {\n var prevResult = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];\n\n try {\n var yielded = genObj.next(prevResult); // may throw\n if (yielded.done) {\n if (yielded.value !== undefined) {\n // Something was explicitly returned:\n // Report the value as a result to the caller\n callbacks.success(yielded.value);\n }\n } else {\n setTimeout(runYieldedValue, 0, yielded.value);\n }\n }\n // Catch unforeseen errors in genObj\n catch (error) {\n if (callbacks) {\n callbacks.failure(error);\n } else {\n throw error;\n }\n }\n }", "function next() {\n subject = context.stack.tail.head;\n index = 0;\n test( subject );\n }", "function step() {\n\n // if there's more to do\n if (!result.done) {\n if (typeof result.value === \"function\") {\n result.value(function(err, data) {\n if (err) {\n result = task.throw(err);\n return;\n }\n\n result = task.next(data);\n step();\n });\n } else {\n result = task.next(result.value);\n step();\n }\n\n }\n }", "function each(collection, fn) {\n var i = 0,\n length = collection.length,\n cont;\n\n for (i; i < length; i++) {\n cont = fn(collection[i], i);\n\n if (cont === false) {\n break; //allow early exit\n }\n }\n}", "function each(collection, fn) {\n var i = 0,\n length = collection.length,\n cont;\n\n for (i; i < length; i++) {\n cont = fn(collection[i], i);\n\n if (cont === false) {\n break; //allow early exit\n }\n }\n}", "forEach(fn) {\n let node = this.head;\n while (node) {\n fn(node.value);\n node = node.next;\n }\n }", "function once (fn) {\n\t var called = false;\n\t return function () {\n\t if (!called) {\n\t called = true;\n\t fn();\n\t }\n\t }\n\t}", "function once (fn) {\n\t var called = false;\n\t return function () {\n\t if (!called) {\n\t called = true;\n\t fn();\n\t }\n\t }\n\t}", "function once (fn) {\n\t var called = false;\n\t return function () {\n\t if (!called) {\n\t called = true;\n\t fn();\n\t }\n\t }\n\t}", "function oneShot(fn) {\n let fired = false;\n return function() {\n if (fired) {\n return;\n }\n fired = true;\n fn();\n };\n }", "function wrap(fn, callback) {\n var invoked\n\n return wrapped\n\n function wrapped() {\n var params = slice.call(arguments, 0)\n var callback = fn.length > params.length\n var result\n\n if (callback) {\n params.push(done)\n }\n\n try {\n result = fn.apply(null, params)\n } catch (error) {\n // Well, this is quite the pickle.\n // `fn` received a callback and invoked it (thus continuing the pipeline),\n // but later also threw an error.\n // We’re not about to restart the pipeline again, so the only thing left\n // to do is to throw the thing instead.\n if (callback && invoked) {\n throw error\n }\n\n return done(error)\n }\n\n if (!callback) {\n if (result && typeof result.then === 'function') {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n // Invoke `next`, only once.\n function done() {\n if (!invoked) {\n invoked = true\n\n callback.apply(null, arguments)\n }\n }\n\n // Invoke `done` with one value.\n // Tracks if an error is passed, too.\n function then(value) {\n done(null, value)\n }\n}" ]
[ "0.78941613", "0.7258772", "0.66877997", "0.6568779", "0.6472971", "0.6472971", "0.6464633", "0.6464633", "0.6464633", "0.6464633", "0.6464633", "0.6464633", "0.64020425", "0.6374047", "0.6338008", "0.6277549", "0.62038606", "0.61732835", "0.61340165", "0.61340165", "0.61340165", "0.61340165", "0.61340165", "0.61340165", "0.61026704", "0.60926676", "0.60859257", "0.6076445", "0.60686475", "0.600669", "0.58979845", "0.58758193", "0.5866368", "0.586518", "0.5817454", "0.5810618", "0.5785789", "0.5736699", "0.57081217", "0.5689207", "0.56796634", "0.56490886", "0.56485313", "0.56197697", "0.56197697", "0.56197697", "0.55831647", "0.55639964", "0.55454147", "0.55435", "0.5539771", "0.55311126", "0.55298644", "0.55298644", "0.55298644", "0.55222917", "0.5516523", "0.5516523", "0.5516523", "0.5516523", "0.5516523", "0.5516523", "0.5506442", "0.5505222", "0.5505222", "0.5502943", "0.55029196", "0.548994", "0.5489406", "0.54677176", "0.54573596", "0.54566425", "0.54566425", "0.5454903", "0.5454903", "0.5454903", "0.54531056", "0.5451588", "0.5449", "0.5448408", "0.5439167", "0.5434979", "0.54319346", "0.54287595", "0.5426146", "0.54162", "0.5416197", "0.54138076", "0.5407156", "0.5396753", "0.5382073", "0.5368917", "0.5368917", "0.53623503", "0.5356311", "0.5356311", "0.5356311", "0.5355237", "0.5354715" ]
0.6171807
19
Add `fn` to the list.
function use(fn) { if (typeof fn !== 'function') { throw new Error('Expected `fn` to be a function, not ' + fn) } fns.push(fn) return middleware }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addWithFunction(list, item, hashFunction) {\n if (findWithFunction(list, hashFunction) === -1) {\n list.push(item);\n }\n }", "custom(fn) {\r\n\t\treturn this.push('fn', [...arguments]);\r\n\t}", "function addToQueue(fn) {\n if (working) {\n queue.push(fn);\n } else {\n fn();\n }\n}", "function __ (fn) {\n var self = this;\n var selfArguments = [].slice.apply(arguments).slice(1, arguments.length);\n\n this._ops.push({\n fn: fn,\n wait: this._lastWait || null,\n args: selfArguments\n });\n\n this._lastWait = null;\n }", "function addFunc(pNum){\n done.push(pNum);\n }", "subscribe (fn) {\n this.subscribers.push(fn);\n }", "subscribe(fn) {\n\t\tthis.subscribers.push(fn);\n\t}", "async add(fn, options = {}) {\n return new Promise((resolve, reject) => {\n const run = async () => {\n this._pendingCount++;\n this._intervalCount++;\n try {\n const operation = (this._timeout === undefined && options.timeout === undefined) ? fn() : p_timeout_1.default(Promise.resolve(fn()), (options.timeout === undefined ? this._timeout : options.timeout), () => {\n if (options.throwOnTimeout === undefined ? this._throwOnTimeout : options.throwOnTimeout) {\n reject(timeoutError);\n }\n return undefined;\n });\n resolve(await operation);\n }\n catch (error) {\n reject(error);\n }\n this._next();\n };\n this._queue.enqueue(run, options);\n this._tryToStartAnother();\n this.emit('add');\n });\n }", "registerOnChange(fn) {\n this._onChange.push(fn);\n }", "registerOnChange(fn) {\n this._onChange.push(fn);\n }", "registerOnChange(fn) {\n this._onChange.push(fn);\n }", "registerOnChange(fn) {\n this._onChange.push(fn);\n }", "registerOnChange(fn) {\n this._onChange.push(fn);\n }", "registerOnChange(fn) {\n this._onChange.push(fn);\n }", "registerOnChange(fn) {\n this._onChange.push(fn);\n }", "function addMessageHook(fn) {\r\n if (typeof(fn) !== \"function\") {\r\n throw \"addMessageHook expects a function\";\r\n }\r\n _hooks.push(fn);\r\n}", "function use(fn) {\n if (typeof fn !== 'function') {\n throw new TypeError('Expected `fn` to be a function, not ' + fn)\n }\n\n fns.push(fn)\n return middleware\n }", "async add(fn, options = {}) {\n return new Promise((resolve, reject) => {\n const run = async () => {\n this._pendingCount++;\n this._intervalCount++;\n try {\n const operation = (this._timeout === undefined && options.timeout === undefined) ? fn() : p_timeout_1.default(Promise.resolve(fn()), (options.timeout === undefined ? this._timeout : options.timeout), () => {\n if (options.throwOnTimeout === undefined ? this._throwOnTimeout : options.throwOnTimeout) {\n reject(timeoutError);\n }\n return undefined;\n });\n resolve(await operation);\n }\n catch (error) {\n reject(error);\n }\n this._next();\n };\n this._queue.enqueue(run, options);\n this._tryToStartAnother();\n });\n }", "addOnAfterItemCallback(fn) {\r\n this.onAfterItemCallbacks.push(fn);\r\n }", "function use(fn) {\n if (typeof fn !== 'function') {\n throw new Error('Expected `fn` to be a function, not ' + fn)\n }\n\n fns.push(fn);\n\n return middleware\n }", "function add() {}", "function addTwo(fn) {\n return fn() + 2;\n }", "add_hook(fn, sev=\"ALL\") {\n if (!this._assert_sev(sev)) { return false; }\n this._hooks[this._sev_value(sev)].push(fn);\n return true;\n }", "function addFn(x, y) {\n return x + y;\n}", "async add(fn, options = {}) {\n return new Promise((resolve, reject) => {\n const run = async () => {\n this._pendingCount++;\n this._intervalCount++;\n\n try {\n const operation = this._timeout === undefined && options.timeout === undefined ? fn() : p_timeout_1.default(Promise.resolve(fn()), options.timeout === undefined ? this._timeout : options.timeout, () => {\n if (options.throwOnTimeout === undefined ? this._throwOnTimeout : options.throwOnTimeout) {\n reject(timeoutError);\n }\n\n return undefined;\n });\n resolve((await operation));\n } catch (error) {\n reject(error);\n }\n\n this._next();\n };\n\n this._queue.enqueue(run, options);\n\n this._tryToStartAnother();\n });\n }", "registerOnChange(fn) {\n this._onChange.push(fn);\n }", "function _add(...args) {\n\t\t\tsequences = addToSequence(sequences, (s) => cancellableTimeout(s, 1), ...args)\n\t\t\tinputSequence.push({type:'function', data:args})\n\t\t}", "addRoute(route, fn) {\n this.routes.push({\n params: this._getParams(route),\n pattern: this._getPattern(route),\n route,\n fn\n })\n }", "function add_applied_functions() {\n var ul = jQuery('#calcfuncsul');\n jQuery.each(functions_applied, function(i,e) {\n jQuery( \"<li data-id=\\\"\" + e + \"\\\" data-coltype=\\\"function\\\"></li>\" )\n .html( remove_me + ' ' +e )\n .appendTo( ul );\n });\n }", "function add_applied_functions() {\n var ul = jQuery('#calcfuncsul');\n jQuery.each(functions_applied, function(i,e) {\n jQuery( \"<li data-id=\\\"\" + e + \"\\\" data-coltype=\\\"function\\\"></li>\" )\n .html( remove_me + ' ' +e )\n .appendTo( ul );\n });\n }", "function addUserFunction(userFunctionEdn) {\n userFunctions.push(userFunctionEdn);\n}", "function addNodeListEventListener(list, event, fn) {\n for (let i = 0; i < list.length; i++) {\n list[i].addEventListener(event, fn);\n }\n\t}", "addOnQueueLoadCallback(fn) {\r\n this.onQueueLoadCallbacks.push(fn);\r\n }", "function newFunction(fn) {\n if (typeof fn.original === \"function\") fn = fn.original;\n var index = table.length;\n table.grow(1);\n table.set(index, fn);\n return index;\n }", "function add (type, config, fn) {\n var r = phoenix.registry[type]\n if (!r) r = phoenix.registry[type] = []\n if (typeof config == 'function') {\n fn = config\n config = {}\n }\n config.id = r.length\n r.push({ config: config, fn: fn })\n}", "function _add() {\n\t\t\tfor (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n\t\t\t\targs[_key] = arguments[_key];\n\t\t\t}\n\n\t\t\tsequences = addToSequence.apply(undefined, [sequences, function (s) {\n\t\t\t\treturn cancellableTimeout(s, 1);\n\t\t\t}].concat(args));\n\t\t\tinputSequence.push({ type: 'function', data: args });\n\t\t}", "function registerRunTimeFunction(fn) {\r\n\tif (isFunction(fn)) {\r\n\t\tif (typeof fn == 'object') {\r\n\t\t\trunTime = runTime.concat(fn);\r\n\t\t} else {\r\n\t\t\trunTime[runTime.length++] = fn;\r\n\t\t}\r\n\t}\r\n}", "function myFunction() {\n todo.forEach(task => {\n addtask(task);\n });\n}", "subscribe(fn) {\r\n if (fn) {\r\n this._subscriptions.push(this.createSubscription(fn, false));\r\n }\r\n return () => {\r\n this.unsubscribe(fn);\r\n };\r\n }", "function add_function() {\n var func = jQuery('#function_dropdown').val();\n if( func === '') {\n alert('No group by function chosen');\n return;\n }\n var col = jQuery('#columns_dropdown').val();\n var val;\n if(func === 'COUNT') {\n val = 'COUNT(*)';\n }\n else {\n if( col === '') {\n alert('Select a column for the function selected please');\n return;\n }\n val = func + '(' + col + ')';\n }\n if(functions_applied.indexOf(val) !== -1) {\n alert('This function has been already added');\n return;\n }\n\n functions_applied.push(val);\n var ul = jQuery('#calcfuncsul');\n jQuery( \"<li data-id=\\\"\" + val + \"\\\" data-coltype=\\\"function\\\"></li>\" )\n .html( remove_me + ' ' +val )\n .appendTo( ul );\n\n }", "function add_function() {\n var func = jQuery('#function_dropdown').val();\n if( func === '') {\n alert('No group by function chosen');\n return;\n }\n var col = jQuery('#columns_dropdown').val();\n var val;\n if(func === 'COUNT') {\n val = 'COUNT(*)';\n }\n else {\n if( col === '') {\n alert('Select a column for the function selected please');\n return;\n }\n val = func + '(' + col + ')';\n }\n if(functions_applied.indexOf(val) !== -1) {\n alert('This function has been already added');\n return;\n }\n\n functions_applied.push(val);\n var ul = jQuery('#calcfuncsul');\n jQuery( \"<li data-id=\\\"\" + val + \"\\\" data-coltype=\\\"function\\\"></li>\" )\n .html( remove_me + ' ' +val )\n .appendTo( ul );\n\n }", "function addTask(func){\n taskStack.push(func);\n tasksScanned++;\n}", "async addAll(functions, options) {\n return Promise.all(functions.map(async function_ => this.add(function_, options)));\n }", "function pushAdditional(fn) {\n\t var child = new this.constructor(this.client, this.tableCompiler, this.columnBuilder);\n\t fn.call(child, (0, _tail3.default)(arguments));\n\t this.sequence.additional = (this.sequence.additional || []).concat(child.sequence);\n\t}", "addOnItemErrorCallbacks(fn) {\r\n this.onItemErrorCallbacks.push(fn);\r\n }", "registerOnDisabledChange(fn) {\n this._onDisabledChange.push(fn);\n }", "registerOnDisabledChange(fn) {\n this._onDisabledChange.push(fn);\n }", "registerOnDisabledChange(fn) {\n this._onDisabledChange.push(fn);\n }", "registerOnDisabledChange(fn) {\n this._onDisabledChange.push(fn);\n }", "registerOnDisabledChange(fn) {\n this._onDisabledChange.push(fn);\n }", "registerOnDisabledChange(fn) {\n this._onDisabledChange.push(fn);\n }", "registerOnDisabledChange(fn) {\n this._onDisabledChange.push(fn);\n }", "async addAll(functions, options) {\n return Promise.all(functions.map(async (function_) => this.add(function_, options)));\n }", "async addAll(functions, options) {\n return Promise.all(functions.map(async (function_) => this.add(function_, options)));\n }", "function fn() {}", "add_filter(func, sev=\"ALL\") {\n if (!this._assert_sev(sev)) { return false; }\n this._filters[this._sev_value(sev)].push(func);\n }", "on(e, fn) {\n // After doing some research, I felt like a Set rather than an array would work better since it wouldnt allow duplicate function within a specific event. Basically this method is checking to see if the event already exists - and if it does it will add the function to that Set, otherwise create a new set where it contains the called function.\n\t\tif (this.events[e]) {\n\t\treturn this.event[e].add(fn);\n\t\t}\n\t\tthis.events[e] = new Set([fn]);\n\t}", "on(event, fn) {\n if (!this.eventMap[event]) {\n this.eventMap[event] = [];\n }\n\n this.eventMap[event].push(fn);\n return this\n }", "function add2(fn1, fn2) {\n return add(fn1(), fn2());\n}", "addToList() {\n list.push(this);\n }", "function add2(fn1, fn2) {\n return add(fn1(), fn2());\n}", "function add2(fn1, fn2) {\n return add(fn1(), fn2());\n}", "function addCallBackFunction(fn) {\n\t if(!_docReady) {\n\t _documentLoadedCallbacks.push(fn);\n\t }\n\t else {\n\t fn();\n\t }\n\t}", "function addCallBackFunction(fn) {\n if(!_docReady) {\n _documentLoadedCallbacks.push(fn);\n }\n else {\n fn();\n }\n}", "subscribe(fn) {\n if (fn) {\n this._subscriptions.push(this.createSubscription(fn, false));\n }\n\n return () => {\n this.unsubscribe(fn);\n };\n }", "add() {\n this.target.addEventListener(this.eventType, this.fn, false);\n }", "function add() { //add is returning function . that fuction is invoke\n return function() { \n console.log('returned function called')\n \n }\n\n}", "function addf(a) {\n return (b) => {\n return add(a, b);\n };\n}", "push(fn, onTimeout, timeout)\n {\n if (this.status !== SeqQueueManager.STATUS_IDLE && this.status !== SeqQueueManager.STATUS_BUSY)\n {\n // ignore invalid status\n return false;\n }\n\n if (typeof fn !== 'function')\n {\n throw new Error('fn should be a function.');\n }\n this.queue.push({\n fn : fn,\n ontimeout : onTimeout,\n timeout : timeout});\n\n if (this.status === SeqQueueManager.STATUS_IDLE)\n {\n this.status = SeqQueueManager.STATUS_BUSY;\n process.nextTick(this._next.bind(this), this.curId);\n }\n return true;\n }", "function on(eventName, fn) {\n events[eventName] = events[eventName] || [];\n events[eventName].push(fn);\n }", "function addf(x) {\n return function(y) {\n return add(x, y);\n };\n}", "function addFunctionWasm(func, sig) {\n var table = wasmTable;\n var ret = table.length;\n\n // Grow the table\n try {\n table.grow(1);\n } catch (err) {\n if (!(err instanceof RangeError)) {\n throw err;\n }\n throw 'Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH.';\n }\n\n // Insert new element\n try {\n // Attempting to call this with JS function will cause of table.set() to fail\n table.set(ret, func);\n } catch (err) {\n if (!(err instanceof TypeError)) {\n throw err;\n }\n assert(typeof sig !== 'undefined', 'Missing signature argument to addFunction');\n var wrapped = convertJsFunctionToWasm(func, sig);\n table.set(ret, wrapped);\n }\n\n return ret;\n}", "async addDomainMatchingFunc(fn) {\n this.hasDomainPattern = true;\n this.domainMatchingFunc = fn;\n }", "addOnAfterItemLoadCallback(fn) {\r\n this.onAfterItemLoadCallbacks.push(fn);\r\n }", "function addFunction(func, sig) {\n\n return addFunctionWasm(func, sig);\n}", "function addFunction(func, sig) {\n assert(typeof func !== 'undefined');\n\n return addFunctionWasm(func, sig);\n}", "function addFunction(func, sig) {\n assert(typeof func !== 'undefined');\n\n return addFunctionWasm(func, sig);\n}", "function addFunctionWasm(func, sig) {\n var table = wasmTable;\n var ret = table.length;\n\n // Grow the table\n try {\n table.grow(1);\n } catch (err) {\n if (!err instanceof RangeError) {\n throw err;\n }\n throw 'Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH.';\n }\n\n // Insert new element\n try {\n // Attempting to call this with JS function will cause of table.set() to fail\n table.set(ret, func);\n } catch (err) {\n if (!err instanceof TypeError) {\n throw err;\n }\n assert(typeof sig !== 'undefined', 'Missing signature argument to addFunction');\n var wrapped = convertJsFunctionToWasm(func, sig);\n table.set(ret, wrapped);\n }\n\n return ret;\n}", "function addFunctionWasm(func, sig) {\n var table = wasmTable;\n var ret = table.length;\n\n // Grow the table\n try {\n table.grow(1);\n } catch (err) {\n if (!err instanceof RangeError) {\n throw err;\n }\n throw 'Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH.';\n }\n\n // Insert new element\n try {\n // Attempting to call this with JS function will cause of table.set() to fail\n table.set(ret, func);\n } catch (err) {\n if (!err instanceof TypeError) {\n throw err;\n }\n assert(typeof sig !== 'undefined', 'Missing signature argument to addFunction');\n var wrapped = convertJsFunctionToWasm(func, sig);\n table.set(ret, wrapped);\n }\n\n return ret;\n}", "addOnBeforeItemLoadCallback(fn) {\r\n this.onBeforeItemLoadCallbacks.push(fn);\r\n }", "onAddButtonClick(fn) { this.onAddButtonClickFn = fn }", "function addFunction(func, sig) {\n if (typeof sig === 'undefined') {\n err('warning: addFunction(): You should provide a wasm function signature string as a second argument. This is not necessary for asm.js and asm2wasm, but is required for the LLVM wasm backend, so it is recommended for full portability.');\n }\n var base = 0;\n for (var i = base; i < base + 0; i++) {\n if (!functionPointers[i]) {\n functionPointers[i] = func;\n return jsCallStartIndex + i;\n }\n }\n throw 'Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.';\n}", "function addFunction(func, sig) {\n if (typeof sig === 'undefined') {\n err('warning: addFunction(): You should provide a wasm function signature string as a second argument. This is not necessary for asm.js and asm2wasm, but is required for the LLVM wasm backend, so it is recommended for full portability.');\n }\n var base = 0;\n for (var i = base; i < base + 0; i++) {\n if (!functionPointers[i]) {\n functionPointers[i] = func;\n return jsCallStartIndex + i;\n }\n }\n throw 'Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.';\n}", "function addFunction(func, sig) {\n if (typeof sig === 'undefined') {\n err('warning: addFunction(): You should provide a wasm function signature string as a second argument. This is not necessary for asm.js and asm2wasm, but is required for the LLVM wasm backend, so it is recommended for full portability.');\n }\n var base = 0;\n for (var i = base; i < base + 0; i++) {\n if (!functionPointers[i]) {\n functionPointers[i] = func;\n return jsCallStartIndex + i;\n }\n }\n throw 'Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.';\n}", "function addFunction(func, sig) {\n if (typeof sig === 'undefined') {\n err('warning: addFunction(): You should provide a wasm function signature string as a second argument. This is not necessary for asm.js and asm2wasm, but is required for the LLVM wasm backend, so it is recommended for full portability.');\n }\n var base = 0;\n for (var i = base; i < base + 0; i++) {\n if (!functionPointers[i]) {\n functionPointers[i] = func;\n return jsCallStartIndex + i;\n }\n }\n throw 'Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.';\n}", "function addTaskToList(task, list){\r\n //What is the task? @parameter task\r\n //Where is the task going? @List Parameter\r\n //What order / priority? lowest on the bottom(push)\r\n return list.push({\r\n text: task, completed: false\r\n });\r\n}", "function addPlugin(useLevel, fn) {\n var pluginFn = fn;\n if (typeof fn === 'undefined' && typeof useLevel === 'function') {\n pluginFn = useLevel;\n }\n\n if (typeof pluginFn !== 'function') {\n throw new Error('Plugin must be a function!');\n }\n\n if (typeof useLevel === 'string') {\n pluginFn = function pluginFn(id, level, stats) {\n for (var _len10 = arguments.length, rest = Array(_len10 > 3 ? _len10 - 3 : 0), _key10 = 3; _key10 < _len10; _key10++) {\n rest[_key10 - 3] = arguments[_key10];\n }\n\n if (level === useLevel.toUpperCase()) {\n return fn.apply(undefined, [id, level, stats].concat(rest));\n }\n return [id, level, stats].concat(rest);\n };\n }\n\n plugins.push(pluginFn);\n}", "function addFunction(func, sig) {\n if (typeof sig === 'undefined') {\n err('warning: addFunction(): You should provide a wasm function signature string as a second argument. This is not necessary for asm.js and asm2wasm, but can be required for the LLVM wasm backend, so it is recommended for full portability.');\n }\n\n\n var base = 0;\n for (var i = base; i < base + 0; i++) {\n if (!functionPointers[i]) {\n functionPointers[i] = func;\n return jsCallStartIndex + i;\n }\n }\n throw 'Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.';\n\n}", "function add() {\n const result = [];\n return function () {\n if (arguments.length === 0) {\n return result.reduce(function (a, b) {\n return a + b;\n }, 0);\n }\n [].push.apply(result, [].slice.call(arguments));\n return arguments.callee;\n }\n }", "function on(eventName, fn) {\n events[eventName] = events[eventName] || [];\n events[eventName].push(fn);\n }", "function on(eventName, fn) {\n events[eventName] = events[eventName] || [];\n events[eventName].push(fn);\n }", "addMatchingFunc(name, fn) {\n return __awaiter(this, void 0, void 0, function* () {\n this.hasPattern = true;\n this.matchingFunc = fn;\n });\n }", "addFunctionToTag(mcfunction, tag, index) {\n const { namespace, fullPath, name } = this.getResourcePath(tag);\n const tickResource = this.resources.getOrAddResource('tags', {\n children: new Map(),\n isResource: true,\n path: [namespace, 'functions', ...fullPath],\n values: [],\n replace: false,\n });\n const { fullName } = this.getResourcePath(mcfunction);\n if (index === undefined) {\n tickResource.values.push(fullName);\n }\n else {\n // Insert at given index\n tickResource.values.splice(index, 0, fullName);\n }\n }" ]
[ "0.6937784", "0.6697556", "0.62223893", "0.620402", "0.6063277", "0.60530466", "0.5974585", "0.5911953", "0.58088225", "0.58088225", "0.58088225", "0.58088225", "0.58088225", "0.58088225", "0.58088225", "0.5778424", "0.5762916", "0.5737459", "0.5720332", "0.5718001", "0.5672124", "0.5666833", "0.5663375", "0.5605407", "0.5602217", "0.55970204", "0.55892384", "0.5588086", "0.5586157", "0.5586157", "0.5559502", "0.5545901", "0.5544199", "0.5538798", "0.5508734", "0.5500451", "0.54927933", "0.5489467", "0.5488821", "0.5484819", "0.5484819", "0.54818195", "0.5475381", "0.5458319", "0.5446061", "0.54359615", "0.54359615", "0.54359615", "0.54359615", "0.54359615", "0.54359615", "0.54359615", "0.54264194", "0.54264194", "0.5414365", "0.5374358", "0.53727466", "0.536652", "0.5363049", "0.53548044", "0.535026", "0.535026", "0.5348206", "0.5347447", "0.53394186", "0.5337314", "0.5317818", "0.5311049", "0.5303614", "0.5298687", "0.52953064", "0.528681", "0.52821267", "0.52820826", "0.52815926", "0.5277101", "0.5277101", "0.5274905", "0.5274905", "0.52596873", "0.525675", "0.52538264", "0.52538264", "0.52538264", "0.52538264", "0.52529156", "0.52520514", "0.5251482", "0.5251126", "0.5249218", "0.5249218", "0.52372843", "0.5232451" ]
0.5733852
23
Wrap `fn`. Can be sync or async; return a promise, receive a completion handler, return new values and errors.
function wrap(fn, callback) { var invoked return wrapped function wrapped() { var params = slice.call(arguments, 0) var callback = fn.length > params.length var result if (callback) { params.push(done) } try { result = fn.apply(null, params) } catch (err) { /* Well, this is quite the pickle. `fn` received * a callback and invoked it (thus continuing the * pipeline), but later also threw an error. * We’re not about to restart the pipeline again, * so the only thing left to do is to throw the * thing instea. */ if (callback && invoked) { throw err } return done(err) } if (!callback) { if (result && typeof result.then === 'function') { result.then(then, done) } else if (result instanceof Error) { done(result) } else { then(result) } } } /* Invoke `next`, only once. */ function done() { if (!invoked) { invoked = true callback.apply(null, arguments) } } /* Invoke `done` with one value. * Tracks if an error is passed, too. */ function then(value) { done(null, value) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wrap_sync (fn) {\n return function (params) {\n var val = fn(params)\n if (val && !isPromise(val)) throw val\n return val\n }\n}", "async function thenify(fn) {\n return await new Promise(function(resolve, reject) {\n function callback(err, res) {\n if (err) return reject(err);\n return resolve(res);\n }\n\n fn(callback);\n });\n}", "function wrapFunction(func, args) {\n return new Promise((resolve, reject) => {\n func(args, (success) => resolve(success), (error) => reject(error))\n })\n}", "function wrap(fn){\n\treturn Q().then(fn);\n}", "function wrap (fn) {\n\n\t\treturn function wrapper () {\n\n\t\t\treturn new Promise((res, rej) => {\n\n\t\t\t\tif (!db) {\n\t\t\t\t\trej('Database not open.');\n\t\t\t\t}\n\n\t\t\t\tfn(res, rej, ...arguments);\n\n\t\t\t});\n\n\t\t};\n\n\t}", "function promisify(fn) {\n var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n\n var boundFn = fn.bind(context);\n\n return function (data) {\n return new Promise(function (resolve, reject) {\n boundFn(data, function (err, resp) {\n if (err) {\n reject(err);\n } else {\n resolve(resp);\n }\n });\n });\n };\n}", "function promise(fn) {\n return new Promise(fn);\n }", "function wrap (fn) {\n var res\n\n // create anonymous resource\n if (asyncHooks.AsyncResource) {\n res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')\n }\n\n // incompatible node.js\n if (!res || !res.runInAsyncScope) {\n return fn\n }\n\n // return bound function\n return res.runInAsyncScope.bind(res, fn, null)\n}", "function wrap (fn) {\n var res\n\n // create anonymous resource\n if (asyncHooks.AsyncResource) {\n res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')\n }\n\n // incompatible node.js\n if (!res || !res.runInAsyncScope) {\n return fn\n }\n\n // return bound function\n return res.runInAsyncScope.bind(res, fn, null)\n}", "function wrapInPromise(func){\r\n var promise = new Promise((resolve, reject) => {\r\n resolve(func);\r\n });\r\n return promise;\r\n}", "function asPromised(fn) {\n const promiseWrappedHandler = Promise.method(fn);\n return function (msg, cb) {\n return promiseWrappedHandler.call(this, msg).catch(function (err) {\n console.error('io call error for msg=' + msg + ':\\n\\t' + (err.stack ? err.stack : err));\n return Promise.reject(err instanceof Error ? err.message : err);\n }).asCallback(cb);\n };\n}", "function wrap(fn, callback) {\n var invoked\n\n return wrapped\n\n function wrapped() {\n var params = slice.call(arguments, 0)\n var callback = fn.length > params.length\n var result\n\n if (callback) {\n params.push(done)\n }\n\n try {\n result = fn.apply(null, params)\n } catch (error) {\n // Well, this is quite the pickle.\n // `fn` received a callback and invoked it (thus continuing the pipeline),\n // but later also threw an error.\n // We’re not about to restart the pipeline again, so the only thing left\n // to do is to throw the thing instead.\n if (callback && invoked) {\n throw error\n }\n\n return done(error)\n }\n\n if (!callback) {\n if (result && typeof result.then === 'function') {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n // Invoke `next`, only once.\n function done() {\n if (!invoked) {\n invoked = true\n\n callback.apply(null, arguments)\n }\n }\n\n // Invoke `done` with one value.\n // Tracks if an error is passed, too.\n function then(value) {\n done(null, value)\n }\n}", "function wrap(fn, callback) {\n var invoked\n\n return wrapped\n\n function wrapped() {\n var params = slice.call(arguments, 0)\n var callback = fn.length > params.length\n var result\n\n if (callback) {\n params.push(done)\n }\n\n try {\n result = fn.apply(null, params)\n } catch (error) {\n // Well, this is quite the pickle.\n // `fn` received a callback and invoked it (thus continuing the pipeline),\n // but later also threw an error.\n // We’re not about to restart the pipeline again, so the only thing left\n // to do is to throw the thing instead.\n if (callback && invoked) {\n throw error\n }\n\n return done(error)\n }\n\n if (!callback) {\n if (result && typeof result.then === 'function') {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n // Invoke `next`, only once.\n function done() {\n if (!invoked) {\n invoked = true\n\n callback.apply(null, arguments)\n }\n }\n\n // Invoke `done` with one value.\n // Tracks if an error is passed, too.\n function then(value) {\n done(null, value)\n }\n}", "function wrap(fn, callback) {\n var invoked\n\n return wrapped\n\n function wrapped() {\n var params = slice.call(arguments, 0)\n var callback = fn.length > params.length\n var result\n\n if (callback) {\n params.push(done)\n }\n\n try {\n result = fn.apply(null, params)\n } catch (error) {\n // Well, this is quite the pickle.\n // `fn` received a callback and invoked it (thus continuing the pipeline),\n // but later also threw an error.\n // We’re not about to restart the pipeline again, so the only thing left\n // to do is to throw the thing instead.\n if (callback && invoked) {\n throw error\n }\n\n return done(error)\n }\n\n if (!callback) {\n if (result && typeof result.then === 'function') {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n // Invoke `next`, only once.\n function done() {\n if (!invoked) {\n invoked = true\n\n callback.apply(null, arguments)\n }\n }\n\n // Invoke `done` with one value.\n // Tracks if an error is passed, too.\n function then(value) {\n done(null, value)\n }\n}", "function wrap(fn, callback) {\n var invoked\n\n return wrapped\n\n function wrapped() {\n var params = slice.call(arguments, 0)\n var callback = fn.length > params.length\n var result\n\n if (callback) {\n params.push(done)\n }\n\n try {\n result = fn.apply(null, params)\n } catch (error) {\n // Well, this is quite the pickle.\n // `fn` received a callback and invoked it (thus continuing the pipeline),\n // but later also threw an error.\n // We’re not about to restart the pipeline again, so the only thing left\n // to do is to throw the thing instead.\n if (callback && invoked) {\n throw error\n }\n\n return done(error)\n }\n\n if (!callback) {\n if (result && typeof result.then === 'function') {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n // Invoke `next`, only once.\n function done() {\n if (!invoked) {\n invoked = true\n\n callback.apply(null, arguments)\n }\n }\n\n // Invoke `done` with one value.\n // Tracks if an error is passed, too.\n function then(value) {\n done(null, value)\n }\n}", "function wrap(fn, callback) {\n var invoked\n\n return wrapped\n\n function wrapped() {\n var params = slice.call(arguments, 0)\n var callback = fn.length > params.length\n var result\n\n if (callback) {\n params.push(done)\n }\n\n try {\n result = fn.apply(null, params)\n } catch (error) {\n // Well, this is quite the pickle.\n // `fn` received a callback and invoked it (thus continuing the pipeline),\n // but later also threw an error.\n // We’re not about to restart the pipeline again, so the only thing left\n // to do is to throw the thing instead.\n if (callback && invoked) {\n throw error\n }\n\n return done(error)\n }\n\n if (!callback) {\n if (result && typeof result.then === 'function') {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n // Invoke `next`, only once.\n function done() {\n if (!invoked) {\n invoked = true\n\n callback.apply(null, arguments)\n }\n }\n\n // Invoke `done` with one value.\n // Tracks if an error is passed, too.\n function then(value) {\n done(null, value)\n }\n}", "function wrap(fn, callback) {\n var invoked\n\n return wrapped\n\n function wrapped() {\n var params = slice.call(arguments, 0)\n var callback = fn.length > params.length\n var result\n\n if (callback) {\n params.push(done)\n }\n\n try {\n result = fn.apply(null, params)\n } catch (error) {\n // Well, this is quite the pickle.\n // `fn` received a callback and invoked it (thus continuing the pipeline),\n // but later also threw an error.\n // We’re not about to restart the pipeline again, so the only thing left\n // to do is to throw the thing instead.\n if (callback && invoked) {\n throw error\n }\n\n return done(error)\n }\n\n if (!callback) {\n if (result && typeof result.then === 'function') {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n // Invoke `next`, only once.\n function done() {\n if (!invoked) {\n invoked = true\n\n callback.apply(null, arguments)\n }\n }\n\n // Invoke `done` with one value.\n // Tracks if an error is passed, too.\n function then(value) {\n done(null, value)\n }\n}", "function isolate(fn, val) {\n var value, lastPromise;\n\n // Reset lastPromise for nested helpers\n Test.lastPromise = null;\n\n value = fn(val);\n\n lastPromise = Test.lastPromise;\n Test.lastPromise = null;\n\n // If the method returned a promise\n // return that promise. If not,\n // return the last async helper's promise\n if (value && value instanceof Test.Promise || !lastPromise) {\n return value;\n } else {\n return run(function () {\n return Test.resolve(lastPromise).then(function () {\n return value;\n });\n });\n }\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 promisify(fn) {\n return () => {\n const { client } = this;\n const args = Array.prototype.slice.call(arguments);\n\n return new Promise((resolve, reject) => {\n args.push((err, result) => {\n if (err) reject(err);\n else resolve(result);\n });\n\n client[fn](...args);\n });\n };\n}", "function wrap(func) {\n return _.wrap(func, function(_func) {\n var args = Array.prototype.slice.call(arguments, 1);\n return Q()\n .then(function() {\n return _func.apply(null, args);\n });\n });\n}", "function promisify(fn) {\n return function(...args) {\n return new Promise( function(resolve, reject) {\n function cb(result) {\n resolve(result)\n }\n\n fn.apply(this, args.concat(cb))\n })\n }\n }", "function async(fn, onError) {\n\t return function () {\n\t var args = [];\n\t for (var _i = 0; _i < arguments.length; _i++) {\n\t args[_i] = arguments[_i];\n\t }\n\t _promise.PromiseImpl.resolve(true).then(function () {\n\t fn.apply(void 0, args);\n\t }).catch(function (error) {\n\t if (onError) {\n\t onError(error);\n\t }\n\t });\n\t };\n\t}", "function promisifyIt(originalFn, env) {\n return function (specName, fn, timeout) {\n if (!fn) {\n const spec = originalFn.call(env, specName);\n spec.pend('not implemented');\n return spec;\n }\n\n const hasDoneCallback = fn.length > 0;\n\n if (hasDoneCallback) {\n return originalFn.call(env, specName, fn, timeout);\n }\n\n const asyncFn = function (done) {\n const returnValue = fn.call({});\n\n if (isPromise(returnValue)) {\n returnValue.then(done, done.fail);\n } else if (returnValue === undefined) {\n done();\n } else {\n done.fail(\n new Error(\n 'Jest: `it` and `test` must return either a Promise or undefined.'));\n\n\n }\n };\n\n return originalFn.call(env, specName, asyncFn, timeout);\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n _promise.PromiseImpl.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n _promise.PromiseImpl.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n LocalPromise.resolve(true).then(function () {\n fn.apply(undefined, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n LocalPromise.resolve(true).then(function () {\n fn.apply(undefined, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function asyncHandler(fn) {\n return function(req, res, next) {\n return Promise.resolve(fn(req, res, next).catch(next));\n };\n}", "function promisify(fn) {\n //it must return a function\n //to let defer the execution\n return function() {\n //we need the arguments to feed fn when the time comes\n let args = Array.from(arguments);\n\n //we must return a Promise\n //because this is a promisification\n return new Promise(function(resolve, reject) {\n //call the callback-based function and let be notified\n //when it's finished\n //'this' belongs to the function call,\n //therefore it must be set explicitly.\n fn.call(null, ...args, (err, value) => {\n if (err) {\n reject(err);\n } else {\n resolve(value);\n }\n });\n });\n };\n}", "function async(fn, onError) {\r\n return (...args) => {\r\n Promise.resolve(true)\r\n .then(() => {\r\n fn(...args);\r\n })\r\n .catch((error) => {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { var callNext = step.bind(null, 'next'); var callThrow = step.bind(null, 'throw'); function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(callNext, callThrow); } } callNext(); }); }; }", "function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { var callNext = step.bind(null, 'next'); var callThrow = step.bind(null, 'throw'); function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(callNext, callThrow); } } callNext(); }); }; }", "function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { var callNext = step.bind(null, 'next'); var callThrow = step.bind(null, 'throw'); function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(callNext, callThrow); } } callNext(); }); }; }", "function asynchronous(fn) {\n return function (done) {\n var returnValue = fn.call(this, done);\n returnValue\n .then(function () {\n done();\n })\n .catch(function (err) {\n done.fail(err);\n });\n $rootScope.$apply();\n return returnValue;\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n Promise.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true)\n .then(function () {\n fn.apply(void 0, args);\n })\n .catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "function async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function wrap(fn) {\n return helpers.wrap(fn)();\n}", "function async(fn, onError) {\n return function () {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n Promise.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n }", "function wrap$3(fn, callback) {\n var invoked;\n\n return wrapped\n\n function wrapped() {\n var params = slice$4.call(arguments, 0);\n var callback = fn.length > params.length;\n var result;\n\n if (callback) {\n params.push(done);\n }\n\n try {\n result = fn.apply(null, params);\n } catch (error) {\n // Well, this is quite the pickle.\n // `fn` received a callback and invoked it (thus continuing the pipeline),\n // but later also threw an error.\n // We’re not about to restart the pipeline again, so the only thing left\n // to do is to throw the thing instead.\n if (callback && invoked) {\n throw error\n }\n\n return done(error)\n }\n\n if (!callback) {\n if (result && typeof result.then === 'function') {\n result.then(then, done);\n } else if (result instanceof Error) {\n done(result);\n } else {\n then(result);\n }\n }\n }\n\n // Invoke `next`, only once.\n function done() {\n if (!invoked) {\n invoked = true;\n\n callback.apply(null, arguments);\n }\n }\n\n // Invoke `done` with one value.\n // Tracks if an error is passed, too.\n function then(value) {\n done(null, value);\n }\n}", "function wrap(fn) {\n\n return function () {\n try {\n return fn.apply(this, arguments);\n }\n catch (err) {\n log(err);\n }\n };\n}", "function wrap_cb (fn, P) {\n return function (params) {\n return new P(function (resolve, reject) {\n fn(params, function (err) { return !err ? resolve() : reject(err) })\n })\n }\n}", "function wrap(funct) {\n return function () {\n // return objects and throw errors\n var outcome = funct.apply(null, arguments).wait();\n if (outcome instanceof Error) {\n throw outcome;\n } else {\n return outcome;\n }\n };\n}", "function wrap(fn) {\n return function(cb) { fn.call(null, cb.bind(null, null)); };\n }", "function wrapInPromiseAsync(asyncFunc){\r\n var promise = new Promise(async((resolve, reject) => {\r\n resolve(await(asyncFunc()));\r\n }));\r\n return promise;\r\n}", "function promisifyLifeCycleFunction(originalFn, env) {return function (fn, timeout) {if (!fn) {return originalFn.call(env);}const hasDoneCallback = fn.length > 0;if (hasDoneCallback) {// Jasmine will handle it\n return originalFn.call(env, fn, timeout);\n }\n\n // We make *all* functions async and run `done` right away if they\n // didn't return a promise.\n const asyncFn = function (done) {\n const returnValue = fn.call({});\n\n if (isPromise(returnValue)) {\n returnValue.then(done, done.fail);\n } else {\n done();\n }\n };\n\n return originalFn.call(env, asyncFn, timeout);\n };\n}", "function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step(\"next\", value); }, function (err) { step(\"throw\", err); }); } } return step(\"next\"); }); }; }", "function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step(\"next\", value); }, function (err) { step(\"throw\", err); }); } } return step(\"next\"); }); }; }", "function ProgressivePromise(fn) {\n\tif (typeof Promise !== \"function\") {\n\t\tthrow new Error(\"Promise implementation not available in this environment.\");\n\t}\n\n\tvar progressCallbacks = [];\n\tvar progressHistory = [];\n\n\tfunction doProgress(value) {\n\t\tfor (var i = 0, l = progressCallbacks.length; i < l; ++i) {\n\t\t\tprogressCallbacks[i](value);\n\t\t}\n\n\t\tprogressHistory.push(value);\n\t}\n\n\tvar promise = new Promise(function(resolve, reject) {\n\t\tfn(resolve, reject, doProgress);\n\t});\n\n\tpromise.progress = function(cb) {\n\t\tif (typeof cb !== \"function\") {\n\t\t\tthrow new Error(\"cb is not a function.\");\n\t\t}\n\n\t\t// Report the previous progress history\n\t\tfor (var i = 0, l = progressHistory.length; i < l; ++i) {\n\t\t\tcb(progressHistory[i]);\n\t\t}\n\n\t\tprogressCallbacks.push(cb);\n\t\treturn promise;\n\t};\n\n\tvar origThen = promise.then;\n\n\tpromise.then = function(onSuccess, onFail, onProgress) {\n\t\torigThen.call(promise, onSuccess, onFail);\n\n\t\tif (onProgress !== undefined) {\n\t\t\tpromise.progress(onProgress);\n\t\t}\n\n\t\treturn promise;\n\t};\n\n\treturn promise;\n}", "function doResolve(fn, promise) {\n\t var done = false;\n\t var res = tryCallTwo(fn, function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(promise, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(promise, reason);\n\t })\n\t if (!done && res === IS_ERROR) {\n\t done = true;\n\t reject(promise, LAST_ERROR);\n\t }\n\t}", "function doResolve(fn, promise) {\n\t var done = false;\n\t var res = tryCallTwo(fn, function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(promise, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(promise, reason);\n\t })\n\t if (!done && res === IS_ERROR) {\n\t done = true;\n\t reject(promise, LAST_ERROR);\n\t }\n\t}", "function doResolve(fn, promise) {\n\t var done = false;\n\t var res = tryCallTwo(fn, function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(promise, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(promise, reason);\n\t })\n\t if (!done && res === IS_ERROR) {\n\t done = true;\n\t reject(promise, LAST_ERROR);\n\t }\n\t}", "function doResolve(fn, promise) {\n\t var done = false;\n\t var res = tryCallTwo(fn, function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(promise, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(promise, reason);\n\t })\n\t if (!done && res === IS_ERROR) {\n\t done = true;\n\t reject(promise, LAST_ERROR);\n\t }\n\t}", "function doResolve(fn, promise) {\n\t var done = false;\n\t var res = tryCallTwo(fn, function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(promise, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(promise, reason);\n\t })\n\t if (!done && res === IS_ERROR) {\n\t done = true;\n\t reject(promise, LAST_ERROR);\n\t }\n\t}", "function doResolve(fn, promise) {\n\t var done = false;\n\t var res = tryCallTwo(fn, function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(promise, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(promise, reason);\n\t })\n\t if (!done && res === IS_ERROR) {\n\t done = true;\n\t reject(promise, LAST_ERROR);\n\t }\n\t}", "function doResolve(fn, promise) {\n\t var done = false;\n\t var res = tryCallTwo(fn, function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(promise, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(promise, reason);\n\t })\n\t if (!done && res === IS_ERROR) {\n\t done = true;\n\t reject(promise, LAST_ERROR);\n\t }\n\t}", "function doRunAsync(fn, ...args) {\n if (fn.length === args.length + 1) { //expects callback\n let executed,\n executedErr,\n reject = err => {\n executedErr = err;\n },\n resolve = () => {\n };\n \n const callback = err => {\n if (executed)\n return;\n executed = true;\n\n if (err)\n reject(err);\n else\n resolve();\n };\n \n let result;\n switch (args.length) {\n case 0:\n result = fn(callback);\n break;\n \n case 1:\n result = fn(args[0], callback);\n break;\n \n case 2:\n result = fn(args[0], args[1], callback);\n break;\n \n default:\n throw new Error(`missing support for ${args.length} args`);\n }\n \n if (executed) { //callback was executed synchronously\n if (executedErr)\n throw executedErr;\n \n return result;\n \n } else { //callback was not executed synchronously, so it must be asynchronous\n return new Bluebird((...args2) => {\n resolve = args2[0];\n reject = args2[1];\n });\n }\n }\n \n //no callback, so either synchronous or returns a Promise\n switch (args.length) {\n case 0:\n return fn();\n \n case 1:\n return fn(args[0]);\n \n case 2:\n return fn(args[0], args[1]);\n \n default:\n throw new Error(`missing support for ${args.length} args`);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}" ]
[ "0.75723845", "0.6946835", "0.6856506", "0.68295383", "0.6647942", "0.65730035", "0.6559632", "0.6465274", "0.6465274", "0.64327705", "0.63656604", "0.6305889", "0.6305889", "0.6305889", "0.6305889", "0.6305889", "0.6305889", "0.62676936", "0.6259724", "0.625207", "0.6248762", "0.6210185", "0.6200413", "0.61999047", "0.61873686", "0.61873686", "0.6155672", "0.6155672", "0.61478204", "0.60933566", "0.6078278", "0.60126334", "0.60126334", "0.60126334", "0.6012506", "0.59983855", "0.5987777", "0.5987777", "0.5987777", "0.5987777", "0.5987777", "0.5987777", "0.5987777", "0.5987777", "0.5987777", "0.5987777", "0.5987777", "0.5987777", "0.5987777", "0.5987777", "0.5987777", "0.5987777", "0.59812856", "0.59812856", "0.59812856", "0.59812856", "0.59812856", "0.59812856", "0.59812856", "0.59812856", "0.59812856", "0.5968556", "0.5968556", "0.5967385", "0.59637207", "0.59565055", "0.59112364", "0.5900786", "0.5870248", "0.5843128", "0.58379126", "0.58319753", "0.5793898", "0.5793898", "0.5778419", "0.5762579", "0.5762579", "0.5762579", "0.5762579", "0.5762579", "0.5762579", "0.5762579", "0.5761057", "0.57557374", "0.57557374", "0.57557374", "0.57557374", "0.57557374", "0.57557374", "0.57557374", "0.57557374", "0.57557374", "0.57557374", "0.57557374", "0.57557374", "0.57557374", "0.57557374", "0.57557374", "0.57557374" ]
0.6257096
20
Invoke `next`, only once.
function done() { if (!invoked) { invoked = true callback.apply(null, arguments) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "next () {}", "next() {}", "next() {\n this._next();\n }", "Next() {}", "function next() {\n subject = context.stack.tail.head;\n index = 0;\n test( subject );\n }", "async next() {\n this._executing = false;\n await this._execute();\n }", "function _next() {\n\t\tif (queue.length > 0) {\n\t\t\tvar info = queue.shift();\n\t\t\t_getData(info.url, info.callback);\n\t\t} else {\n\t\t\tpaused = true;\n\t\t}\n\t}", "async next () {\n callTimes.push(Date.now() - startTime); // Record the time that next() was called\n await delay(100); // Each call to next() takes 100ms to resolve\n\n if (--this.length < 0) {\n return { done: true };\n }\n else {\n return { value: \"A\" };\n }\n }", "function next()\n {\n if(execute_index<execute_1by1.length)\n {\n execute_1by1[execute_index++].call(null, req, res, next);\n //execute_index+1 shouldn't do after call, because it's recursive call\n }\n }", "function cautiousNext() {\n depth++;\n if (depth > 100) {\n depth = 0;\n setImmediate(next);\n } else {\n next();\n }\n }", "function handleOneNext(prevResult = null){\n try{\n let yielded = genObj.next(prevResult);\n if (yielded.done){\n if (yielded.value !== undefined){\n callbacks.success(yielded.value);\n }\n }else{\n setTimeout(runYieldedValue, 0, yielded.value)\n }\n }\n catch(error){\n if(callbacks){\n callbacks.failure(error)\n }else{\n throw error;\n }\n }\n }", "function next() {\n\t\t\t\tif (eventIDs.length) {\n\t\t\t\t\tsetTimeout(process, 1000);\n\t\t\t\t}\n\t\t\t}", "function next() {\n\t\t\t\tif (eventIDs.length) {\n\t\t\t\t\tsetTimeout(process, 1000);\n\t\t\t\t}\n\t\t\t}", "function handleOneNext() {\n var prevResult = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];\n\n try {\n var yielded = genObj.next(prevResult); // may throw\n if (yielded.done) {\n if (yielded.value !== undefined) {\n // Something was explicitly returned:\n // Report the value as a result to the caller\n callbacks.success(yielded.value);\n }\n } else {\n setTimeout(runYieldedValue, 0, yielded.value);\n }\n }\n // Catch unforeseen errors in genObj\n catch (error) {\n if (callbacks) {\n callbacks.failure(error);\n } else {\n throw error;\n }\n }\n }", "async next() {\n return iter.next();\n }", "async next() {\n return iter.next();\n }", "function fx_run_next(fx) {\n var chain = fx.ch, next = chain.shift();\n if ((next = chain[0])) {\n next[1].$ch = true;\n next[1].start.apply(next[1], next[0]);\n }\n}", "function next() {\n setValue(()=>{\n return checkValue(value+1)\n })\n }", "function intGoNext(){\n goNext(0);\n }", "function next() {\n\t\t\treturn go(current+1);\n\t\t}", "function next() {\n if (!events.hasNext()) {\n log('done');\n return;\n }\n const event = events.next();\n event.getAcl().done(function(acl) {\n const changesMade = acl.duplicateRules(rolePattern, roleReplace);\n if (changesMade) {\n // Store changes if there are changes\n event.setAcl(acl).done(function() {\n event.republishMetadata().done(function() {\n setTimeout(next, REPUBLISH_SCHEDULE_DELAY);\n }).fail(function() {\n // Oh no! (republishMetadata)\n next();\n });\n }).fail(function() {\n // Oh no! (setAcl)\n next();\n });\n } else {\n next();\n }\n }).fail(function() {\n // Oh no! (getAcl)\n next();\n });\n }", "function next(){\n if(!debug){_next()};\n}", "next() {\n this.updateTaskRunning();\n const next = this.queue.shift();\n next === null || next === void 0 ? void 0 : next.start();\n }", "next() {\n this.current = this.queue.shift();\n this.start();\n }", "_next() {\n if (this._stopped) return;\n\n if (this.tasks.length > 0) {\n this.__next.run();\n } else {\n this._complete();\n }\n }", "function next(...args) {\n\t\t// if the next function has been defined\n\t\tif (typeof utils.queue[utils.i + 1] !== 'undefined') {\n\t\t\targs.unshift(next);\n\t\t\tutils.i++;\n\t\t\treturn utils.queue[utils.i](...args);\n\t\t}\n\n\t\t// if there are no more function, next will re-init fang group\n\t\treturn init(args);\n\t}", "function next(cb, name) {\n setTimeout(cb, 0);\n return 0;\n}", "function next() {\n var tok = current;\n current = null;\n return tok || read_next();\n }", "function next() {\n\t\tactiveThreads--;\n\t\tif (tasks && tasks.length > 0) {\n\t\t\ttasks.shift()();\n\t\t}\n\t}", "function next(value) {\n /* jshint validthis:true */\n if (!this._isDisposed) {\n this._subject.next(value);\n }\n}", "function next(state) {\n state.index++;\n }", "function next(state) {\n state.index++;\n }", "next() {\n let item = this.rbIter.data();\n\n if (item) {\n let ret = {\n value: item,\n done: false\n };\n\n this.rbIter[this.nextFunc]();\n\n return ret;\n } else {\n return {\n done: true\n }\n }\n }", "next() {\n if (this.cache.get(this.id) !== null) {\n this.id++;\n }\n }", "async function handleNext() {\n setCounter(counter + 1);\n }", "function next(o, a) {\n\t\t\tvar func = funcs.shift();\n\t\t\tif (func){\n\t\t\t\to.next = next;\n\t\t\t\tfunc(o, a);\n\t\t\t}\n\t\t}", "function next(){\n console.log(\"\\n\\n fetch next ...\");\n if( !debug ){_next();}\n}", "function next(ctx) {\r\n ctx.current++\r\n if (ctx.current < ctx.mds.length) {\r\n\r\n ctx.mds[ctx.current](ctx,next)\r\n\r\n }\r\n else {\r\n ctx.f(ctx)\r\n }\r\n}", "next()\n {\n this._current = this._current.next;\n this._key++;\n }", "function next(){\n if(!debug){_next();}\n}", "function next(err, result) {\n if (err)\n return callback(err, results);\n results.push(result);\n if (fns.length)\n run(fns.shift());\n else\n callback(null, results);\n }", "get next() {\n return this._next;\n }", "get next() {\n return this._next;\n }", "once() {\n this.stop()\n this.step()\n }", "function recursivelyCallNextOnIterator(data) {\n var yielded = iterator.next.apply(iterator, arguments);\n // yielded = { value: Any, done: Boolean }\n\n if (yielded.done) {\n taskInstance.isIdle = true;\n taskInstance.isRunning = false;\n // call setState with the same state to trigger another render\n // so that you can use task properties like isIdle directly\n // in your render function\n component.setState(component.state);\n return;\n }\n\n if (isPromise(yielded.value)) {\n yielded.value.then(function (data) {\n if (component._isMounted) {\n recursivelyCallNextOnIterator(data);\n }\n }, function (e) {\n if (component._isMounted) {\n iterator.throw(e);\n }\n });\n }\n }", "next() {\n if (this.current == \"one\") {\n this.current = \"two\";\n return { done: false, value: \"one\" };\n } else if (this.current == \"two\") {\n this.current = \"\";\n return { done: false, value: \"two\" };\n }\n return { done: true };\n }", "next() {\n return this.items[this.index++];\n }", "next() {\n return iter.next();\n }", "next() {\n return iter.next();\n }", "next() {\n return iter.next();\n }", "next() {\n return iter.next();\n }", "next() {\n return iter.next();\n }", "next() {\n return iter.next();\n }", "next() {\n return iter.next();\n }", "next() {\n return iter.next();\n }", "next() {\n return iter.next();\n }", "next() {\n return iter.next();\n }", "next() {\n return iter.next();\n }", "next() {\n return iter.next();\n }", "run() {\n super.run();\n\n this._stopped = false;\n\n this._next();\n }", "next() {\n this.index++;\n }", "function handleNext() {\n if (isRunning) {\n handleStop();\n }\n update();\n }", "function next(viewer, callback, iterator) {\n let entry = iterator.next();\n\n if (entry.done) {\n callback(entry, iterator);\n } else {\n // Clear the viewer\n viewer.clear(true);\n\n // Replace Math.random with a custom seeded random function\n replaceMathRandom();\n\n // Run the test code\n entry.value[1](viewer);\n\n viewer.whenAllLoaded(() => {\n // Update the viewer once to make all of the changes appear\n viewer.updateAndRender();\n\n // Put back Math.random in its place\n resetMathRandom();\n\n callback(entry, iterator);\n });\n }\n }", "next(enter = true) { return this.move(1, enter); }", "function next() {\n state.tokens.push(new Token());\n nextToken();\n}", "next() {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.after || !this.after.length) {\n log_1.log.show('next(): Nothing more to search.');\n return;\n }\n const query = this.construct().replace(this.afterRegex, `after: \"${this.after}\"`);\n const result = yield this.run(query);\n return this.options.first === 1 ? (result.length ? result[0] : null) : result;\n });\n }", "next() {\n return queue.shift();\n }", "function next() {\n\t\n\tif (currentTransformStep === transformSteps.length) {\n\t\tconsole.log('all transformations performed')\n\t}\n\telse\n\t\ttransformSteps[currentTransformStep++]()\n\t\t\n}", "function next() {\n\t\t\tcounter = pending = 0;\n\t\t\t\n\t\t\t// Check if there are no steps left\n\t\t\tif (steps.length === 0) {\n\t\t\t\t// Throw uncaught errors\n\t\t\t\tif (arguments[0]) {\n\t\t\t\t\tthrow arguments[0];\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// Get the next step to execute\n\t\t\tvar fn = steps.shift(), result;\n\t\t\tresults = [];\n\t\t\t\n\t\t\t// Run the step in a try..catch block so exceptions don't get out of hand.\n\t\t\ttry {\n\t\t\t\tlock = TRUE;\n\t\t\t\tresult = fn.apply(next, arguments);\n\t\t\t} catch (e) {\n\t\t\t\t// Pass any exceptions on through the next callback\n\t\t\t\tnext(e);\n\t\t\t}\n\t\t\t\n\t\t\tif (counter > 0 && pending == 0) {\n\t\t\t\t// If parallel() was called, and all parallel branches executed\n\t\t\t\t// synchronously, go on to the next step immediately.\n\t\t\t\tnext.apply(NULL, results);\n\t\t\t} else if (result !== undefined) {\n\t\t\t\t// If a synchronous return is used, pass it to the callback\n\t\t\t\tnext(undefined, result);\n\t\t\t}\n\t\t\tlock = FALSE;\n\t\t}", "function next () {\n return crontime.schedule().next()\n }", "function next () {\n let start = new Date()\n let buf = rnd(PING_LENGTH)\n shake.write(buf)\n shake.read(PING_LENGTH, (err, bufBack) => {\n let end = new Date()\n if (err || !buf.equals(bufBack)) {\n const err = new Error('Received wrong ping ack')\n return self.emit('error', err)\n }\n\n self.emit('ping', end - start)\n\n if (stop) {\n return\n }\n next()\n })\n }", "function next () {\n let start = new Date()\n let buf = rnd(PING_LENGTH)\n shake.write(buf)\n shake.read(PING_LENGTH, (err, bufBack) => {\n let end = new Date()\n if (err || !buf.equals(bufBack)) {\n const err = new Error('Received wrong ping ack')\n return self.emit('error', err)\n }\n\n self.emit('ping', end - start)\n\n if (stop) {\n return\n }\n next()\n })\n }", "advance() {\n\t\tlet f = this.actions.shift()\n\t\tif (f) f()\n\t}", "function next() {\n if (count >= reqProcessors.length) {\n return;\n }\n var reqProc = reqProcessors[count];\n count++;\n reqProc.request.oldPath = Router._loadedPath;\n var resp = reqProc.activate.call(null, reqProc.request, next);\n if (resp === true) {\n if (console && console.log) {\n console.log('\"return true\" is deprecated, use \"next()\" instead.');\n }\n next();\n }\n }", "first() {\n this.reset();\n return this.next();\n }", "function once(fn) {\n var first = true;\n return function(...args) {\n if (first) {\n first = false;\n return fn(...args);\n }\n }\n}", "nextstep(step) {}", "function once (fn) {\n\t var called = false;\n\t return function () {\n\t if (!called) {\n\t called = true;\n\t fn();\n\t }\n\t }\n\t}", "function once (fn) {\n\t var called = false;\n\t return function () {\n\t if (!called) {\n\t called = true;\n\t fn();\n\t }\n\t }\n\t}", "function once (fn) {\n\t var called = false;\n\t return function () {\n\t if (!called) {\n\t called = true;\n\t fn();\n\t }\n\t }\n\t}", "isNext() {\n return performance.now() > this.nextCursorTime;\n }", "function once(fn){var called=false;return function(){if(called){return;}called=true;return fn.apply(this,arguments);};}", "function next (nextState) {\n if (typeof nextState == \"function\") {\n status.state = getState(nextState.call(this));\n _visit(status.state);\n } else if (nextState in states) {\n status.state = getState(nextState);\n _visit(status.state);\n } else {\n _visit(null);\n }\n }", "function next() {\n\n if (hasNext()) {\n currentVideo++;\n changeSource(currentVideo);\n tableUIUpdate();\n }\n\n }", "function next()\n {\n var params = queue[0];\n\n // Replace or add the handler\n if(params.hasOwnProperty(\"success\")) callback = params.success;\n else callback = null;\n\n params.success = success;\n\n // Manage request timeout\n timeoutId = setTimeout(timeoutHandler, TIMEOUT);\n\n // Now we can perform the request\n $.ajax(params);\n }", "_nextButtonClickHandler() {\n const that = this;\n\n that.next();\n }", "foreach(func){\n var data, _next;\n _next = this.next;\n this.next = null;\n\n while( (data = this.process()) != null )\n func(data);\n\n this.next = _next;\n }", "function next() {\n _base.state.tokens.push(new Token());\n nextToken();\n}", "get next() { return this.$n++; }", "_next(value) {\n let result;\n\n try {\n result = this.project.call(this.thisArg, value, this.count++);\n } catch (err) {\n this.destination.error(err);\n return;\n }\n\n this.destination.next(result);\n }", "function once (fn) {\n var done = false\n return function (err, val) {\n if(done) return\n done = true\n fn(err, val)\n }\n}", "function once (fn) {\n var done = false\n return function (err, val) {\n if(done) return\n done = true\n fn(err, val)\n }\n}", "function next(list) {\n if (list._idleNext == list) return null;\n return list._idleNext;\n }", "function next() {\n slide(false, true);\n }", "function once(fn){var called=false;return function(){if(!called){called=true;fn.apply(this,arguments);}};}", "function once(fn){var called=false;return function(){if(!called){called=true;fn.apply(this,arguments);}};}", "next(item){\n observer.next(item);\n if(++count >= amount)\n observer.complete();\n }", "function one(callback) {\n ///<summary>Execute a callback only once</summary>\n callback = callback || noop;\n\n if (callback._done) {\n return;\n }\n\n callback();\n callback._done = 1;\n }", "function _next () {\n var that = this;\n if (this.data.progress >= 100) {\n this.setData({\n disabled: false\n });\n return true;\n }\n this.setData({\n progress: ++this.data.progress\n });\n setTimeout(function () {\n _next.call(that);\n }, 20);\n}", "function next() {\n counter = pending = 0;\n\n // Check if there are no steps left\n if (steps.length === 0) {\n // Throw uncaught errors\n if (arguments[0]) {\n throw arguments[0];\n }\n return;\n }\n\n // Get the next step to execute\n var fn = steps.shift();\n results = [];\n\n // Run the step in a try..catch block so exceptions don't get out of hand.\n try {\n lock = true;\n var result = fn.apply(next, arguments);\n } catch (e) {\n // Pass any exceptions on through the next callback\n next(e);\n }\n\n if (counter > 0 && pending == 0) {\n // If parallel() was called, and all parallel branches executed\n // synchronously, go on to the next step immediately.\n next.apply(null, results);\n } else if (result !== undefined) {\n // If a synchronous return is used, pass it to the callback\n next(undefined, result);\n }\n lock = false;\n }", "function once(fn){\n\tvar firstExecution = true;\n\tvar result;\n\treturn function(){\n\t\tif(firstExecution){\n\t\t\tresult = fn();\n\t\t\tfirstExecution = false;\n\t\t\treturn result;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n}" ]
[ "0.78337926", "0.7766705", "0.742107", "0.7365195", "0.6899227", "0.6799684", "0.6630355", "0.6603183", "0.65826726", "0.6529928", "0.6470122", "0.6434803", "0.6434803", "0.6420854", "0.6374825", "0.6374825", "0.6349096", "0.63221407", "0.631236", "0.63065857", "0.63003343", "0.62961227", "0.62442935", "0.6241661", "0.6230015", "0.6228021", "0.62233144", "0.6214004", "0.62122256", "0.6210156", "0.61752766", "0.61752766", "0.6169041", "0.6165158", "0.615828", "0.61476773", "0.61439294", "0.6143558", "0.6127905", "0.61232924", "0.61182714", "0.60435843", "0.60435843", "0.6028314", "0.6016665", "0.6000711", "0.59834445", "0.5962309", "0.5962309", "0.5962309", "0.5962309", "0.5962309", "0.5962309", "0.5962309", "0.5962309", "0.5962309", "0.5962309", "0.5962309", "0.5962309", "0.5960535", "0.59592944", "0.59531325", "0.5945665", "0.591721", "0.5898443", "0.58901596", "0.58792925", "0.5872314", "0.5868275", "0.5864022", "0.58384037", "0.58384037", "0.5836122", "0.58349764", "0.5834009", "0.581027", "0.58075565", "0.5798402", "0.5798402", "0.5798402", "0.5788246", "0.57845485", "0.5778991", "0.5772248", "0.5770862", "0.5754168", "0.5752574", "0.57474434", "0.57441634", "0.57343006", "0.572979", "0.572979", "0.57210344", "0.5718094", "0.5704329", "0.5704329", "0.57033855", "0.56943303", "0.56877327", "0.56816304", "0.5675354" ]
0.0
-1
Invoke `done` with one value. Tracks if an error is passed, too.
function then(value) { done(null, value) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function then(value) {\n done(null, value);\n }", "function finish (err) {\n if (!calledDone) {\n calledDone = true;\n done(err);\n }\n }", "function done() {}", "function done ( error ) {\n if (error) {\n that.error = error\n }\n if ( cb ) cb( error )\n }", "done() {}", "function test(done) {\n // always pass\n return done(null, true)\n}", "function done() {\n if (!invoked) {\n invoked = true\n\n callback.apply(null, arguments)\n }\n }", "function done() {\n if (!invoked) {\n invoked = true\n\n callback.apply(null, arguments)\n }\n }", "function done() {\n if (!invoked) {\n invoked = true\n\n callback.apply(null, arguments)\n }\n }", "function done() {\n if (!invoked) {\n invoked = true\n\n callback.apply(null, arguments)\n }\n }", "function done() {\n if (!invoked) {\n invoked = true\n\n callback.apply(null, arguments)\n }\n }", "function done() {\n if (!invoked) {\n invoked = true\n\n callback.apply(null, arguments)\n }\n }", "function done() {\n if (!invoked) {\n invoked = true\n\n callback.apply(null, arguments)\n }\n }", "function done() {\n if (!invoked) {\n invoked = true\n\n callback.apply(null, arguments)\n }\n }", "function done() {\n if (!invoked) {\n invoked = true;\n\n callback.apply(null, arguments);\n }\n }", "function then(fn_done, fn_fail) {\r\n done(fn_done);\r\n fail(fn_fail);\r\n }", "done () {}", "function step() {\n\n // if there's more to do\n if (!result.done) {\n if (typeof result.value === \"function\") {\n result.value(function(err, data) {\n if (err) {\n result = task.throw(err);\n return;\n }\n\n result = task.next(data);\n step();\n });\n } else {\n result = task.next(result.value);\n step();\n }\n\n }\n }", "function done() {\n if (!called) {\n called = true\n callback(...arguments)\n }\n }", "function done(x){\n console.log(\"Done\", x)\n}", "function done(doneItem){\n \n}", "function finish (err) {\n if (!calledDone) {\n calledDone = true;\n done(err || requestError);\n }\n }", "function done(err, result) {\n callback(err, result);\n }", "function done(err, result) {\n callback(err, result);\n }", "function check(done, fn) {\n\ttry {\n\t\tfn();\n\t\tdone();\n\t} catch (err) {\n\t\tdone(err);\n\t}\n}", "step_func_done(func) { func(); }", "function iterationDone(x) { return {value: x, done: true}; }", "function iterationDone(x) { return {value: x, done: true}; }", "function cbify (done) {\n return function (err, value) {\n if (err) {\n console.error(err.toString())\n process.exit(1)\n }\n\n return done.apply(this, Array.prototype.slice.call(arguments, 1))\n }\n}", "function checkDone() {\r\n\t\t\tif (todo===0) {\r\n\t\t\t\tresultCallback(unmarshalledTable);\r\n\t\t\t}\r\n\t\t}", "function validateDone(done)\n{\n const int = parseInt(done);\n if (isNaN(int))\n {\n return false;\n }\n else if (int == 0 || int == 1)\n {\n return int;\n }\n else\n {\n return false;\n }\n}", "function handleOneNext() {\n var prevResult = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];\n\n try {\n var yielded = genObj.next(prevResult); // may throw\n if (yielded.done) {\n if (yielded.value !== undefined) {\n // Something was explicitly returned:\n // Report the value as a result to the caller\n callbacks.success(yielded.value);\n }\n } else {\n setTimeout(runYieldedValue, 0, yielded.value);\n }\n }\n // Catch unforeseen errors in genObj\n catch (error) {\n if (callbacks) {\n callbacks.failure(error);\n } else {\n throw error;\n }\n }\n }", "get done() {\n return Boolean(this._set);\n }", "function step() {\n\n // if there's more to do\n if (!result.done) {\n result = task.next();\n step();\n }\n }", "function run() {\n var index = -1;\n var input = slice$3.call(arguments, 0, -1);\n var done = arguments[arguments.length - 1];\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input));\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index];\n var params = slice$3.call(arguments, 0);\n var values = params.slice(1);\n var length = input.length;\n var pos = -1;\n\n if (err) {\n done(err);\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos];\n }\n }\n\n input = values;\n\n // Next or done.\n if (fn) {\n wrap$2(fn, next).apply(null, input);\n } else {\n done.apply(null, [null].concat(input));\n }\n }\n }", "function done(callback) {\n if(callback) { console.log(\"Error: \", callback); }\n}", "function IteratorStep( iterator, value ) {\n var result = IteratorNext(iterator, value);\n var done = result['done'];\n if (Boolean(done) === true) return false;\n return result;\n }", "function doneFunc(pParams){\n Util.exec(pParams.callback);\n \n var lNum = done.pop (pParams.number);\n if(!lNum){\n Util.exec(pCallback);\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n /* Run the next `fn`, if any. */\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n /* Copy non-nully input into values. */\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n /* Next or done. */\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n /* Run the next `fn`, if any. */\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n /* Copy non-nully input into values. */\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n /* Next or done. */\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "finish() {\n this.done = true;\n }", "static get DONE() {\n return 3;\n }", "function doSomething (cb) {\n cb(null, 'success')\n}", "function doStep() {\n step(returnable(undefined, true));\n data = [];\n errors = [];\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function run() {\n var index = -1\n var input = slice.call(arguments, 0, -1)\n var done = arguments[arguments.length - 1]\n\n if (typeof done !== 'function') {\n throw new Error('Expected function as last argument, not ' + done)\n }\n\n next.apply(null, [null].concat(input))\n\n // Run the next `fn`, if any.\n function next(err) {\n var fn = fns[++index]\n var params = slice.call(arguments, 0)\n var values = params.slice(1)\n var length = input.length\n var pos = -1\n\n if (err) {\n done(err)\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos]\n }\n }\n\n input = values\n\n // Next or done.\n if (fn) {\n wrap(fn, next).apply(null, input)\n } else {\n done.apply(null, [null].concat(input))\n }\n }\n }", "function doSomething (successCallback, failureCallback) {\n setTimeout(\n () => {\n console.log('doSomething is done')\n if (foo === true) return successCallback('DO_SOMETHING_RESULT')\n else failureCallback(new Error('DO_SOMETHING_ERROR'))\n },\n 0)\n}", "function one$1() {\n var self = this;\n\n self.actual++;\n\n if (self.actual >= self.expected) {\n self.emit('done');\n }\n}", "function done() {\n if (!(draining - 1)) _exit(code);\n }", "function testAsync(done, fn) {\n try {\n fn();\n done();\n } catch(err) {\n done(err);\n }\n}", "function finish (err) {\n if (!calledDone) {\n calledDone = true;\n finalize(err, resolve, reject, done);\n }\n }", "function doStep()\n\t\t\t\t{\n\t\t\t\t\tstep(returnable());\n\t\t\t\t\tdata = [];\n\t\t\t\t\terrors = [];\n\t\t\t\t}", "function finish (err) {\n if (!calledDone) {\n calledDone = true;\n finalize(err, resolve, reject, done);\n }\n }", "function copyDone (error)\n {\n if (!done) {\n done = true;\n copyCallback(error);\n }\n }", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [];\n\t\t\t\terrors = [];\n\t\t\t}", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [];\n\t\t\t\terrors = [];\n\t\t\t}", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [];\n\t\t\t\terrors = [];\n\t\t\t}", "completed(data) {}", "function getCallback(done) {\n return function(err, success){\n if (err) {\n grunt.log.error(err.message);\n return done(false);\n }\n grunt.log.writeln(success);\n done(true);\n }\n }", "function succeedTaskInTest(someTask, value) {\n return _runAndCaptureResult(someTask, function (_, s, _e) {\n return s(value);\n });\n}", "function onDone(event) {\r\n return () => {\r\n debug(event);\r\n done();\r\n };\r\n }", "function isDone(self) {\n return Ex.fold_(self.exit, _ => O.isNone(C.flipCauseOption(_)), _ => false);\n}", "function assertIteratorResult(value, done, result) {\n assertEquals({value: value, done: done}, result);\n}", "function getCallback(done) {\n return function(err, success){\n if (err) {\n return grunt.log.error(err);\n } else if (success) {\n grunt.log.writeln(success);\n done();\n }\n }\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 }", "function onDone(event) {\r\n return () => {\r\n debug(event);\r\n done();\r\n };\r\n }", "function doStep() {\n step(returnable());\n data = [];\n errors = [];\n }", "done(program, state) {\n return true;\n }", "done() {\n return this.token == -1;\n }", "function inspect(val) {\n if (ignoreResult || shouldContinue(val)) {\n return iterate();\n } else {\n return next.cancel(val);\n }\n }", "function running(value, fn) {\n haproxy.running(function (err, running) {\n if (err) return done(err);\n\n expect(running).to.equal(value);\n another.running(function (err, running) {\n if (err) return done(err);\n\n expect(running).to.equal(value);\n fn();\n });\n });\n }", "function running(value, fn) {\n haproxy.running(function (err, running) {\n if (err) return done(err);\n\n expect(running).to.equal(value);\n another.running(function (err, running) {\n if (err) return done(err);\n\n expect(running).to.equal(value);\n fn();\n });\n });\n }", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [], errors = [];\n\t\t\t}", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [], errors = [];\n\t\t\t}", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [], errors = [];\n\t\t\t}", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [], errors = [];\n\t\t\t}", "function done (listener, onerror) {\n\t\tthen(listener, onerror || true);\n\t}", "function Do(gen) {\n function step(value) {\n const result = gen.next(value)\n if (result.done) {\n return result.value\n }\n return result.value.bind(step)\n }\n return step()\n }", "function doneTests(opt_failed) {\n endTests(!opt_failed);\n}", "function inspect(val) {\r\n if (ignoreResult || shouldContinue(val)) {\r\n return iterate();\r\n }\r\n return next.cancel(val);\r\n }", "function doResolve(fn, onFulfilled, onRejected) {\n var done = false;\n try {\n fn(function(value) {\n if (done) return\n done = true\n onFulfilled(value)\n }, function(reason) {\n if (done) return\n done = true\n onRejected(reason)\n })\n } catch (ex) {\n if (done) return\n done = true\n onRejected(ex)\n }\n }", "function next(err) {\n var fn = fns[++index];\n var params = slice$3.call(arguments, 0);\n var values = params.slice(1);\n var length = input.length;\n var pos = -1;\n\n if (err) {\n done(err);\n return\n }\n\n // Copy non-nully input into values.\n while (++pos < length) {\n if (values[pos] === null || values[pos] === undefined) {\n values[pos] = input[pos];\n }\n }\n\n input = values;\n\n // Next or done.\n if (fn) {\n wrap$2(fn, next).apply(null, input);\n } else {\n done.apply(null, [null].concat(input));\n }\n }", "isDone(wizardStep) {\n return wizardStep.completed;\n }", "isDone(wizardStep) {\n return wizardStep.completed;\n }", "function doResolve(fn, onFulfilled, onRejected) {\n\t\tvar done = false;\n\t\ttry {\n\t\t\tfn(function (value) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonFulfilled(value);\n\t\t\t}, function (reason) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonRejected(reason);\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\tif (done) return;\n\t\t\tdone = true;\n\t\t\tonRejected(ex);\n\t\t}\n\t}", "function doResolve(fn, onFulfilled, onRejected) {\n\t\tvar done = false;\n\t\ttry {\n\t\t\tfn(function (value) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonFulfilled(value);\n\t\t\t}, function (reason) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonRejected(reason);\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\tif (done) return;\n\t\t\tdone = true;\n\t\t\tonRejected(ex);\n\t\t}\n\t}", "function doResolve(fn, onFulfilled, onRejected) {\n\t\tvar done = false;\n\t\ttry {\n\t\t\tfn(function (value) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonFulfilled(value);\n\t\t\t}, function (reason) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonRejected(reason);\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\tif (done) return;\n\t\t\tdone = true;\n\t\t\tonRejected(ex);\n\t\t}\n\t}" ]
[ "0.6571373", "0.6488745", "0.6473631", "0.6420267", "0.6381803", "0.6373509", "0.63661045", "0.63661045", "0.63661045", "0.63661045", "0.63661045", "0.63661045", "0.63661045", "0.63661045", "0.6287417", "0.6274371", "0.62423915", "0.6176341", "0.6172195", "0.60484797", "0.60444444", "0.5994916", "0.59937763", "0.59937763", "0.59795237", "0.5923141", "0.5812223", "0.5812223", "0.58103424", "0.5807812", "0.5783723", "0.5777586", "0.57325715", "0.57174164", "0.569292", "0.5668251", "0.5660979", "0.56299883", "0.5602941", "0.5602941", "0.55765027", "0.5575947", "0.55585045", "0.5556441", "0.5555315", "0.5555315", "0.5555315", "0.5555315", "0.5555315", "0.5555315", "0.5517442", "0.55065846", "0.5491363", "0.54643273", "0.545871", "0.5451212", "0.5447241", "0.542477", "0.53961265", "0.53961265", "0.53961265", "0.5378117", "0.5373445", "0.53708655", "0.53698856", "0.53697073", "0.5355536", "0.53554094", "0.53538114", "0.53538114", "0.53497195", "0.53334546", "0.53265107", "0.5317455", "0.53096104", "0.5305541", "0.5305541", "0.5305518", "0.5305518", "0.5305518", "0.5305518", "0.5304306", "0.530345", "0.5293297", "0.52892244", "0.5282668", "0.5280996", "0.5280905", "0.5280905", "0.52754354", "0.52754354", "0.52754354" ]
0.6636376
7
Create a custom constructor which can be modified without affecting the original class.
function unherit(Super) { var result var key var value inherits(Of, Super) inherits(From, Of) /* Clone values. */ result = Of.prototype for (key in result) { value = result[key] if (value && typeof value === 'object') { result[key] = 'concat' in value ? value.concat() : xtend(value) } } return Of /* Constructor accepting a single argument, * which itself is an `arguments` object. */ function From(parameters) { return Super.apply(this, parameters) } /* Constructor accepting variadic arguments. */ function Of() { if (!(this instanceof Of)) { return new From(arguments) } return Super.apply(this, arguments) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function temporaryConstructor() {}", "function Constructor() {}", "function Constructor() {}", "function Constructor() {}", "constructor() {\n copy(this, create());\n }", "new() {\n let newInstance = Object.create(this);\n\n newInstance.init(...arguments);\n\n return newInstance;\n }", "function tempCtor() {}", "constructur() {}", "_copy () {\n return new this.constructor()\n }", "_copy () {\n return new this.constructor()\n }", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "clone() {\n return new this.constructor(this);\n }", "construct (target, args) {\n return new target(...args)\n }", "function HelperConstructor() {}", "function SpoofConstructor(name){\n this.name=\"I am \" + name;\n return {name:\"I am Deadpool\"};\n}", "function classCreate() {\n return function() {\n this.initialize.apply(this, arguments);\n }\n}", "function new_constructor(initializer, methods, extend) {\n var prototype = Object.create(typeof extend === 'function'\n ? extend.prototype\n : extend);\n if (methods) {\n methods.keys().forEach(function (key) {\n prototype[key] = methods[key];\n}); }\n function constructor() {\n var that = Object.create(prototype);\n if (typeof initializer === 'function') {\n initializer.apply(that, arguments);\n }\n return that;\n }\n constructor.prototype = prototype;\n prototype.constructor = constructor;\n return constructor;\n }", "copy({ type = this.type, value = this.value } = {}) {\n const { id, lbp, rules, unknown, ignored } = this;\n return new this.constructor(id, {\n lbp,\n rules,\n unknown,\n ignored,\n type,\n value,\n original: this,\n });\n }", "function make_class(){\n\tvar isInternal;\n\tvar constructor = function(args){\n if ( this instanceof constructor ) {\n\t\tif ( typeof this.init == \"function\" ) {\n this.init.apply( this, isInternal ? args : arguments );\n\t\t}\n } else {\n\t\tisInternal = true;\n\t\tvar instance = new constructor( arguments );\n\t\tisInternal = false;\n\t\treturn instance;\n }\n\t};\n\treturn constructor;\n }", "function make_class(){\n\tvar isInternal;\n\tvar constructor = function(args){\n if ( this instanceof constructor ) {\n\t\tif ( typeof this.init == \"function\" ) {\n this.init.apply( this, isInternal ? args : arguments );\n\t\t}\n } else {\n\t\tisInternal = true;\n\t\tvar instance = new constructor( arguments );\n\t\tisInternal = false;\n\t\treturn instance;\n }\n\t};\n\treturn constructor;\n }", "constructor( ) {}", "function Ctor() {}", "function construct(constructor, args) {\n var c = function () {\n return constructor.apply(this, args);\n };\n c.prototype = constructor.prototype;\n var instance = new c();\n instance['@Serializable.ModuleName'] = moduleName;\n instance['@Serializable.TypeName'] = original.name;\n return instance;\n }", "constructor(a, b, c) {\n super(a, b, c);\n }", "function new2() {\n const constructor = arguments[0];\n const args = [].slice.call(arguments, 1);\n const obj = new Object();\n obj.__proto__ = constructor.prototype;\n const ret = constructor.apply(obj, [...args]);\n if (ret && (typeof ret === 'object' || typeof ret === 'function')) {\n return ret;\n }\n return obj;\n}", "function Class() {\n \n if(!(this instanceof arguments.callee)) {\n //return new arguments.callee(options);\n throw new Error('Please used \"new\" keyword to create object!');\n }\n\n // All construction is actually done in the init method\n if (/* !initializing && */this.init )\n this.init.apply(this, arguments);\n }", "function createConstructor(name, opts) {\n\t var func = create.bind(null, name);\n\n\t // Assigning defaults gives a predictable definition and prevents us from\n\t // having to do defaults checks everywhere.\n\t assign(func, defaults);\n\n\t // Inherit all options. This takes into account object literals as well as\n\t // ES2015 classes that may have inherited static props which would not be\n\t // considered \"own\".\n\t utilDefineProperties(func, getAllPropertyDescriptors(opts));\n\n\t return func;\n\t}", "Constructor(args, returns, options = {}) {\r\n return { ...options, kind: exports.ConstructorKind, type: 'constructor', arguments: args, returns };\r\n }", "function makeObjectWithFakeCtor() {\n function fakeCtor() {\n }\n fakeCtor.prototype = ctor.prototype;\n return new fakeCtor();\n }", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "function MyConstructor(){\n\t\tthis.prop1 = \"Maxsuel\";\n\t\tthis.prop2 = \"Storch\";\n\t}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "function construct(constructor, args) {\n var c = function () {\n return constructor.apply(this, args);\n };\n c.prototype = constructor.prototype;\n return new c();\n }", "function applyConstructor(ctor, args) {\n // http://stackoverflow.com/a/8843181/4137472\n return new (ctor.bind.apply(ctor, [null].concat(args)));\n }", "function JClass() {\n // only call 'init' when 'new' is invoked outside the 'extend' method\n if (!initializing && this[opts.ctorName])\n this[opts.ctorName].apply(this, arguments);\n }", "function construct(constructor, args) {\n var c = function () {\n return constructor.apply(this, args);\n };\n c.prototype = constructor.prototype;\n return new c();\n }", "function construct(constructor, args) {\n var c = function () {\n return constructor.apply(this, args);\n };\n c.prototype = constructor.prototype;\n return new c();\n }", "function construct(constructor, args) {\n var c = function () {\n return constructor.apply(this, args);\n };\n c.prototype = constructor.prototype;\n return new c();\n }", "constructor(args, opts) {\n super(args, opts);\n}", "function ctor() {\n this.constructor = ChildFunc;\n }", "function $new(ctor, k, args)\n{\n if($isTransformed(ctor))\n {\n if(!ctor.$blank)\n ctor.$blank = $makeBlank(ctor);\n\n var obj = new ctor.$blank;\n var augmentedK = $makeK(function(x) {\n if(x != null && x != undefined)\n return k(x);\n else\n return k(obj);\n });\n \n return ctor.apply(obj, [augmentedK].concat(args));\n }\n else\n {\n var privateCtor = function ()\n {\n return ctor.apply(this, args);\n };\n privateCtor.prototype = ctor.prototype;\n\n return k(new privateCtor);\n }\n}", "function Constructor() {\n // All construction is actually done in the init method.\n if (!initializing) {\n return this.constructor !== Constructor && arguments.length ?\n // We are being called without `new` or we are extending.\n arguments.callee.extend.apply(arguments.callee, arguments) :\n // We are being called with `new`.\n this.constructor.newInstance.apply(this.constructor, arguments);\n }\n }", "function _ctor() {\n\t}", "function construct(constructor, argList) {\r\n for (var argNames = '', i = argList.length; i--;) {\r\n argNames += (argNames ? ',a' : 'a') + i;\r\n }\r\n return Function(argNames, 'return new this(' + argNames + ')').apply(constructor, argList);\r\n }", "function constructorDecorator(...args) {\n const instance = new OriginalClass(...args);\n\n // Decorator for the defaultType property\n Object.defineProperty(instance, 'defaultType', {\n get: () => instance._defaultType,\n set: (type) => {\n if (!['box', 'box_by_4_points', 'points', 'polygon',\n 'polyline', 'auto_segmentation', 'cuboid'].includes(type)) {\n throw Error(`Unknown shape type found ${type}`);\n }\n instance._defaultType = type;\n },\n });\n\n // Decorator for finish method.\n const decoratedFinish = instance.finish;\n instance.finish = (result) => {\n if (instance._defaultType === 'auto_segmentation') {\n try {\n instance._defaultType = 'polygon';\n decoratedFinish.call(instance, result);\n } finally {\n instance._defaultType = 'auto_segmentation';\n }\n } else {\n decoratedFinish.call(instance, result);\n }\n };\n\n return instance;\n }", "function makeCtor(className) {\n function constructor() {\n // Opera has some problems returning from a constructor when Dragonfly isn't running.\n // The || null seems to be sufficient to stop it misbehaving. Known to be required\n // against 10.53, 11.51 and 11.61.\n return this.constructor.apply(this, arguments) || null;\n }\n if (className) {\n constructor.name = className;\n }\n return constructor;\n }", "function C() {\n C.superconstructor.apply(this, arguments);\n }", "function new_constructor(extend, initializer, methods){\n\t\t\tvar func,\n\t\t\t\tmethodsArr,\n\t\t\t\tmethodsLen,\n\t\t\t\tk,\n\t\t\t\tprototype = Object.create(extend && extend.prototype);\t// ES5, but backup function provided above\n\t\t\t\n\t\t\tif(methods){\n\t\t\t\tmethodsArr = Object.keys(methods);\t\t\t\t\t\t// ES5, but backup function provided above\n\t\t\t\tmethodsLen = methodsArr.length;\n\t\t\t\tfor(k = methodsLen; k--;){\n\t\t\t\t\tprototype[methodsArr[k]] = methods[methodsArr[k]];\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfunc = function(){\t\t\n\t\t\t\tvar that = Object.create(prototype);\t\t\t\t\t// ES5, but backup function provided above\n\t\t\t\tif(typeof initializer === \"function\"){\n\t\t\t\t\tinitializer.apply(that, arguments);\n\t\t\t\t}\n\t\t\t\treturn that;\n\t\t\t};\n\t\t\t\n\t\t\tfunc.prototype = prototype;\n\t\t\tprototype.constructor = func;\n\t\t\treturn func;\n\t\t}", "function construct() { }", "function constructor(spec){\n // 1. initialize own members from spec\n let {member} = spec;\n\n // 2. composition with other objects\n // you can select only the parts that you want to use\n // you only \"inherit\" the stuff that you need\n let {other} = other_constructor(spec);\n\n // 3. methods\n let method = function(){ // close over other methods, variables and spec };\n\n // 4. Expose public API\n // Note new ES6 that lets you define object properties like this:\n // {method, other}\n // instea of\n // { method : method, other : other}\n return Object.freeze({ // immutable (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze)\n method,\n other\n });\n }\n}", "function makeClass(name, parentPrototype, constructor) {\n // jshint evil: true\n // this way we return a proper constructor where\n // CTOR.name === name\n var CTOR = new Function('ctor', 'return '\n + 'function ' + name + '(...args) {'\n + 'ctor.apply(this, args);'\n + '};'\n )(constructor);\n if(parentPrototype)\n CTOR.prototype = Object.create(parentPrototype);\n CTOR.prototype.constructor = CTOR;\n return CTOR;\n}", "constructor(...args) {\n super(...args);\n \n }", "constructor() {\n if (new.target === MatrixBase) {\n throw new TypeError('Cannot construct MatrixBase instances directly');\n }\n }", "function cheapNew(cls) {\n\t\t\t\tdisable_constructor = true;\n\t\t\t\tvar rv = new cls;\n\t\t\t\tdisable_constructor = false;\n\t\t\t\treturn rv;\n\t\t\t}", "function _new(Cls) {\n return new(Cls.bind.apply(Cls, arguments))();\n }", "function construct(constructor, args) {\n\t function F() {\n\t return constructor.apply(this, args);\n\t }\n\t F.prototype = constructor.prototype;\n\t return new F();\n\t}" ]
[ "0.7258686", "0.7070626", "0.7070626", "0.7070626", "0.7062644", "0.70268816", "0.69127655", "0.68617797", "0.6758441", "0.6758441", "0.67081964", "0.67081964", "0.67081964", "0.67081964", "0.67081964", "0.67081964", "0.6666097", "0.6631405", "0.6616296", "0.66080546", "0.6549808", "0.6533894", "0.6526112", "0.6493474", "0.6493474", "0.6482274", "0.6440902", "0.6396154", "0.63882494", "0.6377631", "0.63465285", "0.6333177", "0.6332564", "0.6323786", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6317365", "0.6315571", "0.6292918", "0.6292918", "0.6292918", "0.6292918", "0.6292918", "0.6292918", "0.6292918", "0.627666", "0.62704664", "0.62600935", "0.62574875", "0.624108", "0.624108", "0.62398654", "0.6234543", "0.6229803", "0.620764", "0.61779946", "0.6175066", "0.6162775", "0.61605877", "0.6147128", "0.61405426", "0.6135886", "0.61287194", "0.6124233", "0.61125916", "0.61125374", "0.61097383", "0.61009735", "0.609028" ]
0.0
-1
Constructor accepting a single argument, which itself is an `arguments` object.
function From(parameters) { return Super.apply(this, parameters) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function C(arg) {\n this.args = arguments;\n}", "constructor(args) {\n super(args);\n }", "constructor(args) {\n super(args);\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x99c1d49d;\n this.SUBCLASS_OF_ID = 0xeb9987b3;\n\n this.value = args.value;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x09333afb;\n this.SUBCLASS_OF_ID = 0xf1163490;\n\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x4d4dc41e;\n this.SUBCLASS_OF_ID = 0xf1163490;\n\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x2be0dfa4;\n this.SUBCLASS_OF_ID = 0xeb9987b3;\n\n this.value = args.value;\n }", "constructor() {\n if (arguments.length === 1) {\n let arg1 = arguments[0];\n if (typeof arg1 === 'string') this.parseString(arg1);\n else {\n this.r = arg1.r;\n this.g = arg1.g;\n this.b = arg1.b;\n this.a = arg1.a;\n }\n }\n }", "constructor(args, opts) {\n super(args, opts);\n}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xb71e767a;\n this.SUBCLASS_OF_ID = 0xeb9987b3;\n\n this.value = args.value;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xc7345e6a;\n this.SUBCLASS_OF_ID = 0xeb9987b3;\n\n this.value = args.value;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x9b69e34b;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xf7444763;\n this.SUBCLASS_OF_ID = 0xeb9987b3;\n\n this.value = args.value;\n }", "javaArgs() { }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x6cef8ac7;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x28a20571;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x6f635b0d;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x9c4e7e8b;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x020df5d0;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x6ed02538;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x4c4e743f;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "Constructor(args, returns, options = {}) {\r\n return { ...options, kind: exports.ConstructorKind, type: 'constructor', arguments: args, returns };\r\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x64e475c2;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x826f8b60;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xfa04579d;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x1b0c841a;\n this.SUBCLASS_OF_ID = 0x33d47f45;\n\n this.date = args.date || null;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x0e17e23c;\n this.SUBCLASS_OF_ID = 0x17cc29d9;\n\n this.type = args.type;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xbd610bc9;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xbf0693d4;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xbb92ba95;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x7d748d04;\n this.SUBCLASS_OF_ID = 0xad0352e8;\n\n this.data = args.data;\n }", "construct (target, args) {\n return new target(...args)\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x73924be0;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n this.language = args.language;\n }", "function construct(constructor, argList) {\r\n for (var argNames = '', i = argList.length; i--;) {\r\n argNames += (argNames ? ',a' : 'a') + i;\r\n }\r\n return Function(argNames, 'return new this(' + argNames + ')').apply(constructor, argList);\r\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x1b287353;\n this.SUBCLASS_OF_ID = 0x8680d126;\n\n this.values = args.values;\n this.credentials = args.credentials;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x8317c0c3;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.data = args.data;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x861cc8a0;\n this.SUBCLASS_OF_ID = 0x3da389aa;\n\n this.shortName = args.shortName;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xce0d37b0;\n this.SUBCLASS_OF_ID = 0x1aca5644;\n\n this.name = args.name;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x1427a5e1;\n this.SUBCLASS_OF_ID = 0xbf4e2753;\n\n this.q = args.q;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xa3b54985;\n this.SUBCLASS_OF_ID = 0xbf4e2753;\n\n this.q = args.q;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x0656ac4b;\n this.SUBCLASS_OF_ID = 0xbf4e2753;\n\n this.q = args.q;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x4218a164;\n this.SUBCLASS_OF_ID = 0xf1163490;\n\n this.data = args.data;\n }", "function ArrayArgument() {\n this.args = [];\n}", "function ArrayArgument() {\n this.args = [];\n}", "constructor (command, ...args) {\n super(command, ...args)\n }", "constructor (command, ...args) {\n super(command, ...args)\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xf8b036af;\n this.SUBCLASS_OF_ID = 0x99d5cb14;\n\n this.byLocation = args.byLocation || null;\n this.checkLimit = args.checkLimit || null;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x95d2ac92;\n this.SUBCLASS_OF_ID = 0x8680d126;\n\n this.title = args.title;\n }", "constructor(name = 'anonymous', age = 0) { // if there's no name - argmuent = 'anonymous'\n this.name = name; // 'this' referes to the class instance\n this.age = age;\n}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xbb6ae88d;\n this.SUBCLASS_OF_ID = 0xbf4e2753;\n\n this.q = args.q;\n }", "constructor(...args) {\n super(...args);\n \n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xb5a1ce5a;\n this.SUBCLASS_OF_ID = 0x8680d126;\n\n this.title = args.title;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xc27ac8c7;\n this.SUBCLASS_OF_ID = 0xe1e62c2;\n\n this.command = args.command;\n this.description = args.description;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xeb1477e8;\n this.SUBCLASS_OF_ID = 0x55a97481;\n\n this.id = args.id;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xb4a2e88d;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.chat = args.chat;\n this.date = args.date;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x1142bd56;\n this.SUBCLASS_OF_ID = 0x6db98c4;\n\n this.phone = args.phone;\n this.firstName = args.firstName;\n this.lastName = args.lastName;\n this.date = args.date;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x2331b22d;\n this.SUBCLASS_OF_ID = 0xd576ab1c;\n\n this.id = args.id;\n }", "constructor() {\n super();\n if (arguments.length === 0) {\n this._constructorDefault();\n }\n else if (arguments.length === 2) {\n this._constructorValues(arguments[0], arguments[1]);\n }\n else if (arguments.length === 1) {\n this._constructorPoint(arguments[0]);\n }\n else {\n throw new Error('HPoint#constructor error: Invalid number of arguments.');\n }\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x16115a96;\n this.SUBCLASS_OF_ID = 0x1aca5644;\n\n this.title = args.title;\n this.articles = args.articles;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x3c20629f;\n this.SUBCLASS_OF_ID = 0x82b1f73b;\n\n this.text = args.text;\n this.startParam = args.startParam;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xbaafe5e0;\n this.SUBCLASS_OF_ID = 0x1aca5644;\n\n this.author = args.author;\n this.publishedDate = args.publishedDate;\n }", "function Argument (variable, expression){\n\tthis.variable = variable;\n\tthis.expression = expression;\t\n\t\n\tthis.toString = function(){\n\t\treturn this.variable + '=' + this.expression.toString();\n\t}\n}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xab0f6b1e;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.phoneCall = args.phoneCall;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x76a6d327;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n this.url = args.url;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x5cc761bd;\n this.SUBCLASS_OF_ID = 0xd279c672;\n\n this.langCode = args.langCode;\n this.fromVersion = args.fromVersion;\n this.version = args.version;\n this.keywords = args.keywords;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xd95c6154;\n this.SUBCLASS_OF_ID = 0x8680d126;\n\n this.types = args.types;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xab7ec0a0;\n this.SUBCLASS_OF_ID = 0x6d28a37a;\n\n this.id = args.id;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x9a8ae1e1;\n this.SUBCLASS_OF_ID = 0x1aca5644;\n\n this.items = args.items;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x47a971e0;\n this.SUBCLASS_OF_ID = 0x8d4c94c0;\n\n this.url = args.url;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xeea8e46e;\n this.SUBCLASS_OF_ID = 0xf5ccf928;\n\n this.requestToken = args.requestToken;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x5e068047;\n this.SUBCLASS_OF_ID = 0xeeda0eb8;\n\n this.num = args.num;\n this.text = args.text;\n }", "constructor( args ) {\n\t\t\t\tsuper( args );\n\t\t\t}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x8953ad37;\n this.SUBCLASS_OF_ID = 0xd4eb2d74;\n\n this.id = args.id;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x561bc879;\n this.SUBCLASS_OF_ID = 0xb12d7ac6;\n\n this.userId = args.userId;\n this.date = args.date;\n }", "static create(...args /* :Array<*> */) {\n\t\treturn new this(...args)\n\t}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xf4108aa0;\n this.SUBCLASS_OF_ID = 0xe2e10ef2;\n\n this.singleUse = args.singleUse || null;\n this.selective = args.selective || null;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xc586da1c;\n this.SUBCLASS_OF_ID = 0x55a97481;\n\n this.id = args.id;\n this.date = args.date;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x0a7f6bbb;\n this.SUBCLASS_OF_ID = 0x99d5cb14;\n\n this.id = args.id;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x4a992157;\n this.SUBCLASS_OF_ID = 0x5146d99e;\n\n this.id = args.id;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x15ebac1d;\n this.SUBCLASS_OF_ID = 0xd9c7fc18;\n\n this.userId = args.userId;\n this.date = args.date;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xd33f43f3;\n this.SUBCLASS_OF_ID = 0xfaf846f4;\n\n this.id = args.id;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x46e1d13d;\n this.SUBCLASS_OF_ID = 0x55a53079;\n\n this.url = args.url;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x4843b0fd;\n this.SUBCLASS_OF_ID = 0xfaf846f4;\n\n this.url = args.url;\n this.q = args.q;\n }", "function Construct(target, thisArg, argsArray) {\n if(!(this instanceof Construct)) return new Construct(target, thisArg, argsArray);\n else Call.call(this, target);\n\n Object.defineProperties(this, {\n \"thisArg\": {\n value: thisArg\n },\n \"argsArray\": {\n value: argsArray\n }\n });\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xa676a322;\n this.SUBCLASS_OF_ID = 0x54b6bcc5;\n\n this.id = args.id;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x027477b4;\n this.SUBCLASS_OF_ID = 0x7c7b420a;\n\n this.types = args.types;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x8f8c0e4e;\n this.SUBCLASS_OF_ID = 0x7765cb1e;\n\n this.url = args.url;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x46560264;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.langCode = args.langCode;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xa6638b9a;\n this.SUBCLASS_OF_ID = 0x8680d126;\n\n this.title = args.title;\n this.users = args.users;\n }", "function SuperArg(name){\n this.name = name\n}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xbad88395;\n this.SUBCLASS_OF_ID = 0x54b6bcc5;\n\n this.id = args.id;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x5366c915;\n this.SUBCLASS_OF_ID = 0xc47f1bd1;\n\n this.id = args.id;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xa384b779;\n this.SUBCLASS_OF_ID = 0xa962381e;\n\n this.id = args.id;\n this.flags = args.flags;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x36f8c871;\n this.SUBCLASS_OF_ID = 0x211fe820;\n\n this.id = args.id;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xedb93949;\n this.SUBCLASS_OF_ID = 0x5b0b743e;\n\n this.expires = args.expires;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x200250ba;\n this.SUBCLASS_OF_ID = 0x2da17977;\n\n this.id = args.id;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x0438865b;\n this.SUBCLASS_OF_ID = 0x5146d99e;\n\n this.id = args.id;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xb055eaee;\n this.SUBCLASS_OF_ID = 0x8680d126;\n\n this.title = args.title;\n this.chatId = args.chatId;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xbc0a57dc;\n this.SUBCLASS_OF_ID = 0x55a53079;\n\n this.url = args.url;\n this.set = args.set;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xb3fb5361;\n this.SUBCLASS_OF_ID = 0xa48d04ee;\n\n this.langCode = args.langCode;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xf385c1f6;\n this.SUBCLASS_OF_ID = 0x52662d55;\n\n this.langCode = args.langCode;\n this.fromVersion = args.fromVersion;\n this.version = args.version;\n this.strings = args.strings;\n }" ]
[ "0.6960877", "0.64379203", "0.64379203", "0.63124055", "0.62877387", "0.62737846", "0.6272634", "0.62375265", "0.62284786", "0.62265486", "0.6200758", "0.6163937", "0.6160433", "0.6148898", "0.61483806", "0.6135509", "0.61281246", "0.61076164", "0.60998803", "0.60958815", "0.60800844", "0.60779774", "0.60589147", "0.60570914", "0.60472023", "0.60466826", "0.60397214", "0.6037616", "0.6012565", "0.6009719", "0.59949356", "0.5987498", "0.5984013", "0.5977235", "0.5976731", "0.59750235", "0.59744674", "0.5968511", "0.59542894", "0.5949845", "0.59411126", "0.5940986", "0.59342176", "0.59342176", "0.5933224", "0.5933224", "0.5929107", "0.5895513", "0.58941114", "0.5884799", "0.588166", "0.58815897", "0.58721167", "0.58656013", "0.58625144", "0.58624727", "0.5858178", "0.5854429", "0.5842453", "0.584109", "0.5837525", "0.58355844", "0.5830198", "0.5829291", "0.58240175", "0.5815597", "0.5815257", "0.5811067", "0.58099127", "0.5808835", "0.58053017", "0.58050805", "0.58027786", "0.58015555", "0.57988", "0.57986856", "0.5794709", "0.57943755", "0.57916427", "0.57899195", "0.57892793", "0.5786085", "0.57814753", "0.5779558", "0.577823", "0.5778166", "0.57753", "0.57744575", "0.57739365", "0.57719475", "0.57700866", "0.57686234", "0.57683504", "0.57641494", "0.57609326", "0.5757642", "0.57572883", "0.5755989", "0.5752058", "0.5747354", "0.57471913" ]
0.0
-1
Constructor accepting variadic arguments.
function Of() { if (!(this instanceof Of)) { return new From(arguments) } return Super.apply(this, arguments) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static create(...args /* :Array<*> */) {\n\t\treturn new this(...args)\n\t}", "construct (target, args) {\n return new target(...args)\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x09333afb;\n this.SUBCLASS_OF_ID = 0xf1163490;\n\n this.length = args.length;\n }", "constructor(args) {\n super(args);\n }", "constructor(args) {\n super(args);\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x4d4dc41e;\n this.SUBCLASS_OF_ID = 0xf1163490;\n\n this.length = args.length;\n }", "constructor(...args) {\n super(...args);\n \n }", "constructor(args, opts) {\n super(args, opts);\n}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x9b69e34b;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x6cef8ac7;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x6f635b0d;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x9c4e7e8b;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x6ed02538;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x4c4e743f;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x826f8b60;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x64e475c2;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x1b287353;\n this.SUBCLASS_OF_ID = 0x8680d126;\n\n this.values = args.values;\n this.credentials = args.credentials;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x28a20571;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x027477b4;\n this.SUBCLASS_OF_ID = 0x7c7b420a;\n\n this.types = args.types;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xbd610bc9;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xfa04579d;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x020df5d0;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x9a8ae1e1;\n this.SUBCLASS_OF_ID = 0x1aca5644;\n\n this.items = args.items;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xbf0693d4;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xd95c6154;\n this.SUBCLASS_OF_ID = 0x8680d126;\n\n this.types = args.types;\n }", "function construct(constructor, argList) {\r\n for (var argNames = '', i = argList.length; i--;) {\r\n argNames += (argNames ? ',a' : 'a') + i;\r\n }\r\n return Function(argNames, 'return new this(' + argNames + ')').apply(constructor, argList);\r\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xbb92ba95;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x7e6260d7;\n this.SUBCLASS_OF_ID = 0xf1d0b479;\n\n this.texts = args.texts;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x73924be0;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n this.language = args.language;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xe725d44f;\n this.SUBCLASS_OF_ID = 0xf1163490;\n\n this.entries = args.entries;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x7d861a08;\n this.SUBCLASS_OF_ID = 0x2024514;\n\n this.msgIds = args.msgIds;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x8cc0d131;\n this.SUBCLASS_OF_ID = 0xfa8fcb54;\n\n this.msgIds = args.msgIds;\n this.info = args.info;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x8317c0c3;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.data = args.data;\n }", "constructor(...args) {\n this.length = 0;\n args.forEach(arg => {\n this.push(arg);\n })\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x0c7f49b7;\n this.SUBCLASS_OF_ID = 0xebb7f270;\n\n this.users = args.users;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x62d6b459;\n this.SUBCLASS_OF_ID = 0x827677c4;\n\n this.msgIds = args.msgIds;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x7d748d04;\n this.SUBCLASS_OF_ID = 0xad0352e8;\n\n this.data = args.data;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x0e17e23c;\n this.SUBCLASS_OF_ID = 0x17cc29d9;\n\n this.type = args.type;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xe4e88011;\n this.SUBCLASS_OF_ID = 0x1aca5644;\n\n this.items = args.items;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x99c1d49d;\n this.SUBCLASS_OF_ID = 0xeb9987b3;\n\n this.value = args.value;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x4d5bbe0c;\n this.SUBCLASS_OF_ID = 0xebb7f270;\n\n this.users = args.users;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x2be0dfa4;\n this.SUBCLASS_OF_ID = 0xeb9987b3;\n\n this.value = args.value;\n }", "constructor(a, b, c) {\n super(a, b, c);\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xfb834291;\n this.SUBCLASS_OF_ID = 0x4aec930;\n\n this.category = args.category;\n this.count = args.count;\n this.peers = args.peers;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x4218a164;\n this.SUBCLASS_OF_ID = 0xf1163490;\n\n this.data = args.data;\n }", "function construct(args) {\n args = args.map(deserialize);\n var constructor = args[0];\n\n // The following code solves the problem of invoking a JavaScript\n // constructor with an unknown number arguments.\n // First bind the constructor to the argument list using bind.apply().\n // The first argument to bind() is the binding of 'this', make it 'null'\n // After that, use the JavaScript 'new' operator which overrides any binding\n // of 'this' with the new instance.\n args[0] = null;\n var factoryFunction = constructor.bind.apply(constructor, args);\n return serialize(new factoryFunction());\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x488a7337;\n this.SUBCLASS_OF_ID = 0x8680d126;\n\n this.users = args.users;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x68c13933;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.messages = args.messages;\n this.pts = args.pts;\n this.ptsCount = args.ptsCount;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xa20db0e5;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.messages = args.messages;\n this.pts = args.pts;\n this.ptsCount = args.ptsCount;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xaa2769ed;\n this.SUBCLASS_OF_ID = 0xad0352e8;\n\n this.customMethod = args.customMethod;\n this.params = args.params;\n }", "constructur() {}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xda69fb52;\n this.SUBCLASS_OF_ID = 0x18f01dd0;\n\n this.msgIds = args.msgIds;\n }", "constructor(args, opts) {\n // Calling the super constructor is important so our generator is correctly set up\n super(args, opts);\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x5cc761bd;\n this.SUBCLASS_OF_ID = 0xd279c672;\n\n this.langCode = args.langCode;\n this.fromVersion = args.fromVersion;\n this.version = args.version;\n this.keywords = args.keywords;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x39a51dfb;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.message = args.message;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x131cc67f;\n this.SUBCLASS_OF_ID = 0x5a3b6b22;\n\n this.users = args.users;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x90110467;\n this.SUBCLASS_OF_ID = 0x5a3b6b22;\n\n this.users = args.users;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xc7345e6a;\n this.SUBCLASS_OF_ID = 0xeb9987b3;\n\n this.value = args.value;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x16115a96;\n this.SUBCLASS_OF_ID = 0x1aca5644;\n\n this.title = args.title;\n this.articles = args.articles;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x42e047bb;\n this.SUBCLASS_OF_ID = 0xb2b987f3;\n\n this.message = args.message;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x76a6d327;\n this.SUBCLASS_OF_ID = 0xcf6419dc;\n\n this.offset = args.offset;\n this.length = args.length;\n this.url = args.url;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xc37521c9;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.channelId = args.channelId;\n this.messages = args.messages;\n this.pts = args.pts;\n this.ptsCount = args.ptsCount;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x07761198;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.participants = args.participants;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x8f079643;\n this.SUBCLASS_OF_ID = 0xb2b987f3;\n\n this.message = args.message;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x89893b45;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.channelId = args.channelId;\n this.messages = args.messages;\n }", "constructor( args ) {\n\t\t\t\tsuper( args );\n\t\t\t}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x6c47ac9f;\n this.SUBCLASS_OF_ID = 0xdc179ab9;\n\n this.key = args.key;\n this.zeroValue = args.zeroValue || null;\n this.oneValue = args.oneValue || null;\n this.twoValue = args.twoValue || null;\n this.fewValue = args.fewValue || null;\n this.manyValue = args.manyValue || null;\n this.otherValue = args.otherValue;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xfae69f56;\n this.SUBCLASS_OF_ID = 0x8680d126;\n\n this.message = args.message;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x12bcbd9a;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.message = args.message;\n this.qts = args.qts;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xf7444763;\n this.SUBCLASS_OF_ID = 0xeb9987b3;\n\n this.value = args.value;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x5a686d7c;\n this.SUBCLASS_OF_ID = 0x4561736;\n\n this.chat = args.chat;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xb71e767a;\n this.SUBCLASS_OF_ID = 0xeb9987b3;\n\n this.value = args.value;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xb4a2e88d;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.chat = args.chat;\n this.date = args.date;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xa03e5b85;\n this.SUBCLASS_OF_ID = 0xe2e10ef2;\n\n this.selective = args.selective || null;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xa3b54985;\n this.SUBCLASS_OF_ID = 0xbf4e2753;\n\n this.q = args.q;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x5e068047;\n this.SUBCLASS_OF_ID = 0xeeda0eb8;\n\n this.num = args.num;\n this.text = args.text;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xe9e82c18;\n this.SUBCLASS_OF_ID = 0xb2b987f3;\n\n this.message = args.message;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x1b0c841a;\n this.SUBCLASS_OF_ID = 0x33d47f45;\n\n this.date = args.date || null;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x1f2b0afd;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.message = args.message;\n this.pts = args.pts;\n this.ptsCount = args.ptsCount;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x861cc8a0;\n this.SUBCLASS_OF_ID = 0x3da389aa;\n\n this.shortName = args.shortName;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x1427a5e1;\n this.SUBCLASS_OF_ID = 0xbf4e2753;\n\n this.q = args.q;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x1b3f4df7;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.message = args.message;\n this.pts = args.pts;\n this.ptsCount = args.ptsCount;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xcd77d957;\n this.SUBCLASS_OF_ID = 0x13336a56;\n\n this.excludeNewMessages = args.excludeNewMessages || null;\n this.ranges = args.ranges;\n }", "function construct(constructor, args) {\n var c = function () {\n return constructor.apply(this, args);\n };\n c.prototype = constructor.prototype;\n var instance = new c();\n instance._serviceUrl = serviceUrl;\n return instance;\n }", "constructor(...args) {\n super(() => null, ...args);\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x62ba04d9;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.message = args.message;\n this.pts = args.pts;\n this.ptsCount = args.ptsCount;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x3407e51b;\n this.SUBCLASS_OF_ID = 0x7f86e4e5;\n\n this.set = args.set;\n this.covers = args.covers;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xbaafe5e0;\n this.SUBCLASS_OF_ID = 0x1aca5644;\n\n this.author = args.author;\n this.publishedDate = args.publishedDate;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xa6638b9a;\n this.SUBCLASS_OF_ID = 0x8680d126;\n\n this.title = args.title;\n this.users = args.users;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x0656ac4b;\n this.SUBCLASS_OF_ID = 0xbf4e2753;\n\n this.q = args.q;\n }", "function C(arg) {\n this.args = arguments;\n}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xf385c1f6;\n this.SUBCLASS_OF_ID = 0x52662d55;\n\n this.langCode = args.langCode;\n this.fromVersion = args.fromVersion;\n this.version = args.version;\n this.strings = args.strings;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x199f3a6c;\n this.SUBCLASS_OF_ID = 0x8af52aac;\n\n this.channel = args.channel;\n this.users = args.users;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x65a0fa4d;\n this.SUBCLASS_OF_ID = 0x1aca5644;\n\n this.items = args.items;\n this.caption = args.caption;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xce0d37b0;\n this.SUBCLASS_OF_ID = 0x1aca5644;\n\n this.name = args.name;\n }", "function construct(constructor, args) {\n var c = function () {\n return constructor.apply(this, args);\n };\n c.prototype = constructor.prototype;\n return new c();\n }", "function construct(constructor, args) {\n var c = function () {\n return constructor.apply(this, args);\n };\n c.prototype = constructor.prototype;\n return new c();\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x74ae4240;\n this.SUBCLASS_OF_ID = 0x8af52aac;\n\n this.updates = args.updates;\n this.users = args.users;\n this.chats = args.chats;\n this.date = args.date;\n this.seq = args.seq;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xa9f55f95;\n this.SUBCLASS_OF_ID = 0x41701377;\n\n this.pq = args.pq;\n this.p = args.p;\n this.q = args.q;\n this.nonce = args.nonce;\n this.serverNonce = args.serverNonce;\n this.newNonce = args.newNonce;\n this.dc = args.dc;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x3c20629f;\n this.SUBCLASS_OF_ID = 0x82b1f73b;\n\n this.text = args.text;\n this.startParam = args.startParam;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x3f460fed;\n this.SUBCLASS_OF_ID = 0x1fa89571;\n\n this.chatId = args.chatId;\n this.participants = args.participants;\n this.version = args.version;\n }" ]
[ "0.7136816", "0.6953033", "0.692598", "0.69021624", "0.69021624", "0.6878798", "0.6776414", "0.67102474", "0.6695473", "0.66910213", "0.6659877", "0.66535336", "0.6645595", "0.6640925", "0.6639501", "0.6638436", "0.66289335", "0.66243696", "0.66028565", "0.6594345", "0.65897083", "0.65757793", "0.6574542", "0.6567509", "0.65446997", "0.65349704", "0.6522741", "0.6518138", "0.64826894", "0.6474758", "0.64609015", "0.64560854", "0.6455335", "0.6454957", "0.64404494", "0.643794", "0.6436363", "0.6432503", "0.64323056", "0.6428695", "0.6420654", "0.6395082", "0.6394401", "0.6390547", "0.63866043", "0.638415", "0.63733834", "0.6370659", "0.6361882", "0.6338729", "0.6338513", "0.6334322", "0.6329979", "0.6326354", "0.6322696", "0.6321648", "0.63153595", "0.6311467", "0.6302679", "0.6301837", "0.6296556", "0.62944484", "0.62922657", "0.6291221", "0.6282507", "0.628007", "0.6279444", "0.6269089", "0.6268717", "0.62611276", "0.6252716", "0.62450397", "0.62447774", "0.6240598", "0.6236494", "0.62297755", "0.6227919", "0.6226262", "0.6223029", "0.6221429", "0.62173223", "0.6216982", "0.6215695", "0.6214495", "0.62135065", "0.62123394", "0.62111485", "0.6209792", "0.6199318", "0.6197479", "0.6191101", "0.61910665", "0.6189197", "0.6185471", "0.6184935", "0.6184302", "0.6183047", "0.6179478", "0.61776936", "0.61776626", "0.61774987" ]
0.0
-1
Get all keys in `value`.
function keys(value) { var result = []; var key; for (key in value) { result.push(key); } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function keys(value) {\n var result = []\n var key\n\n for (key in value) {\n result.push(key)\n }\n\n return result\n}", "function keys(value) {\n var key\n for (key in value) {\n return true\n }\n return false\n}", "function keys(value) {\n var key\n for (key in value) {\n return true\n }\n return false\n}", "function keys(value) {\n var key\n for (key in value) {\n return true\n }\n return false\n}", "function keys(value) {\n var key\n for (key in value) {\n return true\n }\n return false\n}", "function keys(value) {\n var key\n for (key in value) {\n return true\n }\n return false\n}", "function keys(value) {\n var key;\n for (key in value) {\n return true;\n }\n return false;\n}", "function keys(value) {\n var key\n for (key in value) {\n return true\n }\n\n return false\n}", "function keys(value) {\n var key\n for (key in value) {\n return true\n }\n\n return false\n}", "function keys(value) {\n var key\n for (key in value) {\n return true\n }\n\n return false\n}", "function keys(value) {\n var key;\n for (key in value) {\n return true\n }\n\n return false\n}", "get keys() {}", "keys()\n\t{\n\t\tvar it = super.keys();\n\t\tvar res = new Runtime.Collection();\n\t\tvar next = it.next();\n\t\twhile (!next.done)\n\t\t{\n\t\t\tres.push( next.value );\n\t\t\tnext = it.next();\n\t\t}\n\t\treturn res;\n\t}", "function getFlagKeysFromString(value) {\n if (!value) return [];\n\n let result = value.split(key_value_delimiter);\n result = trimArray(result);\n\n return result;\n}", "keys() {\n const result = [];\n for (let i = 0; i < this.map.length; i += 1) {\n if (this.map[i] !== undefined) {\n for (let j = 0; j < this.map[i].length; j += 1) {\n const key = this.map[i][j][0];\n result.push(key);\n }\n }\n }\n\n return result;\n }", "keys() {\n return this.values();\n }", "values() {\n return Object.keys(this.dictionary);\n }", "values() {\n return Object.keys(this.dictionary);\n }", "allKeys() {\n return this.k2s.keys();\n }", "get keys() {\n return Object.keys(this._keyMap);\n }", "keys() {\n let result = []\n for (let i = 0; i<this.keyMap.length; i++) {\n if (!!this.keyMap[i]) {\n if (this.keyMap[i].length>0) {\n for (let j=0; j<this.keyMap[i].length; j++) {\n result.push(this.keyMap[i][j][0])\n }\n }\n }\n }\n return result\n }", "function keys(object) {\n var output = [];\n for (var key in object) {\n if (hasKey(object, key)) {\n output.push(key);\n }\n }\n return output;\n}", "*keys() {\n for (const i of this.#indexes()) {\n const k = this.#keyList[i];\n if (k !== undefined &&\n !this.#isBackgroundFetch(this.#valList[i])) {\n yield k;\n }\n }\n }", "values(){\n return Object.keys(this.items);\n\n /*\n var result;\n for (var key in this.items){\n if (this.items.hasOwnProperty(key)){\n result.push(key);\n }\n }\n return result;\n */\n }", "getKeys() {\n this._ensureUnpacked();\n if (this.unpackedArray) {\n return Array.from(this.unpackedArray.keys());\n } else if (this.unpackedAssocArray) {\n this._ensureAssocKeys();\n return Array.from(this.unpackedAssocKeys);\n }\n return [];\n }", "keys() {\n const ret = [];\n for (let i = 0; i < this.hashTable.length; ++i)\n for (let slot = this.hashTable[i]; slot; slot = slot.next)\n if (!slot.deleted)\n ret.push(slot.key);\n return ret;\n }", "async keys () {\n const results = await this.client.zRange(this.ZSET_KEY, 0, -1);\n return results.map(key => key.slice(`${this.namespace}`.length));\n }", "getKeys() {\n this.logger.trace(\"Retrieving all cache keys\");\n // read cache\n const cache = this.getCache();\n return [...Object.keys(cache)];\n }", "keys() {\n this.init();\n return Array.from(this.map.keys());\n }", "function ofAssoc(value) {\n return new mona_dish_2.Es2019Array(...Object.keys(value))\n .map(key => [key, value[key]]);\n }", "keys()\n {\n // Local variable dictionary\n let keys = new LinkedList();\n\n // Get the keys\n for (let counter = 0; counter < this.#table.getLength(); counter++)\n {\n // Get the index linked list\n let listIndex = this.#table.peekIndex(counter);\n\n // Get the keys in the list index\n for (let count = 0; count < listIndex.getLength(); count++)\n {\n // Get the key and value pair\n let hashEntry = listIndex.peekIndex(count);\n keys.append(hashEntry.key.key);\n }\n }\n\n // Return the keys\n return keys;\n }", "function keys() {\n return this.pluck('key');\n }", "getKeys() {\n errors.throwNotImplemented(\"returning the keys of a collection\");\n }", "keys() {\n this.init();\n return Array.from(this.map.keys());\n }", "keys() {\n this.init();\n return Array.from(this.map.keys());\n }", "keys() {\n this.init();\n return Array.from(this.map.keys());\n }", "keys() {\n this.init();\n return Array.from(this.map.keys());\n }", "keys() {\n this.init();\n return Array.from(this.map.keys());\n }", "keys() {\n return this.hashMap.keys();\n }", "function BOT_extractKeyNamesFromTagValue(topicid,tag,value) {\r\n\tvar t = eval(topicid);\r\n\tvar lres = [];\r\n\tvar ta,res;\r\n\tfor(var i in t) {\r\n\t\tta = t[i];\r\n\t\tfor(var j in ta) {\r\n\t\t\ttagval = ta[j];\r\n\t\t\tif(tagval[0] == tag && tagval[1] == value) { \r\n\t\t\t\tres = BOT_getTopicAttributeTagValue(ta,\"KEY\");\r\n\t\t\t\tif(res) lres = lres.concat(res);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn lres\r\n}", "keys() {\n let keysArr = [];\n for (let i = 0; i < this.keyMap.length; i++) {\n if (this.keyMap[i]) {\n for (let j = 0; j < this.keyMap[i].length; i++) {\n if (!keysArr.includes(this.keyMap[i][j][1])) {\n keysArr.push(this.keyMap[i][j][1]);\n }\n }\n }\n }\n return keysArr;\n }", "* keys() {\n\t\tfor (const [key] of this) {\n\t\t\tyield key;\n\t\t}\n\t}", "keys() {\n\t\treturn createHeadersIterator$1(this, 'key');\n\t}", "keys() {\n const keysArray = [];\n for (let i = 0; i < this.data.length; i++) {\n if (this.data[i]) {\n keysArray.push(this.data[i][0][0]);\n }\n }\n return keysArray;\n }", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "keys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}", "function ks(vals) {\n var result = []\n vals.forEach(function(val, i) { result.push('key_' + (i+1)) })\n return result\n}", "function getKeys(obj, val) {\n var objects = [];\n for (var i in obj) {\n if (!obj.hasOwnProperty(i)) continue;\n if (typeof obj[i] == 'object') {\n objects = objects.concat(getKeys(obj[i], val));\n } else if (obj[i] == val) {\n objects.push(i);\n }\n }\n return objects;\n}", "function getKeys(obj, val) {\n var objects = [];\n for (var i in obj) {\n if (!obj.hasOwnProperty(i)) continue;\n if (typeof obj[i] == 'object') {\n objects = objects.concat(getKeys(obj[i], val));\n } else if (obj[i] == val) {\n objects.push(i);\n }\n }\n return objects;\n}", "function getKeys(obj, val) {\n var objects = [];\n for (var i in obj) {\n if (!obj.hasOwnProperty(i)) continue;\n if (typeof obj[i] == 'object') {\n objects = objects.concat(getKeys(obj[i], val));\n } else if (obj[i] == val) {\n objects.push(i);\n }\n }\n return objects;\n}", "function getKeys(obj, val) {\n var objects = [];\n for (var i in obj) {\n if (!obj.hasOwnProperty(i)) continue;\n if (typeof obj[i] == 'object') {\n objects = objects.concat(getKeys(obj[i], val));\n } else if (obj[i] == val) {\n objects.push(i);\n }\n }\n return objects;\n}", "getKeysByPrefix(prefix) {\n const keys = []\n\n store.each((value, key) => {\n if (key && key.indexOf(prefix) === 0) {\n keys.push(key)\n }\n })\n\n return keys\n }", "keys() {\n let keysArray = [];\n for (let i = 0; i < this.keyMap.length; i++) {\n if (this.keyMap[i]) {\n for (let j = 0; j < this.keyMap[i].length; j++) {\n if (!keysArray.includes(this.keyMap[i][j][0])) {\n keysArray.push(this.keyMap[i][j][0]);\n }\n }\n }\n }\n return keysArray;\n }", "values() {\n\t\treturn createHeadersIterator$1(this, 'value');\n\t}", "keys() {\n\t\tif (!this.data.length) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst keysArray = [];\n\t\tfor (let i = 0; i < this.data.length; i++) {\n\t\t\t// if data at index i exists push it to the array\n\t\t\tif (this.data[i]) {\n\t\t\t\t// when data at i lengh is greater than 1, then probably here hash collision had happened\n\t\t\t\t// need to loop over this array to get all the values\n\t\t\t\tif (this.data[i].length > 1) {\n\t\t\t\t\tfor (let j = 0; j < this.data[i].length; j++) {\n\t\t\t\t\t\tkeysArray.push(this.data[i][j][0]);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// else, just push first value in that array\n\t\t\t\t\tkeysArray.push(this.data[i][0][0]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn keysArray;\n\t}", "values() {\n let valuesArr = [];\n for (let i = 0; i < this.keyMap.length; i++) {\n if (this.keyMap[i]) {\n for (let j = 0; j < this.keyMap[i].length; i++) {\n if (!valuesArr.includes(this.keyMap[i][j][1])) {\n valuesArr.push(this.keyMap[i][j][1]);\n }\n }\n }\n }\n return valuesArr;\n }", "function getHalfCheckedKeys(valueList, valueEntities) {\n var values = {}; // Fill checked keys\n\n valueList.forEach(function (_ref6) {\n var value = _ref6.value;\n values[value] = false;\n }); // Fill half checked keys\n\n valueList.forEach(function (_ref7) {\n var value = _ref7.value;\n var current = valueEntities[value];\n\n while (current && current.parent) {\n var parentValue = current.parent.value;\n if (parentValue in values) break;\n values[parentValue] = true;\n current = current.parent;\n }\n }); // Get half keys\n\n return Object.keys(values).filter(function (value) {\n return values[value];\n }).map(function (value) {\n return valueEntities[value].key;\n });\n}", "function getHalfCheckedKeys(valueList, valueEntities) {\n var values = {}; // Fill checked keys\n\n valueList.forEach(function (_ref6) {\n var value = _ref6.value;\n values[value] = false;\n }); // Fill half checked keys\n\n valueList.forEach(function (_ref7) {\n var value = _ref7.value;\n var current = valueEntities[value];\n\n while (current && current.parent) {\n var parentValue = current.parent.value;\n if (parentValue in values) break;\n values[parentValue] = true;\n current = current.parent;\n }\n }); // Get half keys\n\n return Object.keys(values).filter(function (value) {\n return values[value];\n }).map(function (value) {\n return valueEntities[value].key;\n });\n}", "function getHalfCheckedKeys(valueList, valueEntities) {\n var values = {}; // Fill checked keys\n\n valueList.forEach(function (_ref6) {\n var value = _ref6.value;\n values[value] = false;\n }); // Fill half checked keys\n\n valueList.forEach(function (_ref7) {\n var value = _ref7.value;\n var current = valueEntities[value];\n\n while (current && current.parent) {\n var parentValue = current.parent.value;\n if (parentValue in values) break;\n values[parentValue] = true;\n current = current.parent;\n }\n }); // Get half keys\n\n return Object.keys(values).filter(function (value) {\n return values[value];\n }).map(function (value) {\n return valueEntities[value].key;\n });\n}", "function getHalfCheckedKeys(valueList, valueEntities) {\n var values = {}; // Fill checked keys\n\n valueList.forEach(function (_ref6) {\n var value = _ref6.value;\n values[value] = false;\n }); // Fill half checked keys\n\n valueList.forEach(function (_ref7) {\n var value = _ref7.value;\n var current = valueEntities[value];\n\n while (current && current.parent) {\n var parentValue = current.parent.value;\n if (parentValue in values) break;\n values[parentValue] = true;\n current = current.parent;\n }\n }); // Get half keys\n\n return Object.keys(values).filter(function (value) {\n return values[value];\n }).map(function (value) {\n return valueEntities[value].key;\n });\n}", "keys() {\n const keyArr = [];\n for (let i = 0; i < this.data.length; i++) {\n if (this.data[i]) {\n for (let j = 0; j < this.data[i].length; j++) {\n keyArr.push(this.data[i][j][0]);\n }\n }\n }\n return keyArr;\n }", "function getKeys(object) {\n var keys = [];\n for (var key in object) {\n if (object.hasOwnProperty(key)) {\n keys.push(key);\n }\n }\n return keys;\n }", "function keys(o){\n var tmp = new Array();\n for (k in o) tmp.push(k);\n return tmp;\n}", "keys () {\n\t\treturn this.cache.keys();\n\t}", "set keys(value) {}" ]
[ "0.83654433", "0.6577015", "0.6577015", "0.6577015", "0.6577015", "0.6577015", "0.6546291", "0.65166605", "0.65166605", "0.65166605", "0.6439548", "0.63332194", "0.62305605", "0.61524576", "0.6028577", "0.5955654", "0.57845986", "0.57845986", "0.569534", "0.56586033", "0.5628601", "0.5606285", "0.55603534", "0.55548817", "0.5552913", "0.5550958", "0.55444354", "0.55313253", "0.55243367", "0.5518806", "0.5509871", "0.5504994", "0.5497294", "0.549691", "0.549691", "0.549691", "0.549691", "0.549691", "0.54885703", "0.54835397", "0.5480333", "0.5462476", "0.54553014", "0.54536813", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5440965", "0.5436028", "0.5422803", "0.5422803", "0.5422803", "0.5422803", "0.5407806", "0.54026407", "0.53750145", "0.5371712", "0.53443843", "0.5342935", "0.5342935", "0.5342935", "0.5342935", "0.53372246", "0.53125954", "0.53039074", "0.5278506", "0.52697873" ]
0.8280043
6
Construct a state `toggler`: a function which inverses `property` in context based on its current value. The by `toggler` returned function restores that value.
function factory(key, state, ctx) { return enter function enter() { var context = ctx || this var current = context[key] context[key] = !state return exit function exit() { context[key] = current } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toggleable_factory(prop = 'value', event = 'input') {\n return external_commonjs_vue_commonjs2_vue_root_Vue_default.a.extend({\n name: 'toggleable',\n model: {\n prop,\n event\n },\n props: {\n [prop]: {\n required: false\n }\n },\n\n data() {\n return {\n isActive: !!this[prop]\n };\n },\n\n watch: {\n [prop](val) {\n this.isActive = !!val;\n },\n\n isActive(val) {\n !!val !== this[prop] && this.$emit(event, val);\n }\n\n }\n });\n}", "function toggleable_factory(prop = 'value', event = 'input') {\n return external_commonjs_vue_commonjs2_vue_root_Vue_default.a.extend({\n name: 'toggleable',\n model: {\n prop,\n event\n },\n props: {\n [prop]: {\n required: false\n }\n },\n\n data() {\n return {\n isActive: !!this[prop]\n };\n },\n\n watch: {\n [prop](val) {\n this.isActive = !!val;\n },\n\n isActive(val) {\n !!val !== this[prop] && this.$emit(event, val);\n }\n\n }\n });\n}", "function toggleable_factory(prop = 'value', event = 'input') {\n return external_commonjs_vue_commonjs2_vue_root_Vue_default.a.extend({\n name: 'toggleable',\n model: {\n prop,\n event\n },\n props: {\n [prop]: {\n required: false\n }\n },\n\n data() {\n return {\n isActive: !!this[prop]\n };\n },\n\n watch: {\n [prop](val) {\n this.isActive = !!val;\n },\n\n isActive(val) {\n !!val !== this[prop] && this.$emit(event, val);\n }\n\n }\n });\n}", "function toggleable_factory(prop = 'value', event = 'input') {\n return external_Vue_default.a.extend({\n name: 'toggleable',\n model: {\n prop,\n event\n },\n props: {\n [prop]: {\n required: false\n }\n },\n\n data() {\n return {\n isActive: !!this[prop]\n };\n },\n\n watch: {\n [prop](val) {\n this.isActive = !!val;\n },\n\n isActive(val) {\n !!val !== this[prop] && this.$emit(event, val);\n }\n\n }\n });\n}", "value(state, action, target) { throw 'Not implemented' }", "function generate_toggle(propertyname,on,off){\n return function(){\n var textarea=$(this).parent().parent().parent().children(\".text\");\n var flag=textarea.css(propertyname);\n if(flag==on){\n textarea.css(propertyname,off);\n }\n else{\n textarea.css(propertyname,on);\n }\n }\n}", "valuator(trigger, options, callback) {\n const env = { inject: this.get_('eval.env') };\n const valuator = new Valuator(Object.assign({ trigger, env }, options));\n const flyout = this.flyout(trigger, valuator, { context: 'quick', type: 'Manual' });\n valuator.destroyWith(flyout);\n valuator.on('destroying', () => { this.placehold(trigger); });\n\n valuator.get('result').react(false, (result) => { // no point in reactTo\n callback(result);\n valuator.destroy();\n });\n return valuator;\n }", "trigger(event) {\r\n\r\n var temp = this.config.states[this.state].transitions[event];\r\n this.changeState(temp);\r\n }", "trigger(event) {\r\n if (!this.config.states[this.state].transitions.hasOwnProperty(event)) {\r\n throw new Error();\r\n }\r\n\r\n switch (event) {\r\n\r\n case 'study' :\r\n this.changeState('busy');\r\n this.prev = (this.prev) ? 'normal' : false;\r\n this.next.pop();\r\n this.possibleRedoCount++;\r\n break;\r\n\r\n case 'get_tired' :\r\n this.changeState('sleeping');\r\n this.prev = 'busy';\r\n this.next.pop();\r\n this.possibleRedoCount++;\r\n break;\r\n\r\n case 'get_hungry' :\r\n this.changeState('hungry');\r\n this.prev = (this.prev == 'busy') ? 'busy' : 'sleeping';\r\n this.next.pop();\r\n this.possibleRedoCount++;\r\n break;\r\n\r\n case 'eat' :\r\n case 'get up' :\r\n this.changeState('normal');\r\n this.next.pop();\r\n this.possibleRedoCount++;\r\n break;\r\n }\r\n }", "function accessor(property) {\n\t\tvar fn = function() {\n\t\t\treturn this[arguments.length ? \"set\" : \"get\"](property, arguments[0]);\n\t\t};\n\n\t\t// Set a flag to later prevent set() to call fn() indefinitely\n\t\tfn.accessor = true;\n\t\treturn fn;\n\t}", "set property(){}", "set actuatorState(value) { this._actuatorState = value; }", "function onPropertyChange(e, property) {\n\t\tif (!isEditMode) return e.preventDefault();\n\t\treturn onChange(e, 'properties', { [property]: !properties[property] });\n\t}", "of(value) { return new StateEffect(this, value); }", "function toggleValue(event) {\n const toggle = event.target\n const current_wrapper = toggle.closest(Selectors._toggle)\n const value_element = current_wrapper.querySelector(Selectors._value)\n\n _assignValue(toggle, value_element)\n }", "@action\n setProp(property, newVal) {\n this.set(property, newVal);\n }", "function changeProperty() {\n var thisControl = event.target.id;\t\t\t\t// what did you click on?\n var thisLight = event.target.parentNode.id;\t// get the parent (light number)\n var value = event.target.value;\t\t\t\t\t// get the value\n\n // make a new payload:\n var payload = {};\n // put the value for the given control into the payload:\n payload[thisControl] = Number(value); // convert strings to numbers\n\n // the 'on' control is a special case, it's true/false\n // because it's a checkbox:\n if (thisControl === 'on') {\n payload[thisControl] = event.target.checked;\n }\n\n setLight(thisLight, payload, 'state');\t// make the HTTP call\n}", "doAction (value) {\n if (!this._params.simulate) {\n this._actuator.write(value.state === true ? 1 : 0, () => {\n this.addValue(value.state)\n })\n } else {\n this.addValue(value.state)\n }\n\n value.status = 'completed'\n\n console.info('Changed value of %s to %s', this._model.name, value.state)\n }", "set state(value) {\n defineProperty(this, '_state$', {configurable: true, value: value});\n }", "function ArrowViewStateTransition() {}", "get _eventTargetProperty() {\n return 'checked';\n }", "trigger(event) { \r\n if (this.config.states[this.config.initial].transitions[event] == undefined) {\r\n throw new Error(\"Event: fail check\");\r\n }\r\n this.config.initial = this.config.states[this.config.initial].transitions[event]\r\n this.undoArr.push(this.config.initial)\r\n this.hack++\r\n return this.config.initial\r\n }", "_generateHandler(propertyName) {\n return function(event) {\n this.setState({\n [propertyName]: event.target.value\n })\n }.bind(this)\n }", "function reactive(target) {\n const handler = {\n // receiver => ensures the proper value of this is used when our object has\n // inherited values or functions from another object\n get(target, key, receiver) {\n let result = Reflect.get(target, key, receiver)\n track(target, key)\n return result\n },\n set(target, key, value, receiver) {\n let oldValue = target[key]\n let result = Reflect.set(target, key, value, receiver)\n if (result && oldValue != value) {\n trigger(target, key)\n }\n return result\n },\n }\n return new Proxy(target, handler)\n}", "trigger(event) {\r\n if(this.config.states[this.currentState].transitions[event] === undefined){\r\n throw new Error('Event is undefined by config. So, Fuck Off!');\r\n }\r\n this.prevState = this.currentState;\r\n this.currentState = this.config.states[this.currentState].transitions[event];\r\n }", "toggler() {\n const visibility = this.state.visibility;\n const expanded = this.state.expanded;\n if (visibility === \"hidden\" && !expanded) {\n this.setState({\n visibility: \"visible\",\n expanded: true\n })\n } else {\n this.setState({\n visibility: \"hidden\",\n expanded: false\n })\n }\n\n }", "handleChange(prop, e) {\n var newState = {};\n newState[prop] = e.target.value;\n this.setState(newState);\n }", "function makeProperty( obj, name, predicate ) {\r\n\tvar value; // this is the property value, current goal in this application.\r\n\t\r\n\tobj[\"get\" + name] = function() {\r\n\t\treturn value; \r\n\t};\r\n\t\r\n\tobj[\"set\" + name] = function(v) {\r\n\t\tif ( predicate && !predicate(v))\r\n\t\t\tthrow \"set\" + name + \": invalid value \" + v;\r\n\t\telse\t\r\n\t\t\tvalue = v;\r\n\t};\r\n\t\t\r\n}", "function wrapAround(target, property) \n{\n\t\n\tvar fn = target[property];\n\t\t\n\tif(property.indexOf('->') == -1) return { property: property, value: fn };\n\n\tvar mw = property.split(/\\s*->\\s*/g),\n\taccessorParts = mw[0].split(' ');\n\n\tmw[0] = accessorParts.pop();\n\taccessorParts.push(mw[mw.length - 1]);\n\n\tmw.pop();\n\n\n\treturn { property: accessorParts.join(' '), value: getStepper(target, mw, fn) };\n}", "toggleInput(event) {\n this.openValue = event.target.checked\n this.animate()\n }", "trigger(event) {\r\n var states = this.config.states,\r\n prop = this.currentState,\r\n state = states[prop];\r\n if (event in state.transitions) {\r\n this.currentState = state.transitions[event];\r\n this.history.push(this.currentState);\r\n this.cancelled = [];\r\n }\r\n else throw new Error(\"State doesn't exist\");\r\n \r\n }", "function logProperty(value) {\n console.log(`${value} evaluated`);\n return function (target, propertyKey) {\n console.log(`${value} called`);\n };\n}", "toggleItem(prop, value) {\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tvalue = set({ prop, hidden: true });\n\t\t\t\t}\n\n\t\t\t\tset({ hidden: true, prop }, !value);\n\t\t\t}", "function useToggle(initialValue = false) {\n return useReducer((state) => !state, initialValue);\n }", "function propertyFunction() {\n var x = value.apply(this, arguments);\n if (x == null) delete this[name];\n else this[name] = x;\n }", "get asSetter() {\n return setter(this.over)\n }", "_upgradeProperty(prop) {\n // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties\n // https://developers.google.com/web/fundamentals/web-components/examples/howto-checkbox\n /* eslint no-prototype-builtins: 0 */\n if (this.hasOwnProperty(prop)) {\n const value = this[prop];\n // get rid of the property that might shadow a setter/getter\n delete this[prop];\n // this time if a setter was defined it will be properly called\n this[prop] = value;\n // if a getter was defined, it will be called from now on\n }\n }", "function transition (state, event) {\n return machine.states[state]\n ?.on?.[event] || state;\n\n // switch (state) {\n // case 'active':\n // switch (event) {\n // case 'click':\n // return 'inactive'\n // default:\n // return state;\n // }\n // case 'inactive':\n // switch (event) {\n // case 'click':\n // return 'active'\n // default:\n // return state;\n // }\n // default:\n // return state;\n // }\n}", "reset(prop, e) {\n var newState = {};\n newState[prop] = '';\n this.setState(newState);\n }", "togglerClick() {\n $('#toggler').click(() => {\n let toggler = parseInt($(this).css('left'))\n if (toggler > 0) {\n this.display.togglerSlideLeft()\n } else {\n this.display.togglerSlideRight()\n }\n })\n }", "function propertyFunction() {\n var x = value.apply(this, arguments);\n if (x == null) delete this[name];\n else this[name] = x;\n }", "function propertyFunction() {\n var x = value.apply(this, arguments);\n if (x == null) delete this[name];\n else this[name] = x;\n }", "function defineProperty(key,handler,value){Object.defineProperty(ctrl,key,{get:function get(){return value;},set:function set(newValue){var oldValue=value;value=newValue;handler(newValue,oldValue);}});}", "function transition(state, event) {\n return machine.states[state]?.on?.[event] || state;\n}", "get (target, propKey, receiver) {\n // We check whether the property accessed is the write method\n // If that is the case, we return a function to proxy the original behavior.\n if (propKey === 'write') {\n // we extract the current chunk from the list of arguments passed to the original function, \n // we log the content of the chunk, \n // we invoke the original method with the given list of arguments\n return function (...args) {\n const [chunk] = args\n console.log('Writing', chunk)\n return writable.write(...args)\n }\n }\n // We return unchanged any other property\n return target[propKey]\n }", "get action() { return this.actionIn; }", "function defineProperty(key,handler,value){Object.defineProperty(ctrl,key,{get:function get(){return value;},set:function set(newValue){var oldValue=value;value=newValue;handler&&handler(newValue,oldValue);}});}", "trigger(event) {\r\n var currentState = this.getState();\r\n var newState = this.states[currentState].transitions[event];\r\n if (newState) {\r\n this.changeState(newState);\r\n this.statesUndone.clear();\r\n }\r\n else throw new Error(\"This event can't be triggered.\");\r\n }", "function toggleProperties($el, property, val) {\n if (val === false || val === 'false') {\n $el.children().first().removeAttr(property);\n } else {\n $el.children().first().attr(property, val);\n }\n }", "render() {\n const {visible} = this.state;\n this.target.setAttribute('aria-hidden', !visible);\n this.toggler.setAttribute('aria-expanded', visible);\n const action = visible ? '_show' : '_hide';\n this[action]();\n }", "stateChanged(state) { }", "onTrigger(prevValue) {\r\n\r\n // Store input\r\n this.lastActionInput = prevValue\r\n\r\n }", "get state() {\r\n return reactionState;\r\n }", "toggle(value = !this.onOff) {\r\n return this.operatePlug({ onOff: value });\r\n }", "handleToggle(event, toggled) {\n this.setState({\n [event.target.name]: toggled\n });\n }", "trigger(event) {\r\n const { transitions } = this.states[this.currentState];\r\n const state = transitions[event];\r\n if (!state) {\r\n throw new Error(\"Transition event not found\");\r\n }\r\n \r\n this.updateState(state);\r\n }", "get state() {\n // Here, state is a non-enumerable property.\n return this.getState();\n }", "set (obj, prop, value) {\n let store = obj.store;\n let setStore = controller.setState.bind ({controller, store});\n setStore ({[prop]: value});\n\n return true;\n }", "function property(node, file, scope) {\n var key = t.toComputedKey(node, node.key);\n if (!t.isLiteral(key)) return; // we can't set a function id with this\n\n var name = t.toBindingIdentifierName(key.value);\n var id = t.identifier(name);\n\n var method = node.value;\n var state = visit(method, name, scope);\n node.value = wrap(state, method, id, scope) || method;\n}", "makeProp(prop, value) {\n\t\tObject.defineProperty(this, prop, {\n\t\t\tvalue,\n\t\t\tenumerable: false,\n\t\t\twritable: true,\n\t\t\tconfigurable: true\n\t\t});\n\t}", "function setupToggler(toggler, index) {\n var enlarge = toggler.find(\".pg-enlarge\");\n var shrink = toggler.find(\".pg-shrink\");\n var current_data = config.images[index];\n current_data.image_wrapper.addClass(\"pg-fitted\");\n\n current_data.toggler = toggler;\n current_data.toggler.enlarge = enlarge;\n current_data.toggler.shrink = shrink;\n\n enlarge.click(function() {\n current_data.image_wrapper.animate({\n width: \"616px\"\n }, 200);\n current_data.image_wrapper.find(\"a.photo img\").animate({\n width: \"616px\"\n }, 200);\n enlarge.hide();\n shrink.show();\n var t = setTimeout(function() { verifyWrapperHeight(); }, 450);\n });\n\n enlarge.children(\".pg-toggler-button\").hover(\n function() {\n enlarge.children(\".pg-toggler-label\").show();\n },\n\n function() {\n enlarge.children(\".pg-toggler-label\").hide();\n }\n );\n\n enlarge.children(\".pg-toggler-label\").hover(\n function() {\n enlarge.children(\".pg-toggler-label\").show();\n },\n function() {\n enlarge.children(\".pg-toggler-label\").hide();\n }\n );\n\n shrink.click(function() {\n current_data.image_wrapper.animate({\n width: \"339px\"\n }, 250);\n current_data.image_wrapper.find(\"a.photo img\").animate({\n width: \"339px\"\n }, 250);\n shrink.hide();\n enlarge.show();\n var t = setTimeout(function() { verifyWrapperHeight(); }, 450);\n });\n\n shrink.children(\".pg-toggler-button\").hover(\n function() {\n shrink.children(\".pg-toggler-label\").show();\n },\n function() {\n shrink.children(\".pg-toggler-label\").hide();\n }\n );\n\n shrink.children(\".pg-toggler-label\").hover(\n function() {\n shrink.children(\".pg-toggler-label\").show();\n },\n function() {\n shrink.children(\".pg-toggler-label\").hide();\n }\n );\n }", "trigger(event) {\r\n if(!this.allStates[this.currentState].transitions[event])\r\n throw new Error(\"Error! Wrong Event!\");\r\n\r\n this.historyStates.push(this.currentState);\r\n this.currentState = this.allStates[this.historyStates[this.historyStates.length-1]].transitions[event];\r\n this.specialRedoArray = [];\r\n }", "async setTargetDoorState(value, callback) {\n const action = {\n open: { state: 'opening', relay: DO.open },\n closed: { state: 'closing', relay: DO.close }\n }[value];\n if (this.currentState == value || this.currentState == action.state) {\n this.log('Door is already ' + this.currentState);\n } else {\n // Start opening or closing the door\n try {\n await this.pulseRelay(action.relay);\n } catch (e) {\n this.emit('error', e);\n return callback(e);\n }\n\n // Update the door state to match\n this.updateDoorPosition(action.state);\n }\n callback();\n }", "stateChanged(state) {\n }", "function py(e,t){var n=e||[!0,!1],r=K();t===void 0?r=K(n[1]):$t(t)?r=t:r=K(t);var a=function(i){i!==void 0?r.value=i:r.value=r.value===n[1]?n[0]:n[1]};return{state:r,toggle:a}}", "function makeTrigger(trigger) {\n if (!trigger) {\n return noop;\n }\n\n if (typeof trigger === 'function') {\n return trigger;\n }\n\n var eventName = trigger;\n\n return function doTrigger(newValue, oldValue) {\n // Trigger an event that has the new and old values under detail\n return this.trigger(eventName, {\n oldValue: oldValue,\n value: newValue\n });\n };\n }", "trigger(event) {\r\n if (this.config.states[this.currentState].transitions[event]) {\r\n this.currentState = this.config.states[this.currentState].transitions[event];\r\n this.history.push(this.currentState);\r\n this.isRedo = false;\r\n } else {\r\n throw new Error();\r\n }\r\n }", "get actuatorState() { return this._actuatorState; }", "toggleState() {\n\n // Update the state to the opposite of what it is currently\n this.state = !this.state;\n }", "_updateStateValue(prop, v) {\n return new Promise((resolve, reject) => {\n var c = this._component\n if(c.state && c.state[prop] !== undefined){\n var state = {}\n state[prop] = v\n c.setState(state, resolve)\n }else{\n c[prop] = v\n c.forceUpdate()\n resolve()\n }\n })\n }", "function makeWatcher(property) {\n return function (val, oldVal) {\n for (const attr in oldVal) {\n if (!Object.prototype.hasOwnProperty.call(val, attr)) {\n this.$delete(this.$data[property], attr);\n }\n }\n\n for (const attr in val) {\n this.$set(this.$data[property], attr, val[attr]);\n }\n };\n}", "function makeWatcher(property) {\n return function (val, oldVal) {\n for (const attr in oldVal) {\n if (!Object.prototype.hasOwnProperty.call(val, attr)) {\n this.$delete(this.$data[property], attr);\n }\n }\n\n for (const attr in val) {\n this.$set(this.$data[property], attr, val[attr]);\n }\n };\n}", "function makeWatcher(property) {\n return function (val, oldVal) {\n for (const attr in oldVal) {\n if (!Object.prototype.hasOwnProperty.call(val, attr)) {\n this.$delete(this.$data[property], attr);\n }\n }\n\n for (const attr in val) {\n this.$set(this.$data[property], attr, val[attr]);\n }\n };\n}", "function makeWatcher(property) {\n return function (val, oldVal) {\n for (const attr in oldVal) {\n if (!Object.prototype.hasOwnProperty.call(val, attr)) {\n this.$delete(this.$data[property], attr);\n }\n }\n\n for (const attr in val) {\n this.$set(this.$data[property], attr, val[attr]);\n }\n };\n}", "function makeWatcher(property) {\n return function (val, oldVal) {\n for (const attr in oldVal) {\n if (!Object.prototype.hasOwnProperty.call(val, attr)) {\n this.$delete(this.$data[property], attr);\n }\n }\n\n for (const attr in val) {\n this.$set(this.$data[property], attr, val[attr]);\n }\n };\n}", "componentWillReceiveProps (property) {\n\t\tthis.setState({\n\t\t\tincreasing: property.val > this.props.val\n\t\t});\n\t}", "trigger(event) {\r\n let state = this.states[this.currentState];\r\n if (!state.transitions[event]) throw new SyntaxError (\"there is no state\");\r\n this.history.splice(this.step+1);\r\n this.changeState(state.transitions[event]);\r\n }", "function SomaClickState() {\n setState(stateValue = stateValue + 1); // Mesma coisa que isso state[1](stateValue);\n // Por setState ser uma funcao ele temq ue ser escrito seu nome e parenteses\n }", "handleToggleElementValue() {\n this.setState(prevState => ({\n showElementValue: !prevState.showElementValue\n }));\n }", "function initializeState(property) {\n var result;\n // Look through all selections for this property;\n // values should all match by the time we perform\n // this lookup anyway.\n self.selection.forEach(function (selected) {\n result = (selected[property] !== undefined) ?\n self.lookupState(property, selected) :\n result;\n });\n return result;\n }", "function WgMut2WayActionLink(props) {\n const customNames = props.actionNames !== undefined;\n const representedValues = props.representedValues || [false, true];\n return (\n\t<WgMutexActionLink\n\t name={props.name}\n\t className={props.variableName}\n\t equityTestingForEnabled={{\n\t currentValue: props.value,\n\t representedValuesArray: representedValues\n\t }}\n\t actions={[\n\t {\n\t\t name: customNames ? props.actionNames[0] : \"off\",\n\t\t cb: props.hofCB(props.variableName, representedValues[0])\n\t },{\n\t\t name: customNames ? props.actionNames[1] : \"on\",\n\t\t cb: props.hofCB(props.variableName, representedValues[1])\n\t }\n\t ]}\n\t />\n );\n}", "handleChange(value,propThatNeedsToChange){\n var newObj = {}\n newObj[propThatNeedsToChange]= value\n this.setState(newObj)\n}", "function makeWatcher(property) {\n return function (val, oldVal) {\n for (var attr in oldVal) {\n if (!Object.prototype.hasOwnProperty.call(val, attr)) {\n this.$delete(this.$data[property], attr);\n }\n }\n\n for (var _attr in val) {\n this.$set(this.$data[property], _attr, val[_attr]);\n }\n };\n}", "function onValue(object, property, callback) {\n Object.defineProperty(object, property, {\n enumerable: true,\n configurable: true,\n get: function () { return; },\n set: function (v) {\n Object.defineProperty(object, property, {\n enumerable: true,\n configurable: true,\n value: v\n });\n // Protect from callback errors.\n try {\n callback(v);\n } catch (e) {\n console.error(\"Error trying to invoke callback for %s: %o\", property, e);\n }\n }\n });\n }", "function defineProperty (key, handler, value) {\n Object.defineProperty(ctrl, key, {\n get: function () { return value; },\n set: function (newValue) {\n var oldValue = value;\n value = newValue;\n handler(newValue, oldValue);\n }\n });\n }", "function defineProperty (key, handler, value) {\n Object.defineProperty(ctrl, key, {\n get: function () { return value; },\n set: function (newValue) {\n var oldValue = value;\n value = newValue;\n handler(newValue, oldValue);\n }\n });\n }", "function defineProperty (key, handler, value) {\n Object.defineProperty(ctrl, key, {\n get: function () { return value; },\n set: function (newValue) {\n var oldValue = value;\n value = newValue;\n handler(newValue, oldValue);\n }\n });\n }", "function reducer(state, action){ // assume state = { name: 'NAVS', isVisible: false}\n switch(action.type){\n case 'Test_action' :\n return {...state, isVisible: true}\n default: return state\n }\n}", "change() {\n this._updateValueProperty();\n\n this.sendAction('action', this.get('value'), this);\n }", "function makeWatcher(property) {\n return function (val, oldVal) {\n for (var attr in oldVal) {\n if (!Object.prototype.hasOwnProperty.call(val, attr)) {\n this.$delete(this.$data[property], attr);\n }\n }\n\n for (var attr in val) {\n this.$set(this.$data[property], attr, val[attr]);\n }\n };\n}", "function makeWatcher(property) {\n return function (val, oldVal) {\n for (var attr in oldVal) {\n if (!Object.prototype.hasOwnProperty.call(val, attr)) {\n this.$delete(this.$data[property], attr);\n }\n }\n\n for (var attr in val) {\n this.$set(this.$data[property], attr, val[attr]);\n }\n };\n}", "function makeWatcher(property) {\n return function (val, oldVal) {\n for (var attr in oldVal) {\n if (!Object.prototype.hasOwnProperty.call(val, attr)) {\n this.$delete(this.$data[property], attr);\n }\n }\n\n for (var attr in val) {\n this.$set(this.$data[property], attr, val[attr]);\n }\n };\n}", "function makeWatcher(property) {\n return function (val, oldVal) {\n for (var attr in oldVal) {\n if (!Object.prototype.hasOwnProperty.call(val, attr)) {\n this.$delete(this.$data[property], attr);\n }\n }\n\n for (var attr in val) {\n this.$set(this.$data[property], attr, val[attr]);\n }\n };\n}", "function makeWatcher(property) {\n return function (val, oldVal) {\n for (var attr in oldVal) {\n if (!Object.prototype.hasOwnProperty.call(val, attr)) {\n this.$delete(this.$data[property], attr);\n }\n }\n\n for (var attr in val) {\n this.$set(this.$data[property], attr, val[attr]);\n }\n };\n}", "function makeWatcher(property) {\n return function (val, oldVal) {\n for (var attr in oldVal) {\n if (!Object.prototype.hasOwnProperty.call(val, attr)) {\n this.$delete(this.$data[property], attr);\n }\n }\n\n for (var attr in val) {\n this.$set(this.$data[property], attr, val[attr]);\n }\n };\n}", "function track(property, thisArg){\n if(!(property in trackedProperties)){\n trackedProperties[property] = true;\n values[property] = model[property];\n Object.defineProperty(model, property, {\n get: function () { return values[property]; },\n set: function(newValue) {\n var oldValue = values[property];\n values[property] = newValue;\n getListeners(property).forEach(function(callback){\n callback.call(thisArg, newValue, oldValue);\n });\n }\n });\n }\n }", "handleChange(value) {\n return () => {\n let newValue = this.state.sliderValue + value\n console.debug(this, 'dispatching slide event')\n window.dispatchEvent(new CustomEvent('slide', {detail: {newValue: newValue}}))\n }\n }", "function PropertyFieldCheckboxWithCallout(targetProperty, properties) {\n return new PropertyFieldCheckboxWithCalloutBuilder(targetProperty, __assign({}, properties, { onRender: null, onDispose: null }));\n}", "toggleLike() {\n const { _id, liked } = this.props\n this.props.onChange(_id, { liked: !liked})\n }", "toggleAnimationState(event, state) {\n let expand = state === \"expand\" ? true : false\n this.setState({ expand })\n }", "set(property, value) {\n return this[property] = value;\n }" ]
[ "0.5624407", "0.5624407", "0.5624407", "0.56162673", "0.52129716", "0.51249146", "0.5085456", "0.50650775", "0.5043587", "0.5028423", "0.49811652", "0.49747854", "0.4938197", "0.49364012", "0.49305844", "0.49178904", "0.4913725", "0.48937052", "0.48874176", "0.4885378", "0.48707607", "0.48679632", "0.48238543", "0.48129055", "0.47624147", "0.47601354", "0.47356215", "0.47317523", "0.47315997", "0.47240326", "0.47227636", "0.47142664", "0.47088397", "0.47082168", "0.46921763", "0.46850574", "0.468162", "0.46673882", "0.46578887", "0.46536908", "0.46272504", "0.46272504", "0.4626674", "0.4599564", "0.458379", "0.45720115", "0.45578998", "0.45386058", "0.4537619", "0.4529277", "0.45257336", "0.4524206", "0.45141187", "0.45098743", "0.45039675", "0.4501124", "0.45007133", "0.44888622", "0.44883406", "0.4472936", "0.44598696", "0.4455725", "0.44503245", "0.44496349", "0.44482383", "0.4439051", "0.44310328", "0.44272262", "0.4422422", "0.4420191", "0.44004804", "0.44004804", "0.44004804", "0.44004804", "0.44004804", "0.439967", "0.4398362", "0.43926713", "0.43851107", "0.43840027", "0.43839163", "0.43833032", "0.4383144", "0.4380732", "0.43803176", "0.43803176", "0.43803176", "0.43788373", "0.43700427", "0.436729", "0.436729", "0.436729", "0.436729", "0.436729", "0.436729", "0.43638158", "0.4361739", "0.4359261", "0.43560103", "0.43556416", "0.43549564" ]
0.0
-1
Factory to get the line and columnbased `position` for `offset` in the bound indices.
function offsetToPositionFactory(indices) { return offsetToPosition /* Get the line and column-based `position` for * `offset` in the bound indices. */ function offsetToPosition(offset) { var index = -1 var length = indices.length if (offset < 0) { return {} } while (++index < length) { if (indices[index] > offset) { return { line: index + 1, column: offset - (indices[index - 1] || 0) + 1, offset: offset } } } return {} } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function positionToOffsetFactory(indices) {\n return positionToOffset\n\n // Get the `offset` for a line and column-based `position` in the bound\n // indices.\n function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }\n}", "function positionToOffsetFactory(indices) {\n return positionToOffset\n\n // Get the `offset` for a line and column-based `position` in the bound\n // indices.\n function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }\n}", "function positionToOffsetFactory(indices) {\n return positionToOffset\n\n // Get the `offset` for a line and column-based `position` in the bound\n // indices.\n function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }\n}", "function offsetToPositionFactory(indices) {\n return offsetToPosition\n\n // Get the line and column-based `position` for `offset` in the bound indices.\n function offsetToPosition(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }\n}", "function offsetToPositionFactory(indices) {\n return offsetToPosition\n\n // Get the line and column-based `position` for `offset` in the bound indices.\n function offsetToPosition(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }\n}", "function offsetToPositionFactory(indices) {\n return offsetToPosition\n\n // Get the line and column-based `position` for `offset` in the bound indices.\n function offsetToPosition(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }\n}", "function positionToOffsetFactory(indices) {\n return positionToOffset\n\n /* Get the `offset` for a line and column-based\n * `position` in the bound indices. */\n function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }\n}", "function positionToOffsetFactory(indices) {\n return positionToOffset\n\n /* Get the `offset` for a line and column-based\n * `position` in the bound indices. */\n function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }\n}", "function offsetToPosition(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }", "function offsetToPosition(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }", "function offsetToPosition(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }", "function offsetToPosition(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }", "function offsetToPosition(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }", "function pointToOffsetFactory(indices) {\n return pointToOffset\n\n // Get the `offset` for a line and column-based `point` in the bound\n // indices.\n function pointToOffset(point) {\n var line = point && point.line\n var column = point && point.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }\n}", "function offsetToPointFactory(indices) {\n return offsetToPoint\n\n // Get the line and column-based `point` for `offset` in the bound indices.\n function offsetToPoint(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }\n}", "position_from_offset(offset) {\n const [col, row] = this.col_row_from_offset(offset);\n return new Position(col, row);\n }", "function offsetToPoint(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }", "function offsetToPoint(offset) {\n var index = -1\n\n if (offset > -1 && offset < indices[indices.length - 1]) {\n while (++index < indices.length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n }\n\n return {}\n }", "function offsetToPoint(offset) {\n var index = -1\n\n if (offset > -1 && offset < indices[indices.length - 1]) {\n while (++index < indices.length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n }\n\n return {}\n }", "positionAt(offset) {\n return (0, utils_1.positionAt)(offset, this.getText(), this.getLineOffsets());\n }", "function offsetToPoint(offset) {\n var index = -1;\n\n if (offset > -1 && offset < indices[indices.length - 1]) {\n while (++index < indices.length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n }\n\n return {}\n }", "getLineAndColumnFromChunk(offset) {\r\n\t\t\t\tvar column, columnCompensation, compensation, lastLine, lineCount, previousLinesCompensation, ref, string;\r\n\t\t\t\tcompensation = this.getLocationDataCompensation(this.chunkOffset, this.chunkOffset + offset);\r\n\t\t\t\tif (offset === 0) {\r\n\t\t\t\t\treturn [this.chunkLine, this.chunkColumn + compensation, this.chunkOffset + compensation];\r\n\t\t\t\t}\r\n\t\t\t\tif (offset >= this.chunk.length) {\r\n\t\t\t\t\tstring = this.chunk;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tstring = this.chunk.slice(0, +(offset - 1) + 1 || 9e9);\r\n\t\t\t\t}\r\n\t\t\t\tlineCount = count(string, '\\n');\r\n\t\t\t\tcolumn = this.chunkColumn;\r\n\t\t\t\tif (lineCount > 0) {\r\n\t\t\t\t\tref = string.split('\\n'), [lastLine] = slice.call(ref, -1);\r\n\t\t\t\t\tcolumn = lastLine.length;\r\n\t\t\t\t\tpreviousLinesCompensation = this.getLocationDataCompensation(this.chunkOffset, this.chunkOffset + offset - column);\r\n\t\t\t\t\tif (previousLinesCompensation < 0) {\r\n\t\t\t\t\t\t// Don't recompensate for initially inserted newline.\r\n\t\t\t\t\t\tpreviousLinesCompensation = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcolumnCompensation = this.getLocationDataCompensation(this.chunkOffset + offset + previousLinesCompensation - column, this.chunkOffset + offset + previousLinesCompensation);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcolumn += string.length;\r\n\t\t\t\t\tcolumnCompensation = compensation;\r\n\t\t\t\t}\r\n\t\t\t\treturn [this.chunkLine + lineCount, column + columnCompensation, this.chunkOffset + offset + compensation];\r\n\t\t\t}", "col_row_offset_from_offset(offset) {\n return [\n this.cell_from_offset(this.cell_width, offset.left),\n this.cell_from_offset(this.cell_height, offset.top),\n ];\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 }", "cell_from_offset(sizes, offset) {\n // We explore the grid in both directions, starting from the origin.\n let index = 0;\n const original_offset = offset;\n if (offset === 0) {\n return [index, 0];\n }\n // The following two loops have been kept separate to increase readability.\n // Explore to the right or bottom...\n while (offset >= 0) {\n const size = this.cell_size(sizes, index);\n if (offset < size) {\n return [index, original_offset - offset];\n }\n offset -= size;\n ++index;\n }\n // Explore to the left or top...\n while (offset <= 0) {\n --index;\n const size = this.cell_size(sizes, index);\n if (Math.abs(offset) < size) {\n return [index, original_offset - (offset + size)];\n }\n offset += size;\n }\n }", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur);\n }\n }\n }", "positionAt(offset) {\n const before = this.textDocument.slice(0, offset);\n const newLines = before.match(/\\n/g);\n const line = newLines ? newLines.length : 0;\n const preCharacters = before.match(/(\\n|^).*$/g);\n return new tokenizer_1.Position(line, preCharacters ? preCharacters[0].length : 0);\n }", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur);\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur);\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n var match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n var match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n }", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n }", "createPosition () {\n\t\treturn {\n\t\t\tstart: {\n\t\t\t\tline: this.line,\n\t\t\t\tcolumn: this.col\n\t\t\t},\n\t\t\tsource: this.source,\n\t\t\trange: [ this.pos ]\n\t\t};\n\t}", "function getLineInfo(input, offset) {\n\t for (var line = 1, cur = 0;;) {\n\t lineBreakG.lastIndex = cur;\n\t var match = lineBreakG.exec(input);\n\t if (match && match.index < offset) {\n\t ++line;\n\t cur = match.index + match[0].length;\n\t } else {\n\t return new Position(line, offset - cur);\n\t }\n\t }\n\t}", "function getLineInfo(input, offset) {\n\t for (var line = 1, cur = 0;;) {\n\t lineBreakG.lastIndex = cur;\n\t var match = lineBreakG.exec(input);\n\t if (match && match.index < offset) {\n\t ++line;\n\t cur = match.index + match[0].length;\n\t } else {\n\t return new Position(line, offset - cur);\n\t }\n\t }\n\t}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function offset_function(_, i){\n var x = -0.5 + ( Math.floor(i / num_cell) ) / num_cell ;\n var y = -0.5 + (i % num_cell) / num_cell ;\n return [x, y];\n }", "offset_from_position(position) {\n const offset = Offset.zero();\n\n // We attempt to explore in each of the four directions in turn.\n // These four loops could be simplified, but have been left as-is to aid readability.\n\n if (position.x > 0) {\n for (let col = 0; col < Math.floor(position.x); ++col) {\n offset.left += this.cell_size(this.cell_width, col);\n }\n offset.left\n += this.cell_size(this.cell_width, Math.floor(position.x)) * (position.x % 1);\n }\n if (position.x < 0) {\n for (let col = -1; col >= position.x; --col) {\n offset.left -= this.cell_size(this.cell_width, col);\n }\n offset.left\n += this.cell_size(this.cell_width, Math.floor(position.x)) * (position.x % 1);\n }\n\n if (position.y > 0) {\n for (let row = 0; row < Math.floor(position.y); ++row) {\n offset.top += this.cell_size(this.cell_height, row);\n }\n offset.top\n += this.cell_size(this.cell_height, Math.floor(position.y)) * (position.y % 1);\n }\n if (position.y < 0) {\n for (let row = -1; row >= position.y; --row) {\n offset.top -= this.cell_size(this.cell_height, row);\n }\n offset.top\n += this.cell_size(this.cell_height, Math.floor(position.y)) * (position.y % 1);\n }\n\n return offset;\n }", "function grid_from_offset(pos){\n\t \tvar location = {\n\t \t\tcol: Math.floor(pos.left/tileWidth) + 1,\n\t \t\trow: Math.floor(pos.top/tileHeight) + 1\n\t \t}\n\t \treturn location;\n\t }", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n var nextBreak = nextLineBreak(input, cur, offset);\n if (nextBreak < 0) { return new Position(line, offset - cur) }\n ++line;\n cur = nextBreak;\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n var nextBreak = nextLineBreak(input, cur, offset);\n if (nextBreak < 0) { return new Position(line, offset - cur) }\n ++line;\n cur = nextBreak;\n }\n }", "col_row_from_offset(offset) {\n return this.col_row_offset_from_offset(offset).map(([index, _]) => index);\n }", "function computeInOffsetByIndex(x, y, index) {\n var outx = x + 15;\n var outy = y + 47 + index * 20;\n\n return { x: outx, y: outy };\n}", "offsetAt(position) {\n return (0, utils_1.offsetAt)(position, this.getText(), this.getLineOffsets());\n }", "function getLineInfo(input, offset) {\n\t for (var line = 1, cur = 0;;) {\n\t _whitespace.lineBreakG.lastIndex = cur;\n\t var match = _whitespace.lineBreakG.exec(input);\n\t if (match && match.index < offset) {\n\t ++line;\n\t cur = match.index + match[0].length;\n\t } else {\n\t return new Position(line, offset - cur);\n\t }\n\t }\n\t}", "function getLineInfo(input, offset) {\n\t for (var line = 1, cur = 0;;) {\n\t _whitespace.lineBreakG.lastIndex = cur;\n\t var match = _whitespace.lineBreakG.exec(input);\n\t if (match && match.index < offset) {\n\t ++line;\n\t cur = match.index + match[0].length;\n\t } else {\n\t return new Position(line, offset - cur);\n\t }\n\t }\n\t}", "function getLocation(source, position) {\n let lastLineStart = 0;\n let line = 1;\n\n for (const match of source.body.matchAll(LineRegExp)) {\n typeof match.index === 'number' || invariant(false);\n\n if (match.index >= position) {\n break;\n }\n\n lastLineStart = match.index + match[0].length;\n line += 1;\n }\n\n return {\n line,\n column: position + 1 - lastLineStart,\n };\n}", "function xyOffsetIndex(i, x, y, w, h) {\n var index = i + x + y * w;\n var absx = (i % w) + x;\n if (absx < 0 && index < 0 || absx >= w && index >= w * h) {\n return i - x - y * w;\n }\n if (absx < 0 || absx >= w) { // if off the left.\n return i - x + y * w;\n }\n //var absy = index - (w * y)\n if (index < 0 || index >= w * h) { // if off top/bottom.\n return i + x - y * w;\n }\n return index;\n}", "function getLineElementsAtPageOffset(offset) {\n\t\tconst lines = document.getElementsByClassName('code-line');\n\t\tconst position = offset - window.scrollY;\n\t\tlet previous = null;\n\t\tfor (const element of lines) {\n\t\t\tconst line = +element.getAttribute('data-line');\n\t\t\tif (isNaN(line)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst bounds = element.getBoundingClientRect();\n\t\t\tconst entry = { element, line };\n\t\t\tif (position < bounds.top) {\n\t\t\t\tif (previous && previous.fractional < 1) {\n\t\t\t\t\tprevious.line += previous.fractional;\n\t\t\t\t\treturn { previous };\n\t\t\t\t}\n\t\t\t\treturn { previous, next: entry };\n\t\t\t}\n\t\t\tentry.fractional = (position - bounds.top) / (bounds.height);\n\t\t\tprevious = entry;\n\t\t}\n\t\treturn { previous };\n\t}", "function computeOffset(position, data) {\n let line = position.line;\n let column = position.column + 1;\n for (let i = 0; i < data.length; i++) {\n if (line > 1) {\n /* not yet on the correct line */\n if (data[i] === \"\\n\") {\n line--;\n }\n }\n else if (column > 1) {\n /* not yet on the correct column */\n column--;\n }\n else {\n /* line/column found, return current position */\n return i;\n }\n }\n /* istanbul ignore next: should never reach this line unless espree passes bad\n * positions, no sane way to test */\n throw new Error(\"Failed to compute location offset from position\");\n}", "getCurrentLocation(offset) {\n if (!this.options.sourceCodeLocationInfo) {\n return null;\n }\n return {\n startLine: this.preprocessor.line,\n startCol: this.preprocessor.col - offset,\n startOffset: this.preprocessor.offset - offset,\n endLine: -1,\n endCol: -1,\n endOffset: -1,\n };\n }", "function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }", "function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }", "function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }", "function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }", "function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }", "generatedPositionFor(aArgs) {\n let source = util.getArg(aArgs, 'source')\n source = this._findSourceIndex(source)\n if (source < 0) {\n return {\n line: null,\n column: null,\n lastColumn: null,\n }\n }\n\n const needle = {\n source,\n originalLine: util.getArg(aArgs, 'line'),\n originalColumn: util.getArg(aArgs, 'column'),\n }\n\n if (needle.originalLine < 1) {\n throw new Error('Line numbers must be >= 1')\n }\n\n if (needle.originalColumn < 0) {\n throw new Error('Column numbers must be >= 0')\n }\n\n let bias = util.getArg(\n aArgs,\n 'bias',\n SourceMapConsumer.GREATEST_LOWER_BOUND\n )\n if (bias == null) {\n bias = SourceMapConsumer.GREATEST_LOWER_BOUND\n }\n\n let mapping\n this._wasm.withMappingCallback(\n (m) => (mapping = m),\n () => {\n this._wasm.exports.generated_location_for(\n this._getMappingsPtr(),\n needle.source,\n needle.originalLine - 1,\n needle.originalColumn,\n bias\n )\n }\n )\n\n if (mapping) {\n if (mapping.source === needle.source) {\n let lastColumn = mapping.lastGeneratedColumn\n if (this._computedColumnSpans && lastColumn === null) {\n lastColumn = Infinity\n }\n return {\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn,\n }\n }\n }\n\n return {\n line: null,\n column: null,\n lastColumn: null,\n }\n }", "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 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 }", "offset() {\n if (this.overlap) return this.dot ? 8 : 12;\n return this.dot ? 2 : 4;\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 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 posToIndex(pos) {\n var row = pos[0];\n var col = pos[1];\n return (row * 4) + col;\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 }", "generatedPositionFor(aArgs) {\n for (let i = 0; i < this._sections.length; i++) {\n const section = this._sections[i]\n\n // Only consider this section if the requested source is in the list of\n // sources of the consumer.\n if (\n section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1\n ) {\n continue\n }\n const generatedPosition = section.consumer.generatedPositionFor(aArgs)\n if (generatedPosition) {\n const ret = {\n line:\n generatedPosition.line +\n (section.generatedOffset.generatedLine - 1),\n column:\n generatedPosition.column +\n (section.generatedOffset.generatedLine === generatedPosition.line\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n }\n return ret\n }\n }\n\n return {\n line: null,\n column: null,\n }\n }", "calculateOffset(offset) {\n\n // Note: vec3 has the same alignment as vec4\n let alignment = this.byteSize <= 8 ? this.byteSize : 16;\n\n // arrays have vec4 alignments\n if (this.count)\n alignment = 16;\n\n // align the start offset\n offset = math.roundUp(offset, alignment);\n this.offset = offset / 4;\n }", "function getPosition(offset, size) {\n return Math.round(-1 * offset + Math.random() * (size + 2 * offset));\n }", "focusOfPosition(pos, rowOffset) {\n const rowIndex = pos.row - rowOffset;\n const row = this._rows[rowIndex];\n if (row === undefined) {\n return undefined;\n }\n if (pos.column < row.marginLeft.length + 1) {\n return new focus_1.Focus(rowIndex, -1, pos.column);\n }\n const cellWidths = row.getCells().map((cell) => cell.rawContent.length);\n let columnPos = row.marginLeft.length + 1; // left margin + a pipe\n let columnIndex = 0;\n for (; columnIndex < cellWidths.length; columnIndex++) {\n if (columnPos + cellWidths[columnIndex] + 1 > pos.column) {\n break;\n }\n columnPos += cellWidths[columnIndex] + 1;\n }\n const offset = pos.column - columnPos;\n return new focus_1.Focus(rowIndex, columnIndex, offset);\n }", "function computeOffset(n, startLine) {\n var pos = 0;\n for (;;) {\n var found = text.indexOf(\"\\n\", pos);\n if (found == -1 || (text.charAt(found-1) == \"\\r\" ? found - 1 : found) >= n)\n return {line: startLine, ch: n - pos};\n ++startLine;\n pos = found + 1;\n }\n }", "function computeOffset(n, startLine) {\n var pos = 0;\n for (;;) {\n var found = text.indexOf(\"\\n\", pos);\n if (found == -1 || (text.charAt(found-1) == \"\\r\" ? found - 1 : found) >= n)\n return {line: startLine, ch: n - pos};\n ++startLine;\n pos = found + 1;\n }\n }", "function computeOffset(n, startLine) {\n var pos = 0;\n for (;;) {\n var found = text.indexOf(\"\\n\", pos);\n if (found == -1 || (text.charAt(found-1) == \"\\r\" ? found - 1 : found) >= n)\n return {line: startLine, ch: n - pos};\n ++startLine;\n pos = found + 1;\n }\n }", "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 }", "function applyStyleOffsets(offset, canvas) {\n var s = calculateStyleOffsets(canvas);\n\n return {\n x: offset.x + s.padding.left + s.border.left + s.html.left,\n y: offset.y + s.padding.top + s.border.top + s.html.top\n };\n }", "originalPositionFor(aArgs) {\n const needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column'),\n }\n\n // Find the section containing the generated position we're trying to map\n // to an original position.\n const sectionIndex = binarySearch.search(\n needle,\n this._sections,\n function (aNeedle, section) {\n const cmp =\n aNeedle.generatedLine - section.generatedOffset.generatedLine\n if (cmp) {\n return cmp\n }\n\n return aNeedle.generatedColumn - section.generatedOffset.generatedColumn\n }\n )\n const section = this._sections[sectionIndex]\n\n if (!section) {\n return {\n source: null,\n line: null,\n column: null,\n name: null,\n }\n }\n\n return section.consumer.originalPositionFor({\n line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),\n column:\n needle.generatedColumn -\n (section.generatedOffset.generatedLine === needle.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n bias: aArgs.bias,\n })\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}", "lineAt(pos, bias = 1) {\n let line = this.state.doc.lineAt(pos);\n let { simulateBreak, simulateDoubleBreak } = this.options;\n if (simulateBreak != null && simulateBreak >= line.from && simulateBreak <= line.to) {\n if (simulateDoubleBreak && simulateBreak == pos)\n return { text: \"\", from: pos };\n else if (bias < 0 ? simulateBreak < pos : simulateBreak <= pos)\n return { text: line.text.slice(simulateBreak - line.from), from: simulateBreak };\n else\n return { text: line.text.slice(0, simulateBreak - line.from), from: line.from };\n }\n return line;\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.70763355", "0.70763355", "0.70763355", "0.7004144", "0.7004144", "0.7004144", "0.6975304", "0.6975304", "0.68680584", "0.68680584", "0.68680584", "0.68680584", "0.68680584", "0.6756796", "0.661255", "0.6544451", "0.6493372", "0.64535576", "0.64535576", "0.64453626", "0.64405656", "0.63403815", "0.6223772", "0.6148746", "0.6140926", "0.6016075", "0.60148895", "0.6008183", "0.6008183", "0.60048556", "0.60048556", "0.6000413", "0.6000413", "0.59931564", "0.5992724", "0.5992724", "0.59891045", "0.59891045", "0.59891045", "0.59891045", "0.59891045", "0.59891045", "0.59891045", "0.59891045", "0.59891045", "0.59891045", "0.5967194", "0.5952042", "0.5938596", "0.5909242", "0.59030306", "0.5873283", "0.58614415", "0.58233637", "0.57574785", "0.57574785", "0.5629056", "0.5617403", "0.5616136", "0.5560053", "0.54972", "0.54822063", "0.54822063", "0.54822063", "0.54822063", "0.54822063", "0.5470399", "0.54454935", "0.54382586", "0.54382586", "0.54382586", "0.54382586", "0.54382586", "0.54382586", "0.54382586", "0.54382586", "0.54352593", "0.5429785", "0.5427189", "0.5427189", "0.5427189", "0.5417188", "0.54156464", "0.5410035", "0.5408926", "0.5408242", "0.54043365", "0.5389319", "0.5389319", "0.5389319", "0.53757715", "0.53725326", "0.5372193", "0.5369386", "0.5369386", "0.5360662", "0.53559935", "0.53559935", "0.53559935" ]
0.6980898
7
Get the line and columnbased `position` for `offset` in the bound indices.
function offsetToPosition(offset) { var index = -1 var length = indices.length if (offset < 0) { return {} } while (++index < length) { if (indices[index] > offset) { return { line: index + 1, column: offset - (indices[index - 1] || 0) + 1, offset: offset } } } return {} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getLineAndColumnFromChunk(offset) {\r\n\t\t\t\tvar column, columnCompensation, compensation, lastLine, lineCount, previousLinesCompensation, ref, string;\r\n\t\t\t\tcompensation = this.getLocationDataCompensation(this.chunkOffset, this.chunkOffset + offset);\r\n\t\t\t\tif (offset === 0) {\r\n\t\t\t\t\treturn [this.chunkLine, this.chunkColumn + compensation, this.chunkOffset + compensation];\r\n\t\t\t\t}\r\n\t\t\t\tif (offset >= this.chunk.length) {\r\n\t\t\t\t\tstring = this.chunk;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tstring = this.chunk.slice(0, +(offset - 1) + 1 || 9e9);\r\n\t\t\t\t}\r\n\t\t\t\tlineCount = count(string, '\\n');\r\n\t\t\t\tcolumn = this.chunkColumn;\r\n\t\t\t\tif (lineCount > 0) {\r\n\t\t\t\t\tref = string.split('\\n'), [lastLine] = slice.call(ref, -1);\r\n\t\t\t\t\tcolumn = lastLine.length;\r\n\t\t\t\t\tpreviousLinesCompensation = this.getLocationDataCompensation(this.chunkOffset, this.chunkOffset + offset - column);\r\n\t\t\t\t\tif (previousLinesCompensation < 0) {\r\n\t\t\t\t\t\t// Don't recompensate for initially inserted newline.\r\n\t\t\t\t\t\tpreviousLinesCompensation = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcolumnCompensation = this.getLocationDataCompensation(this.chunkOffset + offset + previousLinesCompensation - column, this.chunkOffset + offset + previousLinesCompensation);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcolumn += string.length;\r\n\t\t\t\t\tcolumnCompensation = compensation;\r\n\t\t\t\t}\r\n\t\t\t\treturn [this.chunkLine + lineCount, column + columnCompensation, this.chunkOffset + offset + compensation];\r\n\t\t\t}", "function offsetToPoint(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }", "function offsetToPoint(offset) {\n var index = -1\n\n if (offset > -1 && offset < indices[indices.length - 1]) {\n while (++index < indices.length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n }\n\n return {}\n }", "function offsetToPoint(offset) {\n var index = -1\n\n if (offset > -1 && offset < indices[indices.length - 1]) {\n while (++index < indices.length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n }\n\n return {}\n }", "function offsetToPoint(offset) {\n var index = -1;\n\n if (offset > -1 && offset < indices[indices.length - 1]) {\n while (++index < indices.length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n }\n\n return {}\n }", "function positionToOffsetFactory(indices) {\n return positionToOffset\n\n // Get the `offset` for a line and column-based `position` in the bound\n // indices.\n function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }\n}", "function positionToOffsetFactory(indices) {\n return positionToOffset\n\n // Get the `offset` for a line and column-based `position` in the bound\n // indices.\n function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }\n}", "function positionToOffsetFactory(indices) {\n return positionToOffset\n\n // Get the `offset` for a line and column-based `position` in the bound\n // indices.\n function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }\n}", "positionAt(offset) {\n return (0, utils_1.positionAt)(offset, this.getText(), this.getLineOffsets());\n }", "cell_from_offset(sizes, offset) {\n // We explore the grid in both directions, starting from the origin.\n let index = 0;\n const original_offset = offset;\n if (offset === 0) {\n return [index, 0];\n }\n // The following two loops have been kept separate to increase readability.\n // Explore to the right or bottom...\n while (offset >= 0) {\n const size = this.cell_size(sizes, index);\n if (offset < size) {\n return [index, original_offset - offset];\n }\n offset -= size;\n ++index;\n }\n // Explore to the left or top...\n while (offset <= 0) {\n --index;\n const size = this.cell_size(sizes, index);\n if (Math.abs(offset) < size) {\n return [index, original_offset - (offset + size)];\n }\n offset += size;\n }\n }", "function positionToOffsetFactory(indices) {\n return positionToOffset\n\n /* Get the `offset` for a line and column-based\n * `position` in the bound indices. */\n function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }\n}", "function positionToOffsetFactory(indices) {\n return positionToOffset\n\n /* Get the `offset` for a line and column-based\n * `position` in the bound indices. */\n function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }\n}", "function offsetToPositionFactory(indices) {\n return offsetToPosition\n\n // Get the line and column-based `position` for `offset` in the bound indices.\n function offsetToPosition(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }\n}", "function offsetToPositionFactory(indices) {\n return offsetToPosition\n\n // Get the line and column-based `position` for `offset` in the bound indices.\n function offsetToPosition(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }\n}", "function offsetToPositionFactory(indices) {\n return offsetToPosition\n\n // Get the line and column-based `position` for `offset` in the bound indices.\n function offsetToPosition(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }\n}", "col_row_offset_from_offset(offset) {\n return [\n this.cell_from_offset(this.cell_width, offset.left),\n this.cell_from_offset(this.cell_height, offset.top),\n ];\n }", "function offsetToPositionFactory(indices) {\n return offsetToPosition\n\n /* Get the line and column-based `position` for\n * `offset` in the bound indices. */\n function offsetToPosition(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }\n}", "function offsetToPositionFactory(indices) {\n return offsetToPosition\n\n /* Get the line and column-based `position` for\n * `offset` in the bound indices. */\n function offsetToPosition(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }\n}", "position_from_offset(offset) {\n const [col, row] = this.col_row_from_offset(offset);\n return new Position(col, row);\n }", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n var match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n var match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur);\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur);\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur);\n }\n }\n }", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n }", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n }", "function getLineInfo(input, offset) {\n\t for (var line = 1, cur = 0;;) {\n\t lineBreakG.lastIndex = cur;\n\t var match = lineBreakG.exec(input);\n\t if (match && match.index < offset) {\n\t ++line;\n\t cur = match.index + match[0].length;\n\t } else {\n\t return new Position(line, offset - cur);\n\t }\n\t }\n\t}", "function getLineInfo(input, offset) {\n\t for (var line = 1, cur = 0;;) {\n\t lineBreakG.lastIndex = cur;\n\t var match = lineBreakG.exec(input);\n\t if (match && match.index < offset) {\n\t ++line;\n\t cur = match.index + match[0].length;\n\t } else {\n\t return new Position(line, offset - cur);\n\t }\n\t }\n\t}", "function pointToOffsetFactory(indices) {\n return pointToOffset\n\n // Get the `offset` for a line and column-based `point` in the bound\n // indices.\n function pointToOffset(point) {\n var line = point && point.line\n var column = point && point.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }\n}", "offset_from_position(position) {\n const offset = Offset.zero();\n\n // We attempt to explore in each of the four directions in turn.\n // These four loops could be simplified, but have been left as-is to aid readability.\n\n if (position.x > 0) {\n for (let col = 0; col < Math.floor(position.x); ++col) {\n offset.left += this.cell_size(this.cell_width, col);\n }\n offset.left\n += this.cell_size(this.cell_width, Math.floor(position.x)) * (position.x % 1);\n }\n if (position.x < 0) {\n for (let col = -1; col >= position.x; --col) {\n offset.left -= this.cell_size(this.cell_width, col);\n }\n offset.left\n += this.cell_size(this.cell_width, Math.floor(position.x)) * (position.x % 1);\n }\n\n if (position.y > 0) {\n for (let row = 0; row < Math.floor(position.y); ++row) {\n offset.top += this.cell_size(this.cell_height, row);\n }\n offset.top\n += this.cell_size(this.cell_height, Math.floor(position.y)) * (position.y % 1);\n }\n if (position.y < 0) {\n for (let row = -1; row >= position.y; --row) {\n offset.top -= this.cell_size(this.cell_height, row);\n }\n offset.top\n += this.cell_size(this.cell_height, Math.floor(position.y)) * (position.y % 1);\n }\n\n return offset;\n }", "col_row_from_offset(offset) {\n return this.col_row_offset_from_offset(offset).map(([index, _]) => index);\n }", "function grid_from_offset(pos){\n\t \tvar location = {\n\t \t\tcol: Math.floor(pos.left/tileWidth) + 1,\n\t \t\trow: Math.floor(pos.top/tileHeight) + 1\n\t \t}\n\t \treturn location;\n\t }", "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 getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n var nextBreak = nextLineBreak(input, cur, offset);\n if (nextBreak < 0) { return new Position(line, offset - cur) }\n ++line;\n cur = nextBreak;\n }\n}", "function getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n var nextBreak = nextLineBreak(input, cur, offset);\n if (nextBreak < 0) { return new Position(line, offset - cur) }\n ++line;\n cur = nextBreak;\n }\n }", "function offset_function(_, i){\n var x = -0.5 + ( Math.floor(i / num_cell) ) / num_cell ;\n var y = -0.5 + (i % num_cell) / num_cell ;\n return [x, y];\n }", "function computeOffset(position, data) {\n let line = position.line;\n let column = position.column + 1;\n for (let i = 0; i < data.length; i++) {\n if (line > 1) {\n /* not yet on the correct line */\n if (data[i] === \"\\n\") {\n line--;\n }\n }\n else if (column > 1) {\n /* not yet on the correct column */\n column--;\n }\n else {\n /* line/column found, return current position */\n return i;\n }\n }\n /* istanbul ignore next: should never reach this line unless espree passes bad\n * positions, no sane way to test */\n throw new Error(\"Failed to compute location offset from position\");\n}", "function getLineInfo(input, offset) {\n\t for (var line = 1, cur = 0;;) {\n\t _whitespace.lineBreakG.lastIndex = cur;\n\t var match = _whitespace.lineBreakG.exec(input);\n\t if (match && match.index < offset) {\n\t ++line;\n\t cur = match.index + match[0].length;\n\t } else {\n\t return new Position(line, offset - cur);\n\t }\n\t }\n\t}", "function getLineInfo(input, offset) {\n\t for (var line = 1, cur = 0;;) {\n\t _whitespace.lineBreakG.lastIndex = cur;\n\t var match = _whitespace.lineBreakG.exec(input);\n\t if (match && match.index < offset) {\n\t ++line;\n\t cur = match.index + match[0].length;\n\t } else {\n\t return new Position(line, offset - cur);\n\t }\n\t }\n\t}", "function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }", "function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }", "function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }", "function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }", "function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }", "function offsetToPointFactory(indices) {\n return offsetToPoint\n\n // Get the line and column-based `point` for `offset` in the bound indices.\n function offsetToPoint(offset) {\n var index = -1\n var length = indices.length\n\n if (offset < 0) {\n return {}\n }\n\n while (++index < length) {\n if (indices[index] > offset) {\n return {\n line: index + 1,\n column: offset - (indices[index - 1] || 0) + 1,\n offset: offset\n }\n }\n }\n\n return {}\n }\n}", "getCurrentLocation(offset) {\n if (!this.options.sourceCodeLocationInfo) {\n return null;\n }\n return {\n startLine: this.preprocessor.line,\n startCol: this.preprocessor.col - offset,\n startOffset: this.preprocessor.offset - offset,\n endLine: -1,\n endCol: -1,\n endOffset: -1,\n };\n }", "function xyOffsetIndex(i, x, y, w, h) {\n var index = i + x + y * w;\n var absx = (i % w) + x;\n if (absx < 0 && index < 0 || absx >= w && index >= w * h) {\n return i - x - y * w;\n }\n if (absx < 0 || absx >= w) { // if off the left.\n return i - x + y * w;\n }\n //var absy = index - (w * y)\n if (index < 0 || index >= w * h) { // if off top/bottom.\n return i + x - y * w;\n }\n return index;\n}", "offset() {\n if (this.overlap) return this.dot ? 8 : 12;\n return this.dot ? 2 : 4;\n }", "function computeInOffsetByIndex(x, y, index) {\n var outx = x + 15;\n var outy = y + 47 + index * 20;\n\n return { x: outx, y: outy };\n}", "positionAt(offset) {\n const before = this.textDocument.slice(0, offset);\n const newLines = before.match(/\\n/g);\n const line = newLines ? newLines.length : 0;\n const preCharacters = before.match(/(\\n|^).*$/g);\n return new tokenizer_1.Position(line, preCharacters ? preCharacters[0].length : 0);\n }", "function getLocation(source, position) {\n let lastLineStart = 0;\n let line = 1;\n\n for (const match of source.body.matchAll(LineRegExp)) {\n typeof match.index === 'number' || invariant(false);\n\n if (match.index >= position) {\n break;\n }\n\n lastLineStart = match.index + match[0].length;\n line += 1;\n }\n\n return {\n line,\n column: position + 1 - lastLineStart,\n };\n}", "function posToIndex(pos) {\n var row = pos[0];\n var col = pos[1];\n return (row * 4) + col;\n}", "function getLineElementsAtPageOffset(offset) {\n\t\tconst lines = document.getElementsByClassName('code-line');\n\t\tconst position = offset - window.scrollY;\n\t\tlet previous = null;\n\t\tfor (const element of lines) {\n\t\t\tconst line = +element.getAttribute('data-line');\n\t\t\tif (isNaN(line)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst bounds = element.getBoundingClientRect();\n\t\t\tconst entry = { element, line };\n\t\t\tif (position < bounds.top) {\n\t\t\t\tif (previous && previous.fractional < 1) {\n\t\t\t\t\tprevious.line += previous.fractional;\n\t\t\t\t\treturn { previous };\n\t\t\t\t}\n\t\t\t\treturn { previous, next: entry };\n\t\t\t}\n\t\t\tentry.fractional = (position - bounds.top) / (bounds.height);\n\t\t\tprevious = entry;\n\t\t}\n\t\treturn { previous };\n\t}", "getCursorPosition (offset = true) {\n return this.api.getCursorPosition(offset)\n }", "findTokenIndexAtOffset(offset) {\r\n return LineTokens.findIndexInTokensArray(this._tokens, offset);\r\n }", "offsetAt(position) {\n return (0, utils_1.offsetAt)(position, this.getText(), this.getLineOffsets());\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) {\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\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) {\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\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 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 }", "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 }" ]
[ "0.66768277", "0.6669494", "0.6658669", "0.6658669", "0.6652049", "0.6435141", "0.6435141", "0.6435141", "0.6418775", "0.63339", "0.6331776", "0.6331776", "0.6272726", "0.6272726", "0.6272726", "0.6272628", "0.6261748", "0.6261748", "0.62456626", "0.6239385", "0.6239385", "0.6237196", "0.6237196", "0.6225732", "0.6225732", "0.6225732", "0.6225732", "0.6225732", "0.6225732", "0.6225732", "0.6225732", "0.6225732", "0.6225732", "0.6211509", "0.6208362", "0.6208362", "0.6206408", "0.6206408", "0.60835916", "0.6072314", "0.60683656", "0.60582924", "0.6053929", "0.6020571", "0.599112", "0.5936321", "0.5935049", "0.5929309", "0.5929309", "0.5895891", "0.5895891", "0.5895891", "0.5895891", "0.5895891", "0.5871384", "0.5838068", "0.5836677", "0.5834263", "0.58295566", "0.5800173", "0.5780624", "0.5774877", "0.57675505", "0.5766647", "0.5720401", "0.570911", "0.5694148", "0.5694148", "0.5694148", "0.5694148", "0.5694148", "0.5694148", "0.5694148", "0.5694148", "0.5682963", "0.5669241", "0.56682813", "0.56682813", "0.56682813", "0.562671", "0.562671", "0.5619319", "0.5619319", "0.5619319", "0.5619319", "0.5619319", "0.5619319", "0.5619319", "0.5619319", "0.5619319", "0.5619319", "0.5619319", "0.5619319", "0.5619319", "0.5619319", "0.5619319" ]
0.7061033
3