Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Remove a span from an array, returning undefined if no spans are left (we don't store arrays for lines without spans).
function removeMarkedSpan(spans, span) { var r; for (var i = 0; i < spans.length; ++i) { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } } return r }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r...
[ "0.74046427", "0.7398266", "0.7398266", "0.7398266", "0.7398266", "0.7398266", "0.7398266", "0.7398266", "0.73859435", "0.73859435", "0.73859435", "0.736235", "0.7315828", "0.7315045", "0.7235346", "0.7223111", "0.7223111", "0.72049785", "0.72049785", "0.72049785", "0.7204978...
0.72939557
27
Add a span to a line.
function addMarkedSpan(line, span) { line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]; span.marker.attachLine(line); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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.attachLi...
[ "0.76911736", "0.7679438", "0.7679438", "0.76691914", "0.76642555", "0.76642555", "0.76642555", "0.76642555", "0.76642555", "0.76642555", "0.76642555", "0.76642555", "0.76642555", "0.76642555", "0.76642555", "0.7613118", "0.7613118", "0.7613118", "0.7579766", "0.70806646", "0...
0.7690837
15
Used for the algorithm that adjusts markers for a change in the document. These functions cut an array of spans at a given character position, returning an array of remaining chunks (or undefined if nothing remains).
function markedSpansBefore(old, startCh, isInsert) { var nw; if (old) { for (var i = 0; i < old.length; ++i) { var span = old[i], marker = span.marker; var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh); if (startsBefore || span.from == ...
{ "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 removeClearedSpans(spans) {\n if (!s...
[ "0.5492667", "0.5491162", "0.54809946", "0.5466656", "0.5466656", "0.5466656", "0.5458964", "0.5458964", "0.5458964", "0.5458964", "0.5458964", "0.5458964", "0.5458964", "0.54447305", "0.54423624", "0.5423312", "0.5423312", "0.5423312", "0.5423312", "0.5423312", "0.5423312", ...
0.0
-1
Given a change object, compute the new set of marker spans that cover the line in which the change took place. Removes spans entirely within the change, reconnects spans belonging to the same marker that appear on both sides of the change, and cuts off spans partially within the change. Returns an array of span arrays ...
function stretchSpansOverChange(doc, change) { if (change.full) { return null } var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans; var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans; if (!oldFirst && !oldLast) { return null } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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_\" +...
[ "0.68045187", "0.68045187", "0.68045187", "0.68045187", "0.68045187", "0.68045187", "0.68045187", "0.67977136", "0.67977136", "0.67977136", "0.67977136", "0.67977136", "0.67977136", "0.67977136", "0.67977136", "0.67977136", "0.67977136", "0.67977136", "0.67977136", "0.67977136"...
0.66411275
71
Remove spans that are empty and don't have a clearWhenEmpty option of false.
function clearEmptySpans(spans) { for (var i = 0; i < spans.length; ++i) { var span = spans[i]; if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false) { spans.splice(i--, 1); } } if (!spans.length) { return null } return spans }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearEmptySpans(spans) {\n\t\t for (var i = 0; i < spans.length; ++i) {\n\t\t var span = spans[i];\n\t\t if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)\n\t\t spans.splice(i--, 1);\n\t\t }\n\t\t if (!spans.length) return null;\n\t\t retur...
[ "0.7583394", "0.75742966", "0.75742966", "0.75742966", "0.75742966", "0.75742966", "0.75742966", "0.75742966", "0.7569507", "0.7569052", "0.7549425", "0.7549425", "0.7549425", "0.7535491", "0.7530014", "0.7530014", "0.75171536", "0.75171536", "0.75171536", "0.75171536", "0.75...
0.758082
17
Used to 'clip' out readOnly ranges when making a change.
function removeReadOnlyRanges(doc, from, to) { var markers = null; doc.iter(from.line, to.line + 1, function (line) { if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) { var mark = line.markedSpans[i].marker; if (mark.readOnly && (!markers || indexOf(markers, mark) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clipRange(range, min, max) {\n return range\n .filter(segment => segment[1] >= min && segment[0] <= max)\n .map(segment => [Math.max(segment[0], min), Math.min(segment[1], max)]);\n}", "function removeReadOnlyRanges(doc, from, to) {\n\t\t var markers = null;\n\t\t doc.iter(from.line, to.lin...
[ "0.65478814", "0.6416192", "0.6400395", "0.62816346", "0.62816346", "0.62816346", "0.6155756", "0.6155756", "0.6155756", "0.6155756", "0.6155756", "0.6155756", "0.6155756", "0.61422807", "0.61293954", "0.61236465", "0.61043614", "0.61043614", "0.61043614", "0.61043614", "0.61...
0.6156207
20
Connect or disconnect spans from a line.
function detachMarkedSpans(line) { var spans = line.markedSpans; if (!spans) { return } for (var i = 0; i < spans.length; ++i) { spans[i].marker.detachLine(line); } line.markedSpans = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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.attachLin...
[ "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "...
0.0
-1
Helpers used when computing which overlapping collapsed span counts as the larger one.
function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareCollapsedMarkers(a, b) {\n var lenDiff = a.lines.length - b.lines.length;\n\n if (lenDiff != 0) {\n return lenDiff;\n }\n\n var aPos = a.find(),\n bPos = b.find();\n var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n\n if (fromCmp) {\n retur...
[ "0.6158327", "0.5892967", "0.5875146", "0.5875146", "0.5875146", "0.58443254", "0.58443254", "0.58443254", "0.58443254", "0.58443254", "0.58443254", "0.58443254", "0.58198965", "0.58142793", "0.5766265", "0.5766265", "0.5766265", "0.5766265", "0.5766265", "0.5766265", "0.5766...
0.0
-1
Returns a number indicating which of two overlapping collapsed spans is larger (and thus includes the other). Falls back to comparing ids when the spans cover exactly the same range.
function compareCollapsedMarkers(a, b) { var lenDiff = a.lines.length - b.lines.length; if (lenDiff != 0) { return lenDiff } var aPos = a.find(), bPos = b.find(); var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b); if (fromCmp) { return -fromCmp } var toCmp = cmp(aPos.to, bPo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareCollapsedMarkers(a, b) {\n var lenDiff = a.lines.length - b.lines.length;\n\n if (lenDiff != 0) {\n return lenDiff;\n }\n\n var aPos = a.find(),\n bPos = b.find();\n var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n\n if (fromCmp) {\n retur...
[ "0.7142195", "0.693498", "0.693498", "0.693498", "0.693498", "0.693498", "0.693498", "0.693498", "0.691132", "0.691132", "0.691132", "0.6910217", "0.6895199", "0.68564695", "0.6827457", "0.6819273", "0.6819273", "0.68139935", "0.68139935", "0.68139935", "0.68139935", "0.681...
0.6881761
26
Find out whether a line ends or starts in a collapsed span. If so, return the marker for that span.
function collapsedSpanAtSide(line, start) { var sps = sawCollapsedSpans && line.markedSpans, found; if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) { sp = sps[i]; if (sp.marker.collapsed && (start ? sp.from : sp.to) == null && (!found || compareCollapsedMarkers(found, sp.mar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function collapsedSpanAtSide(line, start) {\n\t\t var sps = sawCollapsedSpans && line.markedSpans, found;\n\t\t if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {\n\t\t sp = sps[i];\n\t\t if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&\n\t\t (!found || compare...
[ "0.7781943", "0.77293897", "0.77293897", "0.77293897", "0.77293897", "0.77293897", "0.77293897", "0.77293897", "0.77270275", "0.7724256", "0.7691947", "0.7691947", "0.7691947", "0.7656835", "0.76529074", "0.76529074", "0.76406157", "0.76274836", "0.76274836", "0.76274836", "0...
0.7747473
17
Test whether there exists a collapsed span that partially overlaps (covers the start or end, but not both) of a new span. Such overlap is not allowed.
function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) { var line = getLine(doc, lineNo$$1); var sps = sawCollapsedSpans && line.markedSpans; if (sps) { for (var i = 0; i < sps.length; ++i) { var sp = sps[i]; if (!sp.marker.collapsed) { continue } var found = sp.marker.find(0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.68643045", "0.68643045", "0.68643045", "0.68643045", "0.68643045", "0.68643045", "0.68562055", "0.6840906", "0.68402225", "0.68402225", "0.68402225", "0.68402225", "0.68402225", "0.68402225", "0.68402225", "0.68402225", "0.6831287", "0.6831287", "0.6822905", "0.68100256", ...
0.6788901
27
A visual line is a line as drawn on the screen. Folding, for example, can cause multiple logical lines to appear on the same visual line. This finds the start of the visual line that the given line is part of (usually that is the line itself).
function visualLine(line) { var merged; while (merged = collapsedSpanAtStart(line)) { line = merged.find(-1, true).line; } return line }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visualLine(line) {\n\t\t var merged;\n\t\t while (merged = collapsedSpanAtStart(line))\n\t\t line = merged.find(-1, true).line;\n\t\t return line;\n\t\t }", "function visualLine(line) {\n\t\t var merged;\n\t\t while (merged = collapsedSpanAtStart(line))\n\t\t { line = merged.fi...
[ "0.8250026", "0.82406414", "0.82313603", "0.82313603", "0.82313603", "0.82117206", "0.8178637", "0.8178637", "0.8178637", "0.8178637", "0.8178637", "0.8178637", "0.8178637", "0.8173388", "0.81548107", "0.81548107", "0.81548107", "0.81548107", "0.81548107", "0.81548107", "0.81...
0.81788635
21
Returns an array of logical lines that continue the visual line started by the argument, or undefined if there are no such lines.
function visualLineContinued(line) { var merged, lines; while (merged = collapsedSpanAtEnd(line)) { line = merged.find(1, true).line ;(lines || (lines = [])).push(line); } return lines }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visualLineContinued(line) {\n var merged, lines;\n\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line;\n (lines || (lines = [])).push(line);\n }\n\n return lines;\n } // Get the line number of the start of the visual line that the", "function visualLi...
[ "0.6936979", "0.6631404", "0.65844053", "0.65823203", "0.65823203", "0.65823203", "0.65823203", "0.65823203", "0.65823203", "0.65823203", "0.6580827", "0.6580827", "0.6580827", "0.6562891", "0.65574646", "0.6548238", "0.6548238", "0.6512879", "0.6512879", "0.6512879", "0.6512...
0.6574651
29
Get the line number of the start of the visual line that the given line number is part of.
function visualLineNo(doc, lineN) { var line = getLine(doc, lineN), vis = visualLine(line); if (line == vis) { return lineN } return lineNo(vis) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN),\n vis = visualLine(line);\n\n if (line == vis) {\n return lineN;\n }\n\n return lineNo(vis);\n } // Get the line number of the start of the next visual line after", "function visualLineNo(doc, lineN) {\n\t\t var lin...
[ "0.79714906", "0.7487919", "0.74226594", "0.7406071", "0.7406071", "0.7406071", "0.7403563", "0.7403563", "0.7403563", "0.7403563", "0.7403563", "0.7403563", "0.7403563", "0.73738784", "0.73738784", "0.7371278", "0.7365478", "0.73644817", "0.73644817", "0.73644817", "0.736448...
0.7455519
16
Get the line number of the start of the next visual line after the given line.
function visualLineEndNo(doc, lineN) { if (lineN > doc.lastLine()) { return lineN } var line = getLine(doc, lineN), merged; if (!lineIsHidden(doc, line)) { return lineN } while (merged = collapsedSpanAtEnd(line)) { line = merged.find(1, true).line; } return lineNo(line) + 1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN),\n vis = visualLine(line);\n\n if (line == vis) {\n return lineN;\n }\n\n return lineNo(vis);\n } // Get the line number of the start of the next visual line after", "function nextLine() {\n\t\t_this._compConst('LINE', ...
[ "0.79053533", "0.73212373", "0.70655745", "0.7048663", "0.70483404", "0.704656", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", ...
0.70266366
49
Compute whether a line is hidden. Lines count as hidden when they are part of a visual line that starts with another line, or when they are entirely covered by collapsed, nonwidget span.
function lineIsHidden(doc, line) { var sps = sawCollapsedSpans && line.markedSpans; if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) { sp = sps[i]; if (!sp.marker.collapsed) { continue } if (sp.from == null) { return true } if (sp.marker.widgetNode) { continue } if (s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lineIsHidden(doc, line) {\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) for (var sp, i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (!sp.marker.collapsed) continue;\n if (sp.from == null) return true;\n if (sp.marker.widgetNode) continue;\n if (sp.from == ...
[ "0.8505645", "0.8505645", "0.8505645", "0.8505645", "0.8505645", "0.8505645", "0.8505645", "0.8475789", "0.8469844", "0.8453317", "0.8453317", "0.8453317", "0.843991", "0.8433678", "0.8428107", "0.8418568", "0.8418568", "0.8418568", "0.8418568", "0.8418568", "0.8418568", "0...
0.8501693
23
Find the height above the given line.
function heightAtLine(lineObj) { lineObj = visualLine(lineObj); var h = 0, chunk = lineObj.parent; for (var i = 0; i < chunk.lines.length; ++i) { var line = chunk.lines[i]; if (line == lineObj) { break } else { h += line.height; } } for (var p = chunk.parent; p; chunk = p, p = chu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function heightAtLine(lineObj) {\n\t\t lineObj = visualLine(lineObj);\n\t\t\n\t\t var h = 0, chunk = lineObj.parent;\n\t\t for (var i = 0; i < chunk.lines.length; ++i) {\n\t\t var line = chunk.lines[i];\n\t\t if (line == lineObj) break;\n\t\t else h += line.height;\n\t\t }\n\t\t for (...
[ "0.7672805", "0.7669036", "0.7598157", "0.7598157", "0.759206", "0.7560561", "0.7560561", "0.7560561", "0.7560561", "0.7560561", "0.7560561", "0.7560561", "0.75525343", "0.7474777", "0.746032", "0.746032", "0.746032", "0.746032", "0.746032", "0.746032", "0.746032", "0.74603...
0.7555887
28
Compute the character length of a line, taking into account collapsed ranges (see markText) that might hide parts, and join other lines onto it.
function lineLength(line) { if (line.height == 0) { return 0 } var len = line.text.length, merged, cur = line; while (merged = collapsedSpanAtStart(cur)) { var found = merged.find(0, true); cur = found.from.line; len += found.from.ch - found.to.ch; } cur = line; while (merged =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n whil...
[ "0.7674573", "0.7674573", "0.7674573", "0.7674573", "0.7674573", "0.7674573", "0.7674573", "0.7674573", "0.7654567", "0.76487184", "0.7636831", "0.76268494", "0.76268494", "0.76238084", "0.7618696", "0.7618696", "0.7618696", "0.7618696", "0.7618696", "0.7618696", "0.7618696",...
0.7679532
14
Find the longest line in the document.
function findMaxLine(cm) { var d = cm.display, doc = cm.doc; d.maxLine = getLine(doc, doc.first); d.maxLineLength = lineLength(d.maxLine); d.maxLineChanged = true; doc.iter(function (line) { var len = lineLength(line); if (len > d.maxLineLength) { d.maxLineLength = len; d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = le...
[ "0.7557767", "0.7557767", "0.7557767", "0.7557767", "0.7557767", "0.7557767", "0.7557767", "0.7557767", "0.75130606", "0.75130606", "0.75036013", "0.7496651", "0.7496651", "0.7496651", "0.7496651", "0.7496651", "0.7496651", "0.7496651", "0.7496651", "0.7496651", "0.7496651", ...
0.75558054
24
Get the bidi ordering for the given line (and cache it). Returns false for lines that are fully lefttoright, and an array of BidiSpan objects otherwise.
function getOrder(line, direction) { var order = line.order; if (order == null) { order = line.order = bidiOrdering(line.text, direction); } return order }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOrder(line) {\n\t\t var order = line.order;\n\t\t if (order == null) order = line.order = bidiOrdering(line.text);\n\t\t return order;\n\t\t }", "function getOrder(line) {\n\t var order = line.order;\n\t if (order == null) order = line.order = bidiOrdering(line.text);\n\t return or...
[ "0.7619211", "0.7584861", "0.7584861", "0.7584861", "0.7578088", "0.7578088", "0.7578088", "0.7578088", "0.7578088", "0.7578088", "0.7578088", "0.75559795", "0.7471816", "0.72242576", "0.7099471", "0.7074373", "0.7074373", "0.7074373", "0.7074373", "0.7074373", "0.7074373", ...
0.713547
30
The DOM events that CodeMirror handles can be overridden by registering a (nonDOM) handler on the editor for the event name, and preventDefaulting the event in that handler.
function signalDOMEvent(cm, e, override) { if (typeof e == "string") { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; } signal(cm, override || e.type, cm, e); return e_defaultPrevented(e) || e.codemirrorIgnore }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function signalDOMEvent(cm, e, override) {\n\t\t if (typeof e == \"string\")\n\t\t { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }\n\t\t signal(cm, override || e.type, cm, e);\n\t\t return e_defaultPrevented(e) || e.codemirrorIgnore\n\t\t }", "function signalDOMEve...
[ "0.71294665", "0.7111857", "0.6914305", "0.6914305", "0.6911105", "0.6911105", "0.6911105", "0.69020975", "0.6878917", "0.6878917", "0.6878917", "0.6878917", "0.6878917", "0.6878917", "0.6878917", "0.6878917", "0.6878917", "0.6878917", "0.6878917", "0.68245065", "0.68245065",...
0.6880752
23
Add on and off methods to a constructor's prototype, to make registering events on such objects more convenient.
function eventMixin(ctor) { ctor.prototype.on = function(type, f) {on(this, type, f);}; ctor.prototype.off = function(type, f) {off(this, type, f);}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static mixin(constr) {\n // instance._events = {};\n [\"on\", \"once\", \"off\", \"emit\"].forEach(name => {\n const property = Object.getOwnPropertyDescriptor(Emitter.prototype, name);\n Object.defineProperty(constr.prototype, name, property);\n });\n }", "function ...
[ "0.68004847", "0.67387736", "0.67387736", "0.6706197", "0.6706197", "0.6706197", "0.6694752", "0.6689273", "0.66082335", "0.65822226", "0.65822226", "0.65822226", "0.65822226", "0.65822226", "0.65822226", "0.65822226", "0.65822226", "0.65822226", "0.65822226", "0.65822226", "...
0.6659277
31
Due to the fact that we still support jurassic IE versions, some compatibility wrappers are needed.
function e_preventDefault(e) { if (e.preventDefault) { e.preventDefault(); } else { e.returnValue = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compIE(){\r\n\tvar agent = navigator.userAgent;\r\n\tif(agent.indexOf(\"MSIE 7.0\") > -1 || agent.indexOf(\"MSIE 8.0\") > - 1 || agent.indexOf(\"Trident 4.0\") > -1 || document.documentMode && document.documentMode <= 5)\r\n\t\treturn true;\r\n\treturn false;\r\n}", "function IEcompatibility() {\n\t// O...
[ "0.7147347", "0.6929268", "0.68107486", "0.6763516", "0.6701702", "0.6691548", "0.6618857", "0.65820587", "0.6516647", "0.64824015", "0.64824015", "0.6473577", "0.6473577", "0.64497596", "0.6369467", "0.6367046", "0.6363274", "0.63499576", "0.63459855", "0.63325495", "0.63212...
0.0
-1
Extra arguments are stored as the mode's dependencies, which is used by (legacy) mechanisms like loadmode.js to automatically load a mode. (Preferred mechanism is the require/define calls.)
function defineMode(name, mode) { if (arguments.length > 2) { mode.dependencies = Array.prototype.slice.call(arguments, 2); } modes[name] = mode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function defineMode(name, mode) {\n\t\t if (arguments.length > 2)\n\t\t { mode.dependencies = Array.prototype.slice.call(arguments, 2); }\n\t\t modes[name] = mode;\n\t\t }", "function defineMode(name, mode) {\n if (arguments.length > 2)\n { mode.dependencies = Array.prototype.slice.call(arguments...
[ "0.80863816", "0.7878452", "0.7878452", "0.7798622", "0.77844185", "0.77844185", "0.77844185", "0.77844185", "0.77844185", "0.77844185", "0.77844185", "0.77844185", "0.77844185", "0.77844185", "0.77844185", "0.7740437", "0.580766", "0.56119114", "0.54473126", "0.5401171", "0....
0.78369325
18
Given a mode spec (anything that resolveMode accepts), find and initialize an actual mode object.
function getMode(options, spec) { spec = resolveMode(spec); var mfactory = modes[spec.name]; if (!mfactory) { return getMode(options, "text/plain") } var modeObj = mfactory(options, spec); if (modeExtensions.hasOwnProperty(spec.name)) { var exts = modeExtensions[spec.name]; for (var prop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resolveMode(spec) {\n if (typeof spec == \"string\" && mimeModes.hasOwnProperty(spec)) {\n spec = mimeModes[spec];\n } else if (spec && typeof spec.name == \"string\" && mimeModes.hasOwnProperty(spec.name)) {\n var found = mimeModes[spec.name];\n\n if (typeof found == \"string\") {\n ...
[ "0.75762206", "0.72704935", "0.72030133", "0.72030133", "0.71943533", "0.71651524", "0.71651524", "0.71651524", "0.71651524", "0.71651524", "0.71651524", "0.71651524", "0.71651524", "0.71651524", "0.71651524", "0.71651524", "0.7151816", "0.6037289", "0.6029042", "0.6029042", ...
0.72148794
13
Given a mode and a state (for that mode), find the inner mode and state at the position that the state refers to.
function innerMode(mode, state) { var info; while (mode.innerMode) { info = mode.innerMode(state); if (!info || info.mode == mode) { break } state = info.state; mode = info.mode; } return info || {mode: mode, state: state} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function innerMode(mode, state) {\n var info\n while (mode.innerMode) {\n info = mode.innerMode(state)\n if (!info || info.mode == mode) { break }\n state = info.state\n mode = info.mode\n }\n return info || {mode: mode, state: state}\n}", "function innerMode(mode, state) {\n var info\n while (...
[ "0.7568602", "0.7568602", "0.75572", "0.75572", "0.75572", "0.75572", "0.75572", "0.75572", "0.75572", "0.75572", "0.75572", "0.75572", "0.75572", "0.7552965", "0.74676317", "0.74232215", "0.59458613", "0.56859607", "0.53475493", "0.5253744", "0.49546236", "0.4879175", "0...
0.75678235
13
Compute a style array (an array starting with a mode generation for invalidation followed by pairs of end positions and style strings), which is used to highlight the tokens on the line.
function highlightLine(cm, line, context, forceToEnd) { // A styles array always starts with a number identifying the // mode/overlays that it is based on (for easy invalidation). var st = [cm.state.modeGen], lineClasses = {}; // Compute the base array of styles runMode(cm, line.text, cm.doc.mode, c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStyleArrayForBlock(block) {\n var text = block.text,\n inlineStyleRanges = block.inlineStyleRanges;\n\n var inlineStyles = {\n BOLD: new Array(text.length),\n ITALIC: new Array(text.length),\n UNDERLINE: new Array(text.length),\n STRIKETHROUGH: new Array(text.length),\n CODE: new ...
[ "0.65269905", "0.6442376", "0.61422366", "0.59607124", "0.58378893", "0.5775188", "0.5773922", "0.5773922", "0.56918806", "0.56918806", "0.56918806", "0.56918806", "0.56918806", "0.56918806", "0.56918806", "0.56613845", "0.56613845", "0.5654884", "0.5608059", "0.5608059", "0....
0.56094074
29
Lightweight form of highlight proceed over this line and update state, but don't save a style array. Used for lines that aren't currently visible.
function processLine(cm, text, context, startAt) { var mode = cm.doc.mode; var stream = new StringStream(text, cm.options.tabSize, context); stream.start = stream.pos = startAt || 0; if (text == "") { callBlankLine(mode, context.state); } while (!stream.eol()) { readToken(mode, stream, context...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "highlightLine(line_num)\n{\n this.highlightSet = line_num;\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 ...
[ "0.68473744", "0.68018955", "0.67464715", "0.66991407", "0.66876996", "0.6672703", "0.66450125", "0.66450125", "0.66450125", "0.66450125", "0.66450125", "0.66450125", "0.66450125", "0.6641981", "0.6641981", "0.66312367", "0.6630908", "0.6606648", "0.6606648", "0.6594182", "0....
0.0
-1
Utility for getTokenAt and getLineTokens
function takeToken(cm, pos, precise, asArray) { var doc = cm.doc, mode = doc.mode, style; pos = clipPos(doc, pos); var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise); var stream = new StringStream(line.text, cm.options.tabSize, context), tokens; if (asArray) { token...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function takeToken(cm, pos, precise, asArray) {\n\t\t var doc = cm.doc, mode = doc.mode, style;\n\t\t pos = clipPos(doc, pos);\n\t\t var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);\n\t\t var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;...
[ "0.67839366", "0.66377556", "0.66228", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65721285", "0.65721285", "0.65721285", "0.65721285", "0.65721285", "0.65526426", ...
0.6679065
12
Run the given mode's parser over a line, calling f for each token.
function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) { var flattenSpans = mode.flattenSpans; if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; } var curStart = 0, curStyle = null; var stream = new StringStream(text, cm.options.tabSize, context), style; var inner = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runMode(cm, text, mode, state, f) {\n var flattenSpans = cm.options.flattenSpans;\n var curText = \"\", curStyle = null;\n var stream = new StringStream(text, cm.options.tabSize);\n if (text == \"\" && mode.blankLine) mode.blankLine(state);\n while (!stream.eol()) {\n var style = mode....
[ "0.68395495", "0.68284214", "0.68284214", "0.67762023", "0.6611103", "0.6484349", "0.6440528", "0.6335101", "0.6335101", "0.6291342", "0.6291017", "0.6217092", "0.6217092", "0.6217092", "0.6217092", "0.6217092", "0.6217092", "0.6217092", "0.6217092", "0.6217092", "0.6217092",...
0.6227828
23
Finds the line to start with when starting a parse. Tries to find a line with a stateAfter, so that it can start with a valid state. If that fails, it returns the line with the smallest indentation, which tends to need the least context to parse correctly.
function findStartLine(cm, n, precise) { var minindent, minline, doc = cm.doc; var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100); for (var search = n; search > lim; --search) { if (search <= doc.first) { return doc.first } var line = getLine(doc, search - 1), after = line.stateAf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 == nu...
[ "0.69632703", "0.69560045", "0.69560045", "0.69001615", "0.6821355", "0.6821355", "0.6821355", "0.68161285", "0.67185724", "0.66503805", "0.66503805", "0.66503805", "0.66265565", "0.66058767", "0.66058767", "0.66058767", "0.66058767", "0.66058767", "0.66058767", "0.66058767", ...
0.67155445
20
Change the content (text, markers) of a line. Automatically invalidates cached information and tries to reestimate the line's height.
function updateLine(line, text, markedSpans, estimateHeight) { line.text = text; if (line.stateAfter) { line.stateAfter = null; } if (line.styles) { line.styles = null; } if (line.order != null) { line.order = null; } detachMarkedSpans(line); attachMarkedSpans(line, markedSpans); var estHeig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n\n if (line.stateAfter) {\n line.stateAfter = null;\n }\n\n if (line.styles) {\n line.styles = null;\n }\n\n if (line.order != null) {\n line.order = null;\n }\n\n detachMarkedSpans(line);\n ...
[ "0.74917233", "0.73945045", "0.73891616", "0.73891616", "0.73891616", "0.73891616", "0.73891616", "0.73891616", "0.73891616", "0.73873484", "0.7345047", "0.7345047", "0.7345047", "0.7339334", "0.7339334", "0.7328154", "0.73016775", "0.7292444", "0.7292444", "0.7292444", "0.72...
0.7390007
13
Detach a line from the document tree and its markers.
function cleanUpLine(line) { line.parent = null; detachMarkedSpans(line); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function detachMarkedSpans(line) {\n var spans = line.markedSpans\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line) }\n line.markedSpans = null\n}", "function detachMarkedSpans(line) {\n var spans = line.markedSpans\n if (!spans) { return }\n for (va...
[ "0.7419141", "0.7419141", "0.7408427", "0.7399212", "0.7399212", "0.73966587", "0.7390764", "0.7388641", "0.7385563", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", ...
0.7264013
82
Render the DOM representation of the text of a line. Also builds up a 'line map', which points at the DOM nodes that represent specific stretches of text, and is used by the measuring code. The returned object contains the DOM node, this map, and information about linewide styles that were set by the mode.
function buildLineContent(cm, lineView) { // The padding-right forces the element to have a 'border', which // is needed on Webkit to be able to get line-level bounding // rectangles for it (in measureChar). var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null); var builder =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildLineContent(cm, lineView) {\r\n // The padding-right forces the element to have a 'border', which\r\n // is needed on Webkit to be able to get line-level bounding\r\n // rectangles for it (in measureChar).\r\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null...
[ "0.72961694", "0.7259279", "0.7259279", "0.71934396", "0.71934396", "0.71934396", "0.70302963", "0.70234215", "0.7002869", "0.6999494", "0.6986597", "0.69860077", "0.6976536", "0.69632566", "0.69540685", "0.6932572", "0.6932572", "0.6932572", "0.6932572", "0.6932572", "0.6932...
0.6947981
27
Build up the DOM representation for a single token, and add it to the line map. Takes care to render special characters separately.
function buildToken(builder, text, style, startStyle, endStyle, title, css) { if (!text) { return } var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text; var special = builder.cm.state.specialChars, mustWrap = false; var content; if (!special.test(text)) { bu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "drawHTMLToken() {\n const tokenContainer = document.createElement('div');\n const gameBoardUnderlay = document.getElementById('game-board-underlay');\n gameBoardUnderlay.appendChild(tokenContainer);\n tokenContainer.setAttribute(\"id\", this.id);\n tokenContainer.setAttribute(\"c...
[ "0.6337438", "0.6153451", "0.6116774", "0.611497", "0.611497", "0.611497", "0.61053276", "0.60906744", "0.60436153", "0.6043088", "0.60180473", "0.60180473", "0.60180473", "0.60180473", "0.60180473", "0.60180473", "0.60180473", "0.60180473", "0.60180473", "0.60180473", "0.601...
0.58894855
34
Change some spaces to NBSP to prevent the browser from collapsing trailing spaces at the end of a line when rendering text (issue 1362).
function splitSpaces(text, trailingBefore) { if (text.length > 1 && !/ /.test(text)) { return text } var spaceBefore = trailingBefore, result = ""; for (var i = 0; i < text.length; i++) { var ch = text.charAt(i); if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function String_SpaceToNonBreakingSpace()\n{\n\t//replace them\n\treturn this.replace(/\\b {2}/g, \" &nbsp;\").replace(/ {2}\\b/g, \"&nbsp; \").replace(/ {2}/g, \"&nbsp;&nbsp;\");\n}", "function normalizeSpaces(text)\n{\n // IE has already done this conversion, so doing it again will remove multiple nbsp\n ...
[ "0.77390885", "0.75844264", "0.72715914", "0.7261503", "0.7015394", "0.6916965", "0.67166466", "0.66469103", "0.6593544", "0.65841943", "0.6578181", "0.6573375", "0.6522154", "0.6420517", "0.641463", "0.64093447", "0.6409034", "0.64078605", "0.64078605", "0.63825333", "0.6367...
0.6566625
25
Work around nonsense dimensions being reported for stretches of righttoleft text.
function buildTokenBadBidi(inner, order) { return function (builder, text, style, startStyle, endStyle, title, css) { style = style ? style + " cm-force-border" : "cm-force-border"; var start = builder.pos, end = start + text.length; for (;;) { // Find the part that overlaps with the start...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function textResize(elt, d) {\n\n var textWidth = elt.getComputedTextLength();\n var arrayBro = elt.parentNode.childNodes;\n var len = arrayBro.length;\n var i = len / 2;\n\n if (arrayBro[i].firstChild === null || elt.firstChild === null)\n return null;\n\n while (arrayBro[i].firstChild.no...
[ "0.6419615", "0.62969416", "0.6237837", "0.60760343", "0.6073828", "0.5946762", "0.592194", "0.58706087", "0.585344", "0.57196945", "0.57196945", "0.5669483", "0.5669483", "0.56625825", "0.56436014", "0.56314695", "0.5612791", "0.55979156", "0.55979156", "0.55979156", "0.5593...
0.0
-1
Outputs a number of spans to make up a line, taking highlighting and marked text into account.
function insertLineContent(line, builder, styles) { var spans = line.markedSpans, allText = line.text, at = 0; if (!spans) { for (var i$1 = 1; i$1 < styles.length; i$1+=2) { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertLineContent(line, builder, styles) {\n\t var spans = line.markedSpans, allText = line.text, at = 0;\n\t if (!spans) {\n\t for (var i = 1; i < styles.length; i+=2)\n\t builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));...
[ "0.66128546", "0.66100127", "0.65788186", "0.65693355", "0.6565026", "0.6565026", "0.65456927", "0.65310436", "0.65214396", "0.6516241", "0.65070486", "0.64916986", "0.64916986", "0.64916986", "0.6460765", "0.6460765", "0.6460765", "0.6459775", "0.6459647", "0.6459492", "0.64...
0.6499411
12
These objects are used to represent the visible (currently drawn) part of the document. A LineView may correspond to multiple logical lines, if those are connected by collapsed ranges.
function LineView(doc, line, lineN) { // The starting line this.line = line; // Continuing lines, if any this.rest = visualLineContinued(line); // Number of logical lines in this visual line this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1; this.node = this.text = null; thi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line; // Continuing lines, if any\n\n this.rest = visualLineContinued(line); // Number of logical lines in this visual line\n\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n...
[ "0.7760929", "0.7357687", "0.7357687", "0.73421013", "0.73421013", "0.73421013", "0.73421013", "0.73421013", "0.73421013", "0.73421013", "0.73421013", "0.73421013", "0.73421013", "0.73421013", "0.7306697", "0.7291144", "0.7291144", "0.7290077", "0.7269108", "0.7269108", "0.72...
0.7328642
32
Create a range of LineView objects for the given lines.
function buildViewArray(cm, from, to) { var array = [], nextPos; for (var pos = from; pos < to; pos = nextPos) { var view = new LineView(cm.doc, getLine(cm.doc, pos), pos); nextPos = pos + view.size; array.push(view); } return array }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line; // Continuing lines, if any\n\n this.rest = visualLineContinued(line); // Number of logical lines in this visual line\n\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n...
[ "0.7717119", "0.6600235", "0.6600235", "0.6600235", "0.6600235", "0.6600235", "0.6600235", "0.6600235", "0.6600235", "0.65828633", "0.6580781", "0.6575102", "0.65602607", "0.65524656", "0.65524656", "0.65368026", "0.65368026", "0.65368026", "0.6533305", "0.65162045", "0.65162...
0.6588617
24
Often, we want to signal events at a point where we are in the middle of some work, but don't want the handler to start calling other methods on the editor, which might be in an inconsistent state or simply not expect any other events to happen. signalLater looks whether there are any handlers, and schedules them to be...
function signalLater(emitter, type /*, values...*/) { var arr = getHandlers(emitter, type); if (!arr.length) { return } var args = Array.prototype.slice.call(arguments, 2), list; if (operationGroup) { list = operationGroup.delayedCallbacks; } else if (orphanDelayedCallbacks) { list = orp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function signalLater(emitter, type /*, values...*/) {\n\t\t var arr = getHandlers(emitter, type, false)\n\t\t if (!arr.length) return;\n\t\t var args = Array.prototype.slice.call(arguments, 2), list;\n\t\t if (operationGroup) {\n\t\t list = operationGroup.delayedCallbacks;\n\t\t } else if (orph...
[ "0.6554211", "0.64453864", "0.64453864", "0.64453864", "0.6413596", "0.64093375", "0.62302804", "0.6220109", "0.6220109", "0.6220109", "0.6220109", "0.6220109", "0.6048615", "0.60203564", "0.6013591", "0.6013591", "0.6013591", "0.6013591", "0.6013591", "0.6013591", "0.6013591...
0.615517
25
When an aspect of a line changes, a string is added to lineView.changes. This updates the relevant part of the line's DOM structure.
function updateLineForChanges(cm, lineView, lineN, dims) { for (var j = 0; j < lineView.changes.length; j++) { var type = lineView.changes[j]; if (type == "text") { updateLineText(cm, lineView); } else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); } else if (type == "c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateLineForChanges(cm, lineView, lineN, dims) {\n\t\t for (var j = 0; j < lineView.changes.length; j++) {\n\t\t var type = lineView.changes[j];\n\t\t if (type == \"text\") updateLineText(cm, lineView);\n\t\t else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n\t\...
[ "0.763215", "0.7629618", "0.76102537", "0.76102537", "0.76102537", "0.7600088", "0.7600088", "0.7600088", "0.7600088", "0.7600088", "0.7600088", "0.7596398", "0.7595506", "0.7595506", "0.7583259", "0.75558984", "0.75515914", "0.75047183", "0.75047183", "0.75047183", "0.750471...
0.75885326
27
Lines with gutter elements, widgets or a background class need to be wrapped, and have the extra elements added to the wrapper div
function ensureLineWrapped(lineView) { if (lineView.node == lineView.text) { lineView.node = elt("div", null, null, "position: relative"); if (lineView.text.parentNode) { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); } lineView.node.appendChild(lineView.text); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wa(e){for(var t=e.display,a={},n={},r=t.gutters.clientLeft,f=t.gutters.firstChild,o=0;f;f=f.nextSibling,++o)a[e.options.gutters[o]]=f.offsetLeft+f.clientLeft+r,n[e.options.gutters[o]]=f.clientWidth;return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:a,gutterWidth:n,wrapperWidth:t.wrapp...
[ "0.63632977", "0.6069341", "0.5751022", "0.5679903", "0.5651658", "0.5588519", "0.556342", "0.553486", "0.55187905", "0.54814893", "0.54814893", "0.54814196", "0.5474681", "0.5456173", "0.54542214", "0.54488885", "0.54252946", "0.5404445", "0.5404445", "0.5404445", "0.5404445...
0.0
-1
Wrapper around buildLineContent which will reuse the structure in display.externalMeasured when possible.
function getLineContent(cm, lineView) { var ext = cm.display.externalMeasured; if (ext && ext.line == lineView.line) { cm.display.externalMeasured = null; lineView.measure = ext.measure; return ext.built } return buildLineContent(cm, lineView) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLineContent(cm, lineView) {\n\t\t var ext = cm.display.externalMeasured;\n\t\t if (ext && ext.line == lineView.line) {\n\t\t cm.display.externalMeasured = null;\n\t\t lineView.measure = ext.measure;\n\t\t return ext.built\n\t\t }\n\t\t return buildLineContent(cm, lineView)\n\...
[ "0.748073", "0.7472988", "0.7391853", "0.7391853", "0.7391853", "0.7391853", "0.7391853", "0.7391853", "0.7391853", "0.7391853", "0.73904085", "0.73904085", "0.73904085", "0.73616403", "0.7268476", "0.7261051", "0.72579", "0.7256298", "0.7244589", "0.7222309", "0.7222309", ...
0.7383217
26
Redraw the line's text. Interacts with the background and text classes because the mode may output tokens that influence these classes.
function updateLineText(cm, lineView) { var cls = lineView.text.className; var built = getLineContent(cm, lineView); if (lineView.text == lineView.node) { lineView.node = built.pre; } lineView.text.parentNode.replaceChild(built.pre, lineView.text); lineView.text = built.pre; if (built.bgClass !=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateLineText(cm, lineView) {\n\t\t var cls = lineView.text.className;\n\t\t var built = getLineContent(cm, lineView);\n\t\t if (lineView.text == lineView.node) lineView.node = built.pre;\n\t\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t\t lineView.text = built.pre...
[ "0.74870175", "0.7475659", "0.74642247", "0.74642247", "0.74642247", "0.74642247", "0.74642247", "0.74642247", "0.74642247", "0.74642247", "0.74571306", "0.74571306", "0.74571306", "0.74498487", "0.7411686", "0.7344041", "0.732451", "0.732451", "0.732451", "0.732451", "0.7324...
0.74458647
25
Build a line's DOM representation from scratch
function buildLineElement(cm, lineView, lineN, dims) { var built = getLineContent(cm, lineView); lineView.text = lineView.node = built.pre; if (built.bgClass) { lineView.bgClass = built.bgClass; } if (built.textClass) { lineView.textClass = built.textClass; } updateLineClasses(cm, lineView); up...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildLineElement(cm, lineView, lineN, dims) {\n\t\t var built = getLineContent(cm, lineView);\n\t\t lineView.text = lineView.node = built.pre;\n\t\t if (built.bgClass) { lineView.bgClass = built.bgClass; }\n\t\t if (built.textClass) { lineView.textClass = built.textClass; }\n\n\t\t updateLi...
[ "0.76377565", "0.7593533", "0.75463307", "0.75371295", "0.75371295", "0.747941", "0.747941", "0.74740374", "0.7469086", "0.7469086", "0.7469086", "0.7469086", "0.7469086", "0.7469086", "0.74606705", "0.74196446", "0.74196446", "0.74196446", "0.74196446", "0.74196446", "0.7419...
0.7543531
15
A lineView may contain multiple logical lines (when merged by collapsed spans). The widgets for all of them need to be drawn.
function insertLineWidgets(cm, lineView, dims) { insertLineWidgetsFor(cm, lineView.line, lineView, dims, true); if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++) { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n inser...
[ "0.70284724", "0.70284724", "0.70284724", "0.70284724", "0.70284724", "0.70284724", "0.7015939", "0.69332486", "0.6856498", "0.6850479", "0.68453354", "0.68453354", "0.68340856", "0.68340856", "0.6829853", "0.6813645", "0.6791258", "0.6791258", "0.6791258", "0.6791258", "0.67...
0.68490326
21
Return true when the given mouse event happened in a widget
function eventInWidget(display, e) { for (var n = e_target(e); n != display.wrapper; n = n.parentNode) { if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") || (n.parentNode == display.sizer && n != display.mover)) { return true } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseClicked() {\n // If it has been clicked return true\n return true;\n }", "mouseClicked(){\n //If we are highlighted and we clicked, return true\n if(this.highlighted){\n return true\n }\n //Else return false\n return false;\n }", "hovered(){\n //if mouse i...
[ "0.7195247", "0.7060024", "0.68767476", "0.68530965", "0.675996", "0.67556345", "0.6753403", "0.6686263", "0.6671799", "0.6648398", "0.6615036", "0.6615036", "0.6615036", "0.6615036", "0.65915", "0.65672505", "0.65455943", "0.64909726", "0.64862204", "0.6464711", "0.6462003",...
0.643237
42
Ensure the lineView.wrapping.heights array is populated. This is an array of bottom offsets for the lines that make up a drawn line. When lineWrapping is on, there might be more than one height.
function ensureLineHeights(cm, lineView, rect) { var wrapping = cm.options.lineWrapping; var curWidth = wrapping && displayWidth(cm); if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) { var heights = lineView.measure.heights = []; if (wrapping) { lineView.m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && cm.display.scroller.clientWidth;\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapp...
[ "0.7546182", "0.7546182", "0.7546182", "0.7546182", "0.7498462", "0.73648065", "0.73648065", "0.73648065", "0.73648065", "0.7262307", "0.7261923", "0.72531855", "0.72531855", "0.72531855", "0.72389436", "0.72389436", "0.71971226", "0.71971226", "0.71971226", "0.71971226", "0....
0.7377386
18
Find a line map (mapping character offsets to text nodes) and a measurement cache for the given line number. (A line view might contain multiple lines when collapsed ranges are present.)
function mapFromLineView(lineView, line, lineN) { if (lineView.line == line) { return {map: lineView.measure.map, cache: lineView.measure.cache} } for (var i = 0; i < lineView.rest.length; i++) { if (lineView.rest[i] == line) { return {map: lineView.measure.maps[i], cache: lineView.measure.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line) {\n return {\n map: lineView.measure.map,\n cache: lineView.measure.cache\n };\n }\n\n for (var i = 0; i < lineView.rest.length; i++) {\n if (lineView.rest[i] == line) {\n return {\n ...
[ "0.7548595", "0.7491739", "0.7420152", "0.7420152", "0.7412574", "0.7411052", "0.7395382", "0.7395382", "0.7395382", "0.7395382", "0.7395382", "0.7395382", "0.7395382", "0.7395382", "0.7393325", "0.7393325", "0.7393325", "0.7393325", "0.7393325", "0.7393325", "0.7393325", "...
0.74399936
12
Render a line into the hidden node display.externalMeasured. Used when measurement is needed for a line that's not in the viewport.
function updateExternalMeasurement(cm, line) { line = visualLine(line); var lineN = lineNo(line); var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN); view.lineN = lineN; var built = view.built = buildLineContent(cm, view); view.text = built.pre; removeChildrenAndAdd(c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChil...
[ "0.75339967", "0.7487011", "0.74840844", "0.7474399", "0.7469101", "0.7469101", "0.7469101", "0.7469101", "0.7469101", "0.7469101", "0.7469101", "0.7469101", "0.7464697", "0.74602306", "0.74602306", "0.74602306", "0.7459474", "0.7459474", "0.7430819", "0.7430819", "0.7430819"...
0.74756694
16
Find a line view that corresponds to the given line number.
function findViewForLine(cm, lineN) { if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo) { return cm.display.view[findViewIndex(cm, lineN)] } var ext = cm.display.externalMeasured; if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size) { return ext } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function fi...
[ "0.7490927", "0.7490927", "0.7490927", "0.7490927", "0.7490927", "0.7490927", "0.7490927", "0.7490927", "0.7483591", "0.7483591", "0.7483591", "0.7483591", "0.7483591", "0.7483591", "0.7483591", "0.7483591", "0.7483591", "0.7483591", "0.7483591", "0.7482409", "0.7482409", "...
0.7498672
12
Measurement can be split in two steps, the setup work that applies to the whole line, and the measurement of the actual character. Functions like coordsChar, that need to do a lot of measurements in a row, can thus ensure that the setup work is only done once.
function prepareMeasureForLine(cm, line) { var lineN = lineNo(line); var view = findViewForLine(cm, lineN); if (view && !view.text) { view = null; } else if (view && view.changes) { updateLineForChanges(cm, view, lineN, getDimensions(cm)); cm.curOp.forceUpdate = true; } if (!vi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n ...
[ "0.61007935", "0.6079905", "0.60480803", "0.5923985", "0.5918367", "0.5918367", "0.589796", "0.589796", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5875767", "0.5873418", "...
0.5901451
18
Given a prepared measurement object, measures the position of an actual character (or fetches it from the cache).
function measureCharPrepared(cm, prepared, ch, bias, varHeight) { if (prepared.before) { ch = -1; } var key = ch + (bias || ""), found; if (prepared.cache.hasOwnProperty(key)) { found = prepared.cache[key]; } else { if (!prepared.rect) { prepared.rect = prepared.view.text.getBounding...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) ch = -1;\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n prepared.rect = prepared.view.text.get...
[ "0.69571626", "0.69571626", "0.69571626", "0.69571626", "0.69571626", "0.69571626", "0.69571626", "0.69571626", "0.69455224", "0.69363755", "0.69285154", "0.69267726", "0.69008875", "0.689963", "0.689963", "0.68910486", "0.68910486", "0.68910486", "0.68891644", "0.68891644", ...
0.6948618
21
Work around problem with bounding client rects on ranges being returned incorrectly when zoomed on IE10 and below.
function maybeUpdateRectForZooming(measure, rect) { if (!window.screen || screen.logicalXDPI == null || screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure)) { return rect } var scaleX = screen.logicalXDPI / screen.deviceXDPI; var scaleY = screen.logicalYDPI / screen.deviceYD...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRangeBoundingClientRect(range){// \"Return a DOMRect object describing the smallest rectangle that includes\r\n\t// the first rectangle in list and all of the remaining rectangles of which\r\n\t// the height or width is not zero.\"\r\n\t// http://www.w3.org/TR/cssom-view/#dom-range-getboundingclientrec...
[ "0.6959988", "0.68512255", "0.67454785", "0.6735959", "0.6735959", "0.6730091", "0.6730091", "0.6730091", "0.6730091", "0.6730091", "0.6730091", "0.6730091", "0.6730091", "0.6730091", "0.67230105", "0.67230105", "0.6667721", "0.6667721", "0.66466224", "0.6546593", "0.6540454"...
0.0
-1
Coverts a box from "div" coords to another coordinate system. Context may be "window", "page", "div", or "local"./null.
function fromCoordSystem(cm, coords, context) { if (context == "div") { return coords } var left = coords.left, top = coords.top; // First move into "page" coordinate system if (context == "page") { left -= pageScrollX(); top -= pageScrollY(); } else if (context == "local" || !context) {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") return coords;\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local...
[ "0.65572524", "0.65572524", "0.65572524", "0.65572524", "0.646069", "0.6408957", "0.6359543", "0.6357952", "0.6357952", "0.6357952", "0.6357952", "0.6357952", "0.6357952", "0.6357952", "0.6357952", "0.6357601", "0.63432693", "0.63292056", "0.63292056", "0.6328615", "0.6328615...
0.6333931
27
Returns a box for a given cursor position, which may have an 'other' property containing the position of the secondary cursor on a bidi boundary. A cursor Pos(line, char, "before") is on the same visual line as `char 1` and after `char 1` in writing order of `char 1` A cursor Pos(line, char, "after") is on the same vis...
function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) { lineObj = lineObj || getLine(cm.doc, pos.line); if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); } function get(ch, right) { var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right...
[ "0.61579114", "0.61579114", "0.61579114", "0.61579114", "0.61579114", "0.61579114", "0.61579114", "0.61579114", "0.61579114", "0.61579114", "0.61518496", "0.6137645", "0.6125479", "0.609435", "0.6078191", "0.6078191", "0.6078191", "0.6078191", "0.6078191", "0.6078191", "0.607...
0.6194518
14
Used to cheaply estimate the coordinates for a position. Used for intermediate scroll updates.
function estimateCoords(cm, pos) { var left = 0; pos = clipPos(cm.doc, pos); if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; } var lineObj = getLine(cm.doc, pos.line); var top = heightAtLine(lineObj) + paddingTop(cm.display); return {left: left, right: left, top: top, bott...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculate_coordinates () {\n\t }", "coordinates () {\n return this._position.coordinates()\n }", "function calcPos() {\n\t\t// Current coordinates\n\t\tvar coords = sphoords.getCoordinates();\n\t\tvar coords_deg = sphoords.getCoordinatesInDegrees();\n\n\t\t// Corresponding position on the sphere\n...
[ "0.6924864", "0.68540347", "0.6801893", "0.6704743", "0.6704743", "0.6704743", "0.6693841", "0.6687542", "0.66735756", "0.66457653", "0.66426927", "0.6631689", "0.66203284", "0.66203284", "0.66203284", "0.66203284", "0.66203284", "0.66203284", "0.66203284", "0.66203284", "0.6...
0.6604912
33
Positions returned by coordsChar contain some extra information. xRel is the relative x position of the input coordinates compared to the found position (so xRel > 0 means the coordinates are to the right of the character position, for example). When outside is true, that means the coordinates lie outside the line's ve...
function PosWithInfo(line, ch, sticky, outside, xRel) { var pos = Pos(line, ch, sticky); pos.xRel = xRel; if (outside) { pos.outside = true; } return pos }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function PosWithInfo(line, ch, sticky, outside, xRel) {\n var pos = Pos(line, ch, sticky);\n pos.xRel = xRel;\n\n if (outside) {\n pos.outside = outside;\n }\n\n return pos;\n } // Compute the character position closest to the given coordinates.", "function coordsChar(cm, x, y) {\n var do...
[ "0.64862144", "0.63672876", "0.63672876", "0.63672876", "0.63325423", "0.63268346", "0.63268346", "0.63268346", "0.63268346", "0.63268346", "0.63268346", "0.63268346", "0.63268346", "0.6316676", "0.6310989", "0.6296272", "0.6296272", "0.6296272", "0.6296272", "0.6282995", "0....
0.0
-1
Compute the character position closest to the given coordinates. Input must be lineSpacelocal ("div" coordinate system).
function coordsChar(cm, x, y) { var doc = cm.doc; y += cm.display.viewOffset; if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) } var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1; if (lineN > last) { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function PosWithInfo(line, ch, sticky, outside, xRel) {\n var pos = Pos(line, ch, sticky);\n pos.xRel = xRel;\n\n if (outside) {\n pos.outside = outside;\n }\n\n return pos;\n } // Compute the character position closest to the given coordinates.", "function coordsChar(cm, x, y) {\n var do...
[ "0.7138674", "0.6260495", "0.6260495", "0.6260495", "0.6260495", "0.62046933", "0.62046933", "0.62046933", "0.62046933", "0.62046933", "0.62046933", "0.62046933", "0.62046933", "0.6193592", "0.61757505", "0.6175573", "0.6170065", "0.6170065", "0.6162911", "0.6151872", "0.6130...
0.6033124
53
Returns true if the given side of a box is after the given coordinates, in toptobottom, lefttoright order.
function boxIsAfter(box, x, y, left) { return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function boxIsAfter(box, x, y, left) {\n\t\t return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n\t\t }", "function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x;\n }", "function boxIsAfter(bo...
[ "0.80230653", "0.7990573", "0.7967614", "0.7967614", "0.7967614", "0.7967614", "0.7967614", "0.7967614", "0.7967614", "0.7967614", "0.7967614", "0.7967614", "0.79146224", "0.62625074", "0.62625074", "0.6129979", "0.605716", "0.5878628", "0.5862407", "0.5801529", "0.57982314",...
0.8012587
15
Compute the default text height.
function textHeight(display) { if (display.cachedTextHeight != null) { return display.cachedTextHeight } if (measureText == null) { measureText = elt("pre"); // Measure a bunch of lines, for browsers that compute // fractional heights. for (var i = 0; i < 49; ++i) { measureText.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function textHeight(display) {\n if (display.cachedTextHeight != null) {\n return display.cachedTextHeight;\n }\n\n if (measureText == null) {\n measureText = elt(\"pre\", null, \"CodeMirror-line-like\"); // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n\n ...
[ "0.7177849", "0.6914069", "0.68965995", "0.68940103", "0.68940103", "0.68940103", "0.68940103", "0.68940103", "0.68940103", "0.68940103", "0.68940103", "0.68940103", "0.68940103", "0.68940103", "0.68940103", "0.68868273", "0.6880334", "0.67942154", "0.67942154", "0.67942154", ...
0.6806602
19
Compute the default character width.
function charWidth(display) { if (display.cachedCharWidth != null) { return display.cachedCharWidth } var anchor = elt("span", "xxxxxxxxxx"); var pre = elt("pre", [anchor]); removeChildrenAndAdd(display.measure, pre); var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10; ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get defaultCharacterWidth() { return this.viewState.heightOracle.charWidth; }", "function charWidth(display) {\n\t\t if (display.cachedCharWidth != null) return display.cachedCharWidth;\n\t\t var anchor = elt(\"span\", \"xxxxxxxxxx\");\n\t\t var pre = elt(\"pre\", [anchor]);\n\t\t removeChildrenAndAd...
[ "0.7920131", "0.7037969", "0.7021818", "0.7021073", "0.7021073", "0.7021073", "0.7000035", "0.7000035", "0.7000035", "0.7000035", "0.7000035", "0.7000035", "0.7000035", "0.7000035", "0.6951675", "0.6948909", "0.6948909", "0.6948909", "0.6948909", "0.6948909", "0.6948909", "...
0.70129645
10
Do a bulkread of the DOM positions and sizes needed to draw the view, so that we don't interleave reading and writing to the DOM.
function getDimensions(cm) { var d = cm.display, left = {}, width = {}; var gutterLeft = d.gutters.clientLeft; for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) { left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft; width[cm.options.gutters[i]] = n.clientWid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_updateRendering() {\n this._domElement.style.width = this._width + 'px'\n this._domElement.style.height = this._height + 'px'\n this._adjustAll()\n }", "draw() {\n if (this._page !== currentPage) {\n return;\n }\n this.drawRectangles();\n if (!isReady) {\n ...
[ "0.5897899", "0.5844595", "0.5798863", "0.5757059", "0.5727924", "0.57139504", "0.5674671", "0.56110436", "0.56022155", "0.5595393", "0.55837214", "0.5493654", "0.54848546", "0.54633313", "0.5460914", "0.5417372", "0.5413575", "0.53778297", "0.5369406", "0.5366451", "0.536295...
0.0
-1
Computes display.scroller.scrollLeft + display.gutters.offsetWidth, but using getBoundingClientRect to get a subpixelaccurate result.
function compensateForHScroll(display) { return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get getBoundingClientRects() {\n if (!this._boundingClientRects) {\n const innerBox = this._innerBoxHelper.nativeElement.getBoundingClientRect();\n const clientRect = this.element.getBoundingClientRect();\n this._boundingClientRects = {\n clientRect,\n ...
[ "0.6243216", "0.6220974", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6184225", "0.6179456", "0.6166653", "0.6166653", "0.6166653", "0.6166653", "...
0.62709266
14
Returns a function that estimates the height of a line, to use as first approximation until the line becomes visible (and is thus properly measurable).
function estimateHeight(cm) { var th = textHeight(cm.display), wrapping = cm.options.lineWrapping; var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3); return function (line) { if (lineIsHidden(cm.doc, line)) { return 0 } var widgetsHeight = 0; ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function heightAtLine(lineObj) {\n\t\t lineObj = visualLine(lineObj);\n\n\t\t var h = 0, chunk = lineObj.parent;\n\t\t for (var i = 0; i < chunk.lines.length; ++i) {\n\t\t var line = chunk.lines[i];\n\t\t if (line == lineObj) { break }\n\t\t else { h += line.height; }\n\t\t }\n\t\t fo...
[ "0.7596268", "0.7594079", "0.75180316", "0.75075346", "0.75075346", "0.7444702", "0.7444702", "0.7444702", "0.7444702", "0.7444702", "0.7444702", "0.7444702", "0.7444702", "0.7444702", "0.7444702", "0.7444702", "0.7444702", "0.7444702", "0.7444702", "0.7444702", "0.7444702", ...
0.71244687
68
Given a mouse event, find the corresponding position. If liberal is false, it checks whether a gutter or scrollbar was clicked, and returns null if it was. forRect is used by rectangular selections, and tries to estimate a character position even for coordinates beyond the right of the text.
function posFromMouse(cm, e, liberal, forRect) { var display = cm.display; if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null } var x, y, space = display.lineSpace.getBoundingClientRect(); // Fails unpredictably on IE[67] when mouse is dragged around quickly. try { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal) {\n var target = e_target(e);\n if (target == display.scrollbarH || target == display.scrollbarV ||\n target == display.scrollbarFiller || target == display.gutterFiller) return null;\n }\n v...
[ "0.77062094", "0.77062094", "0.77062094", "0.77062094", "0.76363605", "0.7512373", "0.7512373", "0.7470907", "0.7470907", "0.7455225", "0.7455225", "0.74524885", "0.74524885", "0.74524885", "0.74524885", "0.74524885", "0.74524885", "0.74524885", "0.74524885", "0.74524885", "0...
0.7454629
16
Find the view element corresponding to a given line. Return null when the line isn't visible.
function findViewIndex(cm, n) { if (n >= cm.display.viewTo) { return null } n -= cm.display.viewFrom; if (n < 0) { return null } var view = cm.display.view; for (var i = 0; i < view.length; i++) { n -= view[i].size; if (n < 0) { return i } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "funct...
[ "0.7010356", "0.7010356", "0.7010356", "0.7010356", "0.7010356", "0.7010356", "0.7010356", "0.7010356", "0.7010356", "0.7010356", "0.7010356", "0.7010356", "0.7010356", "0.7010356", "0.7010356", "0.7010356", "0.7010356", "0.69926566", "0.69926566", "0.69926566", "0.69926566",...
0.0
-1
Draws a cursor for the given range
function drawSelectionCursor(cm, head, output) { var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine); var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor")); cursor.style.left = pos.left + "px"; cursor.style.top = pos.top + "px"; cursor.sty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawSelectionCursor(cm, range, output) {\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = po...
[ "0.69801736", "0.69801736", "0.69801736", "0.69801736", "0.69801736", "0.69801736", "0.69801736", "0.6950206", "0.68451244", "0.6837227", "0.6837227", "0.6837227", "0.6837227", "0.6835953", "0.6835953", "0.6835953", "0.6835953", "0.68251777", "0.68251777", "0.6819444", "0.680...
0.6168477
78
Draws the given range as a highlighted selection
function drawSelectionRange(cm, range$$1, output) { var display = cm.display, doc = cm.doc; var fragment = document.createDocumentFragment(); var padding = paddingH(cm.display), leftSide = padding.left; var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawSelectionRange(cm, range, output) {\n\t\t var display = cm.display, doc = cm.doc;\n\t\t var fragment = document.createDocumentFragment();\n\t\t var padding = paddingH(cm.display), leftSide = padding.left;\n\t\t var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.o...
[ "0.7518527", "0.7518195", "0.7518195", "0.7518195", "0.7518195", "0.75134164", "0.7491995", "0.7491995", "0.7491995", "0.7491995", "0.7467499", "0.74550974", "0.7454464", "0.7444052", "0.7444052", "0.7439307", "0.74364483", "0.7432532", "0.74276966", "0.74276966", "0.74276966...
0.7443068
20
Read the actual heights of the rendered lines, and update their stored heights to match.
function updateHeightsInViewport(cm) { var display = cm.display; var prevBottom = display.lineDiv.offsetTop; for (var i = 0; i < display.view.length; i++) { var cur = display.view[i], height = (void 0); if (cur.hidden) { continue } if (ie && ie_version < 8) { var bot = cur.node.off...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lineHeight(){\n\t\thistoryLine.each(function(index, element){\n\t\t\tif(index == $('.line').length - 1){\n\t\t\t\treturn false;\n\t\t\t} else{\n\t\t\t\tvar thisBlock = $(this).closest('.history-item').height()/2;\n\t\t\t\tvar nextBlock = $(this).closest('.history-item').next().height()/2;\n\t\t\t\tvar h =...
[ "0.6847615", "0.6575622", "0.6532162", "0.6532162", "0.6532162", "0.6532162", "0.6532162", "0.6532162", "0.6532162", "0.6520374", "0.6517116", "0.6517116", "0.6511045", "0.6511045", "0.6511045", "0.6507662", "0.64917886", "0.64917886", "0.64917886", "0.6491407", "0.64767325",...
0.62943816
79
Read and store the height of line widgets associated with the given line.
function updateWidgetHeight(line) { if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) { var w = line.widgets[i], parent = w.node.parentNode; if (parent) { w.height = parent.offsetHeight; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].heigh...
[ "0.7959993", "0.7959993", "0.7959993", "0.7959993", "0.7959993", "0.7959993", "0.7959993", "0.79586625", "0.79324657", "0.79324657", "0.79289424", "0.7914109", "0.7914109", "0.7914109", "0.7900077", "0.7900077", "0.7900077", "0.7900077", "0.7900077", "0.7900077", "0.7900077",...
0.786585
37
Compute the lines that are visible in a given viewport (defaults the the current scroll position). viewport may contain top, height, and ensure (see op.scrollToPos) properties.
function visibleLines(display, doc, viewport) { var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop; top = Math.floor(top - paddingTop(display)); var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight; var ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visibleLines(display, doc, viewport) {\n\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t top = Math.floor(top - paddingTop(display));\n\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHei...
[ "0.74272996", "0.74230975", "0.74230975", "0.7401155", "0.73803174", "0.7377409", "0.7353546", "0.7353546", "0.7353546", "0.7353546", "0.731544", "0.7312608", "0.7312608", "0.7312608", "0.7312608", "0.7312608", "0.7312608", "0.7312608", "0.7312608", "0.7312608", "0.7312608", ...
0.7355309
18
Realign line numbers and gutter marks to compensate for horizontal scrolling.
function alignHorizontally(cm) { var display = cm.display, view = display.view; if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return } var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft; var gutterW = display.gutters.offs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "ensureLineGaps(current, mayMeasure) {\n let wrapping = this.heightOracle.lineWrapping;\n let margin = wrapping ? 10000 /* MarginWrap */ : 2000 /* Margin */, halfMargin = margin >> 1, doubleMargin = margin << 1;\n // The non-wrapping logic won't work at all in predominantly right-to-left text.\...
[ "0.63226783", "0.6284006", "0.625558", "0.6180552", "0.6180552", "0.6180552", "0.6165085", "0.61348224", "0.61348224", "0.61348224", "0.61348224", "0.6134229", "0.6134229", "0.6134229", "0.6134229", "0.6134229", "0.6134229", "0.6125308", "0.6125308", "0.6116254", "0.6109484",...
0.61332417
33
Used to ensure that the line number gutter is still the right size for the current document size. Returns true when an update is needed.
function maybeUpdateLineNumberWidth(cm) { if (!cm.options.lineNumbers) { return false } var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display; if (last.length != display.lineNumChars) { var test = display.measure.appendChild(elt("div", [elt("div", last)], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\",...
[ "0.6706616", "0.6706616", "0.6706616", "0.6706616", "0.6706616", "0.6706616", "0.6696778", "0.6696778", "0.66581243", "0.66581243", "0.66474265", "0.66474265", "0.66474265", "0.66474265", "0.66474265", "0.66474265", "0.66474265", "0.66474265", "0.66474265", "0.66474265", "0.6...
0.6679237
10
SCROLLING THINGS INTO VIEW If an editor sits on the top or bottom of the window, partially scrolled out of view, this ensures that the cursor is visible.
function maybeScrollWindow(cm, rect) { if (signalDOMEvent(cm, "scrollCursorIntoView")) { return } var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null; if (rect.top + box.top < 0) { doScroll = true; } else if (rect.bottom + box.top > (window.innerHeight || document.doc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateView(selection, editor) {\n let path = editor.getPath();\n let i = 0;\n // We check that the selection is actually a point\n // We use selection because for the moment we think it's better not to update the view when the user selects a large part of text\n if (\n selection.newScreenRange....
[ "0.6381544", "0.62946326", "0.61377126", "0.6136688", "0.60811096", "0.6075753", "0.6057329", "0.601064", "0.601064", "0.601064", "0.6005282", "0.5908861", "0.5908861", "0.5908861", "0.5908861", "0.5908861", "0.5908861", "0.5908861", "0.5906888", "0.58924943", "0.58923125", ...
0.5791855
66
Scroll a given position into view (immediately), verifying that it actually became visible (as line heights are accurately measured, the position of something may 'drift' during drawing).
function scrollPosIntoView(cm, pos, end, margin) { if (margin == null) { margin = 0; } var rect; if (!cm.options.lineWrapping && pos == end) { // Set pos and end to the cursor positions around the character pos sticks to // If pos.sticky == "before", that is around pos.ch - 1, otherwise around p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ifVisible(pos) {\n var bottomLine = html.clientHeight + html.scrollTop;\n\n if (pos < bottomLine) {\n return true;\n }\n }", "_checkScrollPosition() {\n\n var isVisible = this._isVisible;\n var isAtBottom = this._isAtBottom;\n var scrollTop = typeof window.scrollY !== 'undefined'...
[ "0.69423", "0.6568037", "0.6292333", "0.6179102", "0.6121385", "0.6019687", "0.59949857", "0.5969167", "0.59429836", "0.5869381", "0.5855563", "0.5851159", "0.5847824", "0.58293194", "0.58235383", "0.5810686", "0.5810506", "0.5798683", "0.5796673", "0.57808304", "0.57767045",...
0.0
-1
Scroll a given set of coordinates into view (immediately).
function scrollIntoView(cm, rect) { var scrollPos = calculateScrollPos(cm, rect); if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); } if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scrollIntoView(cm, x1, y1, x2, y2) {\n\t\t var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\n\t\t if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\n\t\t if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\n\t\t }", "function scrollIntoView(c...
[ "0.6669891", "0.66223603", "0.66223603", "0.66223603", "0.65623295", "0.65623295", "0.65623295", "0.65623295", "0.65623295", "0.65623295", "0.65623295", "0.6510215", "0.64825606", "0.6190785", "0.6190785", "0.6190785", "0.6190785", "0.61849487", "0.61735487", "0.61570007", "0...
0.5908495
38
Calculate a new scroll position needed to scroll the given rectangle into view. Returns an object with scrollTop and scrollLeft properties. When these are undefined, the vertical/horizontal position does not need to be adjusted.
function calculateScrollPos(cm, rect) { var display = cm.display, snapMargin = textHeight(cm.display); if (rect.top < 0) { rect.top = 0; } var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop; var screen = displayHeight(cm), result = {}; if (rect.b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPosition(rect) {\r\n return {\r\n \"top\" : window.scrollY + Math.round(rect.top),\r\n \"right\" : Math.round(rect.left + rect.width),\r\n \"bottom\" : window.scrollY + Math.round(rect.top + rect.height),\r\n \"left\" ...
[ "0.65935665", "0.64901495", "0.64901495", "0.64901495", "0.64901495", "0.64901495", "0.64901495", "0.64879495", "0.6468168", "0.64599055", "0.64464575", "0.64172757", "0.64172757", "0.64172757", "0.64172757", "0.64172757", "0.64172757", "0.64172757", "0.64172757", "0.64172757",...
0.6590364
9
Store a relative adjustment to the scroll position in the current operation (to be applied when the operation finishes).
function addToScrollTop(cm, top) { if (top == null) { return } resolveScrollToPos(cm); cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "saveScrollPosition({ commit }, value) {\n commit('setScrollPosition', value)\n }", "function addToScrollPos(cm, left, top) {\n\t if (left != null || top != null) resolveScrollToPos(cm);\n\t if (left != null)\n\t cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scro...
[ "0.64346343", "0.63160354", "0.63160354", "0.63160354", "0.6271868", "0.6246505", "0.6246505", "0.6246505", "0.6246505", "0.6246505", "0.6246505", "0.6246505", "0.6216615", "0.6205321", "0.6168856", "0.6106831", "0.6085435", "0.60719085", "0.60719085", "0.60719085", "0.606536...
0.0
-1
Make sure that at the end of the operation the current cursor is shown.
function ensureCursorVisible(cm) { resolveScrollToPos(cm); var cur = cm.getCursor(); cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function EmptyCursor () {}", "_showCursor() {\n if (!this._coreService.isCursorInitialized) {\n this._coreService.isCursorInitialized = true;\n this.refresh(this.buffer.y, this.buffer.y);\n }\n }", "checkForCursorVisibility() {\n this.showCaret();\n }", "endDr...
[ "0.7190308", "0.7081346", "0.7073892", "0.6674232", "0.6522049", "0.6432475", "0.6331778", "0.6274427", "0.62296295", "0.6224343", "0.6167284", "0.6154745", "0.6123359", "0.60431594", "0.6026936", "0.6026936", "0.6026936", "0.6026936", "0.60075444", "0.60075444", "0.60075444"...
0.5801836
43
When an operation has its scrollToPos property set, and another scroll action is applied before the end of the operation, this 'simulates' scrolling that position into view in a cheap way, so that the effect of intermediate scroll commands is not ignored.
function resolveScrollToPos(cm) { var range$$1 = cm.curOp.scrollToPos; if (range$$1) { cm.curOp.scrollToPos = null; var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to); scrollToCoordsRange(cm, from, to, range$$1.margin); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "scrollBehavior (to, from, savedPosition) {\n if (savedPosition) {\n console.log(\"后退\")\n return savedPosition\n } else {\n console.log(\"前进\")\n return {x: 0, y: 0}\n }\n }", "scrollBehavior (to, from, savedPosition) {\n return new Promi...
[ "0.6445612", "0.64282805", "0.6379907", "0.63762003", "0.6313169", "0.63107616", "0.6299939", "0.62854207", "0.6278228", "0.6262097", "0.6240442", "0.6235206", "0.6234112", "0.622936", "0.61974496", "0.61974496", "0.6193366", "0.617505", "0.617505", "0.617505", "0.617505", ...
0.6146728
33
Sync the scrollable area and scrollbars, ensure the viewport covers the visible area.
function updateScrollTop(cm, val) { if (Math.abs(cm.doc.scrollTop - val) < 2) { return } if (!gecko) { updateDisplaySimple(cm, {top: val}); } setScrollTop(cm, val, true); if (gecko) { updateDisplaySimple(cm); } startWorker(cm, 100); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_setScrollBars() {\r\n const that = this;\r\n\r\n if (!that._scrollView) {\r\n that._scrollView = new LW.Utilities.Scroll(that.$.timeline, that.$.horizontalScrollBar, that.$.verticalScrollBar);\r\n }\r\n\r\n const vScrollBar = that._scrollView.vScrollBar,\r\n hScro...
[ "0.6310475", "0.60149384", "0.5974547", "0.5973448", "0.595236", "0.594288", "0.5937404", "0.5917567", "0.5917567", "0.5917567", "0.58974105", "0.5860123", "0.5858213", "0.58399194", "0.5810556", "0.578282", "0.5782065", "0.5772861", "0.57630867", "0.5731742", "0.57251173", ...
0.0
-1
Sync scroller and scrollbar, ensure the gutter elements are aligned.
function setScrollLeft(cm, val, isScroller, forceScroll) { val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth); if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return } cm.doc.scrollLeft = val; alignHorizontally(cm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px...
[ "0.7326835", "0.7249031", "0.7249031", "0.7249031", "0.64672166", "0.64672166", "0.64672166", "0.64092076", "0.63350016", "0.63350016", "0.63350016", "0.63350016", "0.63306326", "0.63306326", "0.63306326", "0.63306326", "0.63306326", "0.63306326", "0.63306326", "0.63306326", ...
0.0
-1
SCROLLBARS Prepare DOM reads needed to update the scrollbars. Done in one shot to minimize update/measure roundtrips.
function measureForScrollbars(cm) { var d = cm.display, gutterW = d.gutters.offsetWidth; var docH = Math.round(cm.doc.height + paddingVert(cm.display)); return { clientHeight: d.scroller.clientHeight, viewHeight: d.wrapper.clientHeight, scrollWidth: d.scroller.scrollWidth, clientWidth: d.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createScrollBarForAll(){\n if($('body').hasClass(RESPONSIVE)){\n removeResponsiveScrollOverflows();\n }\n else{\n forEachSectionAndSlide(createScrollBar);\n }\n }", "function createScrollBarForAl...
[ "0.6921312", "0.68662924", "0.6864566", "0.68187743", "0.6620011", "0.6620011", "0.6620011", "0.6611088", "0.64639276", "0.64639276", "0.64639276", "0.6461143", "0.644743", "0.6399939", "0.63948166", "0.63774943", "0.6359205", "0.6356848", "0.6355177", "0.63363695", "0.632876...
0.0
-1
Resynchronize the fake scrollbars with the actual size of the content.
function updateScrollbarsInner(cm, measure) { var d = cm.display; var sizes = d.scrollbars.update(measure); d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px"; d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px"; d.heightForcer.style.borderBottom = sizes.bottom + "px solid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateScrollableContents() {\n if (this.intervalId_ !== null) {\n return;\n } // notifyResize is already in progress.\n\n this.requestUpdateScroll();\n\n const nodeList = this.shadowRoot.querySelectorAll('[scrollable] iron-list');\n if (!nodeList.length) {\n return;\n }\n\n let node...
[ "0.6747355", "0.6548594", "0.65442073", "0.65442073", "0.65442073", "0.6540787", "0.6537264", "0.651434", "0.65052766", "0.65027726", "0.65005", "0.6498004", "0.64838076", "0.6422503", "0.64178014", "0.64178014", "0.6414308", "0.64107054", "0.64107054", "0.64107054", "0.64107...
0.6532036
22
Start a new operation.
function startOperation(cm) { cm.curOp = { cm: cm, viewChanged: false, // Flag that indicates that lines might need to be redrawn startHeight: cm.doc.height, // Used to detect need to update scrollbar forceUpdate: false, // Used to force a redraw updateInput: null, // W...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startNew(options) {\n if (options === void 0) { options = {}; }\n return default_1.DefaultKernel.startNew(options);\n }", "function startNew(options) {\n return Private.startNew(options);\n }", "function startNew(options) {\n return Private.startNew(options);\n }",...
[ "0.61408204", "0.61112124", "0.61112124", "0.5981286", "0.58847827", "0.5828475", "0.57273746", "0.57061714", "0.5692559", "0.5688068", "0.5688068", "0.5688068", "0.5681768", "0.5661453", "0.5646481", "0.5626896", "0.5626896", "0.5626896", "0.5626896", "0.5626896", "0.5621532...
0.55949545
38
Finish an operation, updating the display and signalling delayed events
function endOperation(cm) { var op = cm.curOp; if (op) { finishOperation(op, function (group) { for (var i = 0; i < group.ops.length; i++) { group.ops[i].cm.curOp = null; } endOperations(group); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "finishProcessing() {\n this.busy = false;\n this.successful = true;\n }", "function handleFinish(values) {\n job.current = getJob(values, job.current, writeMessage);\n setBusy(job.current.pendingTime);\n }", "finish() {\n window.setTimeout(\n this.displayAbsorptionTexts.bind(thi...
[ "0.6298353", "0.6149194", "0.6141501", "0.61294717", "0.61197203", "0.6094414", "0.60886836", "0.6063711", "0.60263014", "0.602398", "0.60091406", "0.6005056", "0.59634334", "0.59634334", "0.59634334", "0.59634334", "0.5962261", "0.59593785", "0.5950094", "0.5950094", "0.5931...
0.0
-1
The DOM updates done when an operation finishes are batched so that the minimum number of relayouts are required.
function endOperations(group) { var ops = group.ops; for (var i = 0; i < ops.length; i++) // Read DOM { endOperation_R1(ops[i]); } for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe) { endOperation_W1(ops[i$1]); } for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM { end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processQueue() {\n\t\t if (updateQueue.length) {\n\t\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t\t clearQueue();\n\t\t }\n\t\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(\n\t upda...
[ "0.65617603", "0.6510302", "0.6510302", "0.6510302", "0.6510302", "0.6510302", "0.64980775", "0.64980775", "0.64980775", "0.64980775", "0.64980775", "0.64980775", "0.64980775", "0.64980775", "0.64980775", "0.64980775", "0.64980775", "0.64980775", "0.64980775", "0.64980775", "...
0.0
-1
Run the given function in an operation
function runInOp(cm, f) { if (cm.curOp) { return f() } startOperation(cm); try { return f() } finally { endOperation(cm); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runInOp(cm, f) {\n\t\t if (cm.curOp) { return f() }\n\t\t startOperation(cm);\n\t\t try { return f() }\n\t\t finally { endOperation(cm); }\n\t\t }", "function runInOp(cm, f) {\n\t if (cm.curOp) return f();\n\t startOperation(cm);\n\t try { return f(); }\n\t finally { endOperatio...
[ "0.7219417", "0.72104615", "0.72104615", "0.72104615", "0.7193035", "0.7189245", "0.7069788", "0.7069391", "0.7069391", "0.7069391", "0.7026925", "0.7026925", "0.7026925", "0.7026925", "0.7026925", "0.7026925", "0.7026925", "0.7026925", "0.70114744", "0.6984739", "0.6984739",...
0.7037876
24
Wraps a function in an operation. Returns the wrapped function.
function operation(cm, f) { return function() { if (cm.curOp) { return f.apply(cm, arguments) } startOperation(cm); try { return f.apply(cm, arguments) } finally { endOperation(cm); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "functio...
[ "0.6697844", "0.6697844", "0.6697844", "0.6697844", "0.6697844", "0.6697844", "0.6697844", "0.6697844", "0.6697844", "0.66415626", "0.6519331", "0.64675987", "0.64675987", "0.64675987", "0.64675987", "0.64675987", "0.64675987", "0.64675987", "0.64675987", "0.64675987", "0.646...
0.60960025
83
Used to add methods to editor and doc instances, wrapping them in operations.
function methodOp(f) { return function() { if (this.curOp) { return f.apply(this, arguments) } startOperation(this); try { return f.apply(this, arguments) } finally { endOperation(this); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addEditorMethods(CodeMirror) {\n\t\t var optionHandlers = CodeMirror.optionHandlers;\n\n\t\t var helpers = CodeMirror.helpers = {};\n\n\t\t CodeMirror.prototype = {\n\t\t constructor: CodeMirror,\n\t\t focus: function(){win(this).focus(); this.display.input.focus();},\n\n\t\t setOp...
[ "0.6234695", "0.61433893", "0.61433893", "0.611974", "0.611974", "0.611974", "0.611974", "0.611974", "0.611974", "0.611974", "0.611974", "0.611974", "0.61185527", "0.61185527", "0.61185527", "0.61185527", "0.61185527", "0.61185527", "0.6086015", "0.6070089", "0.6070089", "0...
0.0
-1
Updates the display.view data structure for a given change to the document. From and to are in prechange coordinates. Lendiff is the amount of lines added or subtracted by the change. This is used for changes that span multiple lines, or change the way lines are divided into visual lines. regLineChange (below) register...
function regChange(cm, from, to, lendiff) { if (from == null) { from = cm.doc.first; } if (to == null) { to = cm.doc.first + cm.doc.size; } if (!lendiff) { lendiff = 0; } var display = cm.display; if (lendiff && to < display.viewTo && (display.updateLineNumbers == null || display.updateLine...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function regChange(cm, from, to, lendiff) {\n if (from == null) {\n from = cm.doc.first;\n }\n\n if (to == null) {\n to = cm.doc.first + cm.doc.size;\n }\n\n if (!lendiff) {\n lendiff = 0;\n }\n\n var display = cm.display;\n\n if (lendiff && to < display.viewTo && (display.up...
[ "0.7041917", "0.70200956", "0.7002636", "0.7002636", "0.6970039", "0.6949149", "0.6944299", "0.6944299", "0.6944299", "0.6944299", "0.6944299", "0.6944299", "0.6944299", "0.6944299", "0.69192004", "0.6917124", "0.6862251", "0.6862251", "0.6862251", "0.6862251", "0.6862251", ...
0.6954716
21
Register a change to a single line. Type must be one of "text", "gutter", "class", "widget"
function regLineChange(cm, line, type) { cm.curOp.viewChanged = true; var display = cm.display, ext = cm.display.externalMeasured; if (ext && line >= ext.lineN && line < ext.lineN + ext.size) { display.externalMeasured = null; } if (line < display.viewFrom || line >= display.viewTo) { return } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function LineChange (type, text) {\n this.type = type // ADDED, REMOVED, UNMODIFIED\n this.text = text\n}", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true\n var display = cm.display, ext = cm.display.externalMeasured\n if (ext && line >= ext.lineN && line < ext.lineN + ext.siz...
[ "0.7580951", "0.71199375", "0.71199375", "0.71013796", "0.71013796", "0.71013796", "0.71013796", "0.71013796", "0.71013796", "0.71013796", "0.71013796", "0.71013796", "0.71013796", "0.71013796", "0.70958996", "0.70958996", "0.70958996", "0.70958996", "0.70958996", "0.70958996",...
0.70882684
33
Force the view to cover a given range, adding empty view element or clipping off existing ones as needed.
function adjustView(cm, from, to) { var display = cm.display, view = display.view; if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) { display.view = buildViewArray(cm, from, to); display.viewFrom = from; } else { if (display.viewFrom > from) { display.view ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(viewOf, qmin, qmax) {\n super(viewOf, (field, colLabel, colSchema, colData, df) =>\n _clipAnnoMatrix(field, colLabel, colSchema, colData, df, qmin, qmax)\n );\n this.isClipped = true;\n this.clipRange = [qmin, qmax];\n Object.seal(this);\n }", "setRenderedRange(range) {\n if (...
[ "0.55567807", "0.5474355", "0.5386401", "0.5374076", "0.5352278", "0.5343625", "0.5327344", "0.53100234", "0.52657485", "0.5248539", "0.5234132", "0.52324057", "0.52298397", "0.5208257", "0.51977295", "0.51977295", "0.5189465", "0.5189465", "0.51854396", "0.51854396", "0.5160...
0.4687775
74
Count the number of lines in the view whose DOM representation is out of date (or nonexistent).
function countDirtyView(cm) { var view = cm.display.view, dirty = 0; for (var i = 0; i < view.length; i++) { var lineView = view[i]; if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; } } return dirty }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countLines() {\n let page = document.getElementsByClassName(\"kix-zoomdocumentplugin-outer\")[0];\n if (page == null) {\n return (\"Element does not exist on the document.\")\n }\n let lineCount = 0;\n const pageText = page.innerText;\n\n for (let i = 0; i < pageText.length; i++) ...
[ "0.64810884", "0.6392919", "0.6392919", "0.6392919", "0.6392919", "0.6392919", "0.6392919", "0.6392919", "0.6392919", "0.63783896", "0.6369697", "0.6368045", "0.636577", "0.636577", "0.6359232", "0.6359232", "0.6359232", "0.6359232", "0.6359232", "0.6359232", "0.6359232", "...
0.63936424
15
Does the actual updating of the line display. Bails out (returning false) when there is nothing to be done and forced is false.
function updateDisplayIfNeeded(cm, update) { var display = cm.display, doc = cm.doc; if (update.editorIsHidden) { resetView(cm); return false } // Bail out if the visible area is already rendered and nothing changed. if (!update.force && update.visible.from >= display.viewFrom ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawUpdate( current ) {\n\n\t\tif ( previous.x !== current.x || previous.y !== current.y ) {\n\t\t\tmultiline( previous.x, previous.y, current.x, current.y, splits, lineSymmetryCtrl.checked );\n\t\t}\n\t}", "function checkLineChanged(currLine){\n if (currLine != prevLine){\n return true;\n }\n ret...
[ "0.6166953", "0.60704935", "0.60596794", "0.60596794", "0.6053346", "0.6019743", "0.60192144", "0.5998646", "0.5990659", "0.59882486", "0.59757817", "0.59637856", "0.59621394", "0.5947941", "0.5947941", "0.5947941", "0.5947941", "0.59250045", "0.5923247", "0.59215856", "0.592...
0.5917034
36
Sync the actual display DOM structure with display.view, removing nodes for lines that are no longer in view, and creating the ones that are not there yet, and updating the ones that are out of date.
function patchDisplay(cm, updateNumbersFrom, dims) { var display = cm.display, lineNumbers = cm.options.lineNumbers; var container = display.lineDiv, cur = container.firstChild; function rm(node) { var next = node.nextSibling; // Works around a throw-scroll bug in OS X Webkit if (webkit &...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function patchDisplay(cm, updateNumbersFrom, dims) {\n\t var display = cm.display, lineNumbers = cm.options.lineNumbers;\n\t var container = display.lineDiv, cur = container.firstChild;\n\t\n\t function rm(node) {\n\t var next = node.nextSibling;\n\t // Works around a throw-scroll bug in OS X We...
[ "0.6637351", "0.6637324", "0.6637324", "0.66368717", "0.6625399", "0.66146237", "0.6563916", "0.6563916", "0.65549666", "0.65549666", "0.65549666", "0.65549666", "0.65549666", "0.65549666", "0.65312445", "0.65091825", "0.6507638", "0.6507638", "0.6468993", "0.6468993", "0.646...
0.65698385
18
Rebuild the gutter elements, ensure the margin to the left of the code matches their width.
function updateGutters(cm) { var gutters = cm.display.gutters, specs = cm.options.gutters; removeChildren(gutters); var i = 0; for (; i < specs.length; ++i) { var gutterClass = specs[i]; var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass)); if (gutterCla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wa(e){for(var t=e.display,a={},n={},r=t.gutters.clientLeft,f=t.gutters.firstChild,o=0;f;f=f.nextSibling,++o)a[e.options.gutters[o]]=f.offsetLeft+f.clientLeft+r,n[e.options.gutters[o]]=f.clientWidth;return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:a,gutterWidth:n,wrapperWidth:t.wrapp...
[ "0.66278213", "0.6137225", "0.5910252", "0.5873189", "0.5873189", "0.5873189", "0.5873189", "0.5873189", "0.5873189", "0.5873189", "0.5873189", "0.5873189", "0.5873189", "0.5873189", "0.5873189", "0.5873189", "0.5873189", "0.5873189", "0.5873189", "0.5873189", "0.5805878", ...
0.0
-1
Make sure the gutters options contains the element "CodeMirrorlinenumbers" when the lineNumbers option is true.
function setGuttersForLineNumbers(options) { var found = indexOf(options.gutters, "CodeMirror-linenumbers"); if (found == -1 && options.lineNumbers) { options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]); } else if (found > -1 && !options.lineNumbers) { options.gutters = options....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setGuttersForLineNumbers(options) {\n var found = false;\n for (var i = 0; i < options.gutters.length; ++i) {\n if (options.gutters[i] == \"CodeMirror-linenumbers\") {\n if (options.lineNumbers) found = true;\n else options.gutters.splice(i--, 1);\n }\n }\n if (!found &...
[ "0.8162627", "0.8162627", "0.8162627", "0.8162627", "0.8098978", "0.8058674", "0.8058674", "0.8058674", "0.8045018", "0.79794276", "0.7910028", "0.7910028", "0.7910028", "0.7910028", "0.7910028", "0.7910028", "0.7910028", "0.7910028", "0.7910028", "0.7910028", "0.7910028", ...
0.8009682
17