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
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.76744145", "0.76744145", "0.76744145", "0.76744145", "0.76744145", "0.76744145", "0.76744145", "0.76744145", "0.7654427", "0.76487726", "0.7636767", "0.7626715", "0.7626715", "0.7623724", "0.76186347", "0.76186347", "0.76186347", "0.76186347", "0.76186347", "0.76186347", "...
0.76794684
16
Find the longest line in the document.
function findMaxLine(cm) { var d = cm.display, doc = cm.doc; d.maxLine = getLine(doc, doc.first); d.maxLineLength = lineLength(d.maxLine); d.maxLineChanged = true; doc.iter(function (line) { var len = lineLength(line); if (len > d.maxLineLength) { d.maxLineLength = len; d...
{ "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
23
Change the content (text, markers) of a line. Automatically invalidates cached information and tries to reestimate the line's height.
function updateLine(line, text, markedSpans, estimateHeight) { line.text = text; if (line.stateAfter) { line.stateAfter = null; } if (line.styles) { line.styles = null; } if (line.order != null) { line.order = null; } detachMarkedSpans(line); attachMarkedSpans(line, markedSpans); var 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.7491608", "0.7394629", "0.73894763", "0.73894763", "0.73894763", "0.73894763", "0.73894763", "0.73894763", "0.73894763", "0.7387523", "0.7345274", "0.7345274", "0.7345274", "0.7339563", "0.7339563", "0.7328437", "0.73019385", "0.72927153", "0.72927153", "0.72927153", "0.72...
0.7390273
17
Detach a line from the document tree and its markers.
function cleanUpLine(line) { line.parent = null; detachMarkedSpans(line); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function detachMarkedSpans(line) {\n var spans = line.markedSpans\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line) }\n line.markedSpans = null\n}", "function detachMarkedSpans(line) {\n var spans = line.markedSpans\n if (!spans) { return }\n for (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
76
Render the DOM representation of the text of a line. Also builds up a 'line map', which points at the DOM nodes that represent specific stretches of text, and is used by the measuring code. The returned object contains the DOM node, this map, and information about linewide styles that were set by the mode.
function buildLineContent(cm, lineView) { // The padding-right forces the element to have a 'border', which // is needed on Webkit to be able to get line-level bounding // rectangles for it (in measureChar). var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null); var builder =...
{ "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.7296825", "0.7259922", "0.7259922", "0.7194069", "0.7194069", "0.7194069", "0.70309806", "0.7024098", "0.7003542", "0.7000183", "0.69872445", "0.69866264", "0.69771665", "0.69638944", "0.6954674", "0.6933167", "0.6933167", "0.6933167", "0.6933167", "0.6933167", "0.6933167"...
0.69485915
26
Build up the DOM representation for a single token, and add it to the line map. Takes care to render special characters separately.
function buildToken(builder, text, style, startStyle, endStyle, css, attributes) { if (!text) { return } var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text; var special = builder.cm.state.specialChars, mustWrap = false; var content; if (!special.test(text)) { ...
{ "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.63364595", "0.6152449", "0.611563", "0.6113837", "0.6113837", "0.6113837", "0.6104204", "0.60897434", "0.604226", "0.60420346", "0.6017149", "0.6017149", "0.6017149", "0.6017149", "0.6017149", "0.6017149", "0.6008158", "0.6008158", "0.5997036", "0.5991892", "0.59615743", ...
0.6017149
20
Change some spaces to NBSP to prevent the browser from collapsing trailing spaces at the end of a line when rendering text (issue 1362).
function splitSpaces(text, trailingBefore) { if (text.length > 1 && !/ /.test(text)) { return text } var spaceBefore = trailingBefore, result = ""; for (var i = 0; i < text.length; i++) { var ch = text.charAt(i); if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) ==...
{ "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.7739919", "0.75860053", "0.72711277", "0.7261996", "0.7015653", "0.69172597", "0.67173624", "0.66479915", "0.659467", "0.65831417", "0.6578782", "0.6573841", "0.6523409", "0.64220226", "0.64159256", "0.64096767", "0.64095", "0.6408991", "0.6408991", "0.63840115", "0.636956...
0.65678304
24
Work around nonsense dimensions being reported for stretches of righttoleft text.
function buildTokenBadBidi(inner, order) { return function (builder, text, style, startStyle, endStyle, css, attributes) { style = style ? style + " cm-force-border" : "cm-force-border"; var start = builder.pos, end = start + text.length; for (;;) { // Find the part that overlaps with the ...
{ "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.6612778", "0.66099524", "0.6578742", "0.6569854", "0.6564896", "0.6564896", "0.6545556", "0.6532712", "0.65212727", "0.65170527", "0.65070033", "0.6499207", "0.6499207", "0.649153", "0.649153", "0.649153", "0.6460711", "0.6460711", "0.6460711", "0.6459593", "0.6459526", ...
0.64115644
52
These objects are used to represent the visible (currently drawn) part of the document. A LineView may correspond to multiple logical lines, if those are connected by collapsed ranges.
function LineView(doc, line, lineN) { // The starting line this.line = line; // Continuing lines, if any this.rest = visualLineContinued(line); // Number of logical lines in this visual line this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1; this.node = this.text = null; 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.77587694", "0.7355294", "0.7355294", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73043203", "0.7289012", "0.7289012", "0.728781", "0.7266966", "0.7266966", "0.7...
0.7326388
31
Create a range of LineView objects for the given lines.
function buildViewArray(cm, from, to) { var array = [], nextPos; for (var pos = from; pos < to; pos = nextPos) { var view = new LineView(cm.doc, getLine(cm.doc, pos), pos); nextPos = pos + view.size; array.push(view); } return array }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line; // Continuing lines, if any\n\n this.rest = visualLineContinued(line); // Number of logical lines in this visual line\n\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n...
[ "0.77182955", "0.66010743", "0.66010743", "0.66010743", "0.66010743", "0.66010743", "0.66010743", "0.66010743", "0.66010743", "0.65827054", "0.65815836", "0.6575943", "0.6561047", "0.6553308", "0.6553308", "0.6537662", "0.6537662", "0.6537662", "0.6534156", "0.65170366", "0.6...
0.65894336
20
Often, we want to signal events at a point where we are in the middle of some work, but don't want the handler to start calling other methods on the editor, which might be in an inconsistent state or simply not expect any other events to happen. signalLater looks whether there are any handlers, and schedules them to be...
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
26
When an aspect of a line changes, a string is added to lineView.changes. This updates the relevant part of the line's DOM structure.
function updateLineForChanges(cm, lineView, lineN, dims) { for (var j = 0; j < lineView.changes.length; j++) { var type = lineView.changes[j]; if (type == "text") { updateLineText(cm, lineView); } else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); } else if (type == "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.7633977", "0.7631411", "0.7612085", "0.7612085", "0.7612085", "0.760189", "0.760189", "0.760189", "0.760189", "0.760189", "0.760189", "0.7598171", "0.7597313", "0.7597313", "0.75850314", "0.7557656", "0.7553357", "0.7506481", "0.7506481", "0.7506481", "0.7506481", "0.750...
0.75903237
26
Lines with gutter elements, widgets or a background class need to be wrapped, and have the extra elements added to the wrapper div
function ensureLineWrapped(lineView) { if (lineView.node == lineView.text) { lineView.node = elt("div", null, null, "position: relative"); if (lineView.text.parentNode) { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); } lineView.node.appendChild(lineView.text); ...
{ "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.63652897", "0.6070703", "0.57518905", "0.56793195", "0.5650686", "0.5588701", "0.55632764", "0.55362713", "0.55177873", "0.5483235", "0.54808384", "0.54808384", "0.5474382", "0.54581654", "0.5456185", "0.54484624", "0.54248106", "0.5405661", "0.5405661", "0.5405661", "0.54...
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.7480917", "0.7473227", "0.7392253", "0.7392253", "0.7392253", "0.7392253", "0.7392253", "0.7392253", "0.7392253", "0.7392253", "0.7390707", "0.7390707", "0.7390707", "0.73619705", "0.72684866", "0.72610617", "0.7257943", "0.72563297", "0.7244617", "0.7222567", "0.7222567",...
0.7383554
25
Redraw the line's text. Interacts with the background and text classes because the mode may output tokens that influence these classes.
function updateLineText(cm, lineView) { var cls = lineView.text.className; var built = getLineContent(cm, lineView); if (lineView.text == lineView.node) { lineView.node = built.pre; } lineView.text.parentNode.replaceChild(built.pre, lineView.text); lineView.text = built.pre; if (built.bgClass !=...
{ "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
27
Build a line's DOM representation from scratch
function buildLineElement(cm, lineView, lineN, dims) { var built = getLineContent(cm, lineView); lineView.text = lineView.node = built.pre; if (built.bgClass) { lineView.bgClass = built.bgClass; } if (built.textClass) { lineView.textClass = built.textClass; } updateLineClasses(cm, lineView); 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.7639888", "0.75955623", "0.75483197", "0.7539128", "0.7539128", "0.7481602", "0.7481602", "0.7476351", "0.7471293", "0.7471293", "0.7471293", "0.7471293", "0.7471293", "0.7471293", "0.74629945", "0.7421916", "0.7421916", "0.7421916", "0.7421916", "0.7421916", "0.7421916", ...
0.7545719
14
A lineView may contain multiple logical lines (when merged by collapsed spans). The widgets for all of them need to be drawn.
function insertLineWidgets(cm, lineView, dims) { insertLineWidgetsFor(cm, lineView.line, lineView, dims, true); if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++) { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n inser...
[ "0.7027548", "0.7027548", "0.7027548", "0.7027548", "0.7027548", "0.7027548", "0.70150566", "0.69329065", "0.6855795", "0.68497884", "0.6844549", "0.6844549", "0.68330497", "0.68330497", "0.68291104", "0.68127936", "0.67902917", "0.67902917", "0.67902917", "0.67902917", "0.67...
0.68482625
24
Return true when the given mouse event happened in a widget
function eventInWidget(display, e) { for (var n = e_target(e); n != display.wrapper; n = n.parentNode) { if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") || (n.parentNode == display.sizer && n != display.mover)) { return true } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseClicked() {\n // If it has been clicked return true\n return true;\n }", "mouseClicked(){\n //If we are highlighted and we clicked, return true\n if(this.highlighted){\n return true\n }\n //Else return false\n return false;\n }", "hovered(){\n //if mouse i...
[ "0.7194196", "0.7059485", "0.68766373", "0.6852455", "0.6758913", "0.67542046", "0.6751924", "0.66846025", "0.6671108", "0.664715", "0.6614089", "0.6614089", "0.6614089", "0.6614089", "0.6591147", "0.6567154", "0.65445554", "0.6489968", "0.64857376", "0.64652973", "0.646091",...
0.6431442
40
Ensure the lineView.wrapping.heights array is populated. This is an array of bottom offsets for the lines that make up a drawn line. When lineWrapping is on, there might be more than one height.
function ensureLineHeights(cm, lineView, rect) { var wrapping = cm.options.lineWrapping; var curWidth = wrapping && displayWidth(cm); if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) { var heights = lineView.measure.heights = []; if (wrapping) { lineView.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
20
Find a line map (mapping character offsets to text nodes) and a measurement cache for the given line number. (A line view might contain multiple lines when collapsed ranges are present.)
function mapFromLineView(lineView, line, lineN) { if (lineView.line == line) { return {map: lineView.measure.map, cache: lineView.measure.cache} } for (var i = 0; i < lineView.rest.length; i++) { if (lineView.rest[i] == line) { return {map: lineView.measure.maps[i], cache: lineView.measure.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.75483626", "0.7491622", "0.74201775", "0.74201775", "0.74123937", "0.74108994", "0.7395338", "0.7395338", "0.7395338", "0.7395338", "0.7395338", "0.7395338", "0.7395338", "0.7395338", "0.73932946", "0.73932946", "0.73932946", "0.73932946", "0.73932946", "0.73932946", "0.73...
0.7439926
11
Render a line into the hidden node display.externalMeasured. Used when measurement is needed for a line that's not in the viewport.
function updateExternalMeasurement(cm, line) { line = visualLine(line); var lineN = lineNo(line); var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN); view.lineN = lineN; var built = view.built = buildLineContent(cm, view); view.text = built.pre; removeChildrenAndAdd(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.75342", "0.7487335", "0.7484259", "0.74745804", "0.74694103", "0.74694103", "0.74694103", "0.74694103", "0.74694103", "0.74694103", "0.74694103", "0.74694103", "0.74650806", "0.7460484", "0.7460484", "0.7460484", "0.7459808", "0.7459808", "0.74311703", "0.74311703", "0.743...
0.7475978
14
Find a line view that corresponds to the given line number.
function findViewForLine(cm, lineN) { if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo) { return cm.display.view[findViewIndex(cm, lineN)] } var ext = cm.display.externalMeasured; if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size) { return ext } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function fi...
[ "0.7489299", "0.7489299", "0.7489299", "0.7489299", "0.7489299", "0.7489299", "0.7489299", "0.7489299", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.7480697", "0.74...
0.7497042
11
Measurement can be split in two steps, the setup work that applies to the whole line, and the measurement of the actual character. Functions like coordsChar, that need to do a lot of measurements in a row, can thus ensure that the setup work is only done once.
function prepareMeasureForLine(cm, line) { var lineN = lineNo(line); var view = findViewForLine(cm, lineN); if (view && !view.text) { view = null; } else if (view && view.changes) { updateLineForChanges(cm, view, lineN, getDimensions(cm)); cm.curOp.forceUpdate = true; } if (!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
17
Given a prepared measurement object, measures the position of an actual character (or fetches it from the cache).
function measureCharPrepared(cm, prepared, ch, bias, varHeight) { if (prepared.before) { ch = -1; } var key = ch + (bias || ""), found; if (prepared.cache.hasOwnProperty(key)) { found = prepared.cache[key]; } else { if (!prepared.rect) { prepared.rect = prepared.view.text.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.6956434", "0.6956434", "0.6956434", "0.6956434", "0.6956434", "0.6956434", "0.6956434", "0.6956434", "0.6944827", "0.6935705", "0.69277096", "0.6926043", "0.69001466", "0.6898976", "0.6898976", "0.6890307", "0.6890307", "0.6890307", "0.68885005", "0.68885005", "0.68885005"...
0.6947927
23
Work around problem with bounding client rects on ranges being returned incorrectly when zoomed on IE10 and below.
function maybeUpdateRectForZooming(measure, rect) { if (!window.screen || screen.logicalXDPI == null || screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure)) { return rect } var scaleX = screen.logicalXDPI / screen.deviceXDPI; var scaleY = screen.logicalYDPI / screen.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.6960293", "0.68528867", "0.67470604", "0.6737133", "0.6737133", "0.6730641", "0.6730641", "0.6730641", "0.6730641", "0.6730641", "0.6730641", "0.6730641", "0.6730641", "0.6730641", "0.6724661", "0.6724661", "0.6669039", "0.6669039", "0.66471195", "0.6547397", "0.65430623",...
0.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.6558659", "0.6558659", "0.6558659", "0.6558659", "0.64615387", "0.6410469", "0.6360999", "0.63595706", "0.63595706", "0.63595706", "0.63595706", "0.63595706", "0.63595706", "0.63595706", "0.63595706", "0.63592327", "0.6344733", "0.63308084", "0.63308084", "0.6330061", "0.6...
0.633558
31
Returns a box for a given cursor position, which may have an 'other' property containing the position of the secondary cursor on a bidi boundary. A cursor Pos(line, char, "before") is on the same visual line as `char 1` and after `char 1` in writing order of `char 1` A cursor Pos(line, char, "after") is on the same 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
11
Used to cheaply estimate the coordinates for a position. Used for intermediate scroll updates.
function estimateCoords(cm, pos) { var left = 0; pos = clipPos(cm.doc, pos); if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; } var lineObj = getLine(cm.doc, pos.line); var top = heightAtLine(lineObj) + paddingTop(cm.display); return {left: left, right: left, top: top, 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.69225216", "0.6853562", "0.6800712", "0.670349", "0.670349", "0.670349", "0.6692505", "0.6686151", "0.6673038", "0.6643865", "0.66430914", "0.6631961", "0.6619071", "0.6619071", "0.6619071", "0.6619071", "0.6619071", "0.6619071", "0.6619071", "0.6619071", "0.66069835", "...
0.660359
34
Positions returned by coordsChar contain some extra information. xRel is the relative x position of the input coordinates compared to the found position (so xRel > 0 means the coordinates are to the right of the character position, for example). When outside is true, that means the coordinates lie outside the line's ve...
function PosWithInfo(line, ch, sticky, outside, xRel) { var pos = Pos(line, ch, sticky); pos.xRel = xRel; if (outside) { pos.outside = outside; } return pos }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function PosWithInfo(line, ch, sticky, outside, xRel) {\n var pos = Pos(line, ch, sticky);\n pos.xRel = xRel;\n\n if (outside) {\n pos.outside = outside;\n }\n\n return pos;\n } // Compute the character position closest to the given coordinates.", "function coordsChar(cm, x, y) {\n var do...
[ "0.6486872", "0.6368994", "0.6368994", "0.6368994", "0.6334459", "0.63261276", "0.63261276", "0.63261276", "0.63261276", "0.63261276", "0.63261276", "0.63261276", "0.63261276", "0.6316018", "0.6310313", "0.6298065", "0.6298065", "0.6298065", "0.6298065", "0.6284752", "0.62847...
0.0
-1
Compute the character position closest to the given coordinates. Input must be lineSpacelocal ("div" coordinate system).
function coordsChar(cm, x, y) { var doc = cm.doc; y += cm.display.viewOffset; if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) } var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1; if (lineN > last) { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).tex...
{ "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.71382034", "0.6260421", "0.6260421", "0.6260421", "0.6260421", "0.62046796", "0.62046796", "0.62046796", "0.62046796", "0.62046796", "0.62046796", "0.62046796", "0.62046796", "0.61931807", "0.61761427", "0.6175584", "0.6170042", "0.6170042", "0.6162834", "0.6151725", "0.61...
0.60480213
48
Returns true if the given side of a box is after the given coordinates, in toptobottom, lefttoright order.
function boxIsAfter(box, x, y, left) { return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function boxIsAfter(box, x, y, left) {\n\t\t return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n\t\t }", "function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x;\n }", "function boxIsAfter(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
12
Compute the default text height.
function textHeight(display) { if (display.cachedTextHeight != null) { return display.cachedTextHeight } if (measureText == null) { measureText = elt("pre", null, "CodeMirror-line-like"); // Measure a bunch of lines, for browsers that compute // fractional heights. for (var i = 0; i < 49...
{ "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.7177307", "0.69143856", "0.6897133", "0.68873185", "0.68799967", "0.6806309", "0.6806309", "0.6806309", "0.6806309", "0.6806309", "0.6793898", "0.6793898", "0.6793898", "0.6793898", "0.6793898", "0.6793898", "0.6793898", "0.6793898", "0.6777712", "0.672439", "0.67172724", ...
0.68935585
12
Compute the default character width.
function charWidth(display) { if (display.cachedCharWidth != null) { return display.cachedCharWidth } var anchor = elt("span", "xxxxxxxxxx"); var pre = elt("pre", [anchor], "CodeMirror-line-like"); removeChildrenAndAdd(display.measure, pre); var rect = anchor.getBoundingClientRect(), width = (rect.r...
{ "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.70129645", "0.70129645", "0.70129645", "0.70129645", "0.70129645", "0.7000035", "0.7000035", "0.7000035", "0.7000035", "0.7000035", "0.7000035", "0.7000035", "0.7000035", "0.6951675", "0.686542",...
0.6948909
29
Do a bulkread of the DOM positions and sizes needed to draw the view, so that we don't interleave reading and writing to the DOM.
function getDimensions(cm) { var d = cm.display, left = {}, width = {}; var gutterLeft = d.gutters.clientLeft; for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) { var id = cm.display.gutterSpecs[i].className; left[id] = n.offsetLeft + n.clientLeft + gutterLeft; width[id]...
{ "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.5897446", "0.58449394", "0.57988375", "0.5757708", "0.57276994", "0.5712541", "0.5673291", "0.5610675", "0.5602419", "0.5594531", "0.5583795", "0.54926413", "0.5485577", "0.5463084", "0.54616827", "0.54176617", "0.54121333", "0.537817", "0.53698725", "0.53656584", "0.53627...
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
11
Returns a function that estimates the height of a line, to use as first approximation until the line becomes visible (and is thus properly measurable).
function estimateHeight(cm) { var th = textHeight(cm.display), wrapping = cm.options.lineWrapping; var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3); return function (line) { if (lineIsHidden(cm.doc, line)) { return 0 } var widgetsHeight = 0; ...
{ "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.75962454", "0.75941265", "0.7518054", "0.7507497", "0.7507497", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", ...
0.7124381
72
Given a mouse event, find the corresponding position. If liberal is false, it checks whether a gutter or scrollbar was clicked, and returns null if it was. forRect is used by rectangular selections, and tries to estimate a character position even for coordinates beyond the right of the text.
function posFromMouse(cm, e, liberal, forRect) { var display = cm.display; if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null } var x, y, space = display.lineSpace.getBoundingClientRect(); // Fails unpredictably on IE[67] when mouse is dragged around quickly. try { ...
{ "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.77090347", "0.77090347", "0.77090347", "0.77090347", "0.76392555", "0.75154114", "0.75154114", "0.74738806", "0.74738806", "0.74582624", "0.74582624", "0.7457641", "0.7457641", "0.7457641", "0.7457641", "0.7457641", "0.7457641", "0.7457641", "0.7457641", "0.7455493", "0.74...
0.7435852
39
Find the view element corresponding to a given line. Return null when the line isn't visible.
function findViewIndex(cm, n) { if (n >= cm.display.viewTo) { return null } n -= cm.display.viewFrom; if (n < 0) { return null } var view = cm.display.view; for (var i = 0; i < view.length; i++) { n -= view[i].size; if (n < 0) { return i } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "funct...
[ "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.6991396", "0.6991396", "0.6991396", "0.6991396", "0.6991396", "0....
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
16
Register a change to a single line. Type must be one of "text", "gutter", "class", "widget"
function regLineChange(cm, line, type) { cm.curOp.viewChanged = true; var display = cm.display, ext = cm.display.externalMeasured; if (ext && line >= ext.lineN && line < ext.lineN + ext.size) { display.externalMeasured = null; } if (line < display.viewFrom || line >= display.viewTo) { return } ...
{ "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.7580796", "0.7120189", "0.7120189", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7096139", "0.7096139", "0.7096139", "0.7096139", "0.7096139", "0.7096139", "0.7096139", "...
0.70884424
37
Force the view to cover a given range, adding empty view element or clipping off existing ones as needed.
function adjustView(cm, from, to) { var display = cm.display, view = display.view; if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) { display.view = buildViewArray(cm, from, to); display.viewFrom = from; } else { if (display.viewFrom > from) { display.view ...
{ "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.5556946", "0.5472256", "0.5384595", "0.537245", "0.5349878", "0.53442", "0.53263646", "0.5308165", "0.52663255", "0.52513677", "0.52321917", "0.5231704", "0.52292764", "0.5206579", "0.5195497", "0.5195497", "0.5187255", "0.5187255", "0.5183682", "0.5183682", "0.51568943", ...
0.46898982
72
Count the number of lines in the view whose DOM representation is out of date (or nonexistent).
function countDirtyView(cm) { var view = cm.display.view, dirty = 0; for (var i = 0; i < view.length; i++) { var lineView = view[i]; if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; } } return dirty }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countLines() {\n let page = document.getElementsByClassName(\"kix-zoomdocumentplugin-outer\")[0];\n if (page == null) {\n return (\"Element does not exist on the document.\")\n }\n let lineCount = 0;\n const pageText = page.innerText;\n\n for (let i = 0; i < pageText.length; i++) ...
[ "0.64792055", "0.639454", "0.639454", "0.639454", "0.639454", "0.639454", "0.639454", "0.639454", "0.639454", "0.63799185", "0.6371316", "0.636951", "0.6367281", "0.6367281", "0.636076", "0.636076", "0.636076", "0.636076", "0.636076", "0.636076", "0.636076", "0.636076", "...
0.6395247
14
Draws a cursor for the given range
function drawSelectionCursor(cm, head, output) { var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine); var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor")); cursor.style.left = pos.left + "px"; cursor.style.top = pos.top + "px"; cursor.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
75
Draws the given range as a highlighted selection
function drawSelectionRange(cm, range, output) { var display = cm.display, doc = cm.doc; var fragment = document.createDocumentFragment(); var padding = paddingH(cm.display), leftSide = padding.left; var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.righ...
{ "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.75184023", "0.75181", "0.75181", "0.75181", "0.75181", "0.7513441", "0.74920034", "0.74920034", "0.74920034", "0.74920034", "0.7467525", "0.74552387", "0.7454378", "0.7444069", "0.7444069", "0.7443119", "0.7443119", "0.7443119", "0.7443119", "0.7443119", "0.7443119", "0....
0.74210626
43
Read the actual heights of the rendered lines, and update their stored heights to match.
function updateHeightsInViewport(cm) { var display = cm.display; var prevBottom = display.lineDiv.offsetTop; for (var i = 0; i < display.view.length; i++) { var cur = display.view[i], wrapping = cm.options.lineWrapping; var height = (void 0), width = 0; if (cur.hidden) { continue } i...
{ "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.0
-1
Read and store the height of line widgets associated with the given line.
function updateWidgetHeight(line) { if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) { var w = line.widgets[i], parent = w.node.parentNode; if (parent) { w.height = parent.offsetHeight; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].heigh...
[ "0.79593384", "0.79593384", "0.79593384", "0.79593384", "0.79593384", "0.79593384", "0.79593384", "0.795811", "0.79317176", "0.79317176", "0.7928275", "0.7913349", "0.7913349", "0.7913349", "0.7899005", "0.7899005", "0.7899005", "0.7899005", "0.7899005", "0.7899005", "0.78990...
0.7864872
39
Compute the lines that are visible in a given viewport (defaults the the current scroll position). viewport may contain top, height, and ensure (see op.scrollToPos) properties.
function visibleLines(display, doc, viewport) { var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop; top = Math.floor(top - paddingTop(display)); var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight; var ...
{ "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
22
SCROLLING THINGS INTO VIEW If an editor sits on the top or bottom of the window, partially scrolled out of view, this ensures that the cursor is visible.
function maybeScrollWindow(cm, rect) { if (signalDOMEvent(cm, "scrollCursorIntoView")) { return } var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null; if (rect.top + box.top < 0) { doScroll = true; } else if (rect.bottom + box.top > (window.innerHeight || document.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.6382399", "0.62962425", "0.61368537", "0.6136764", "0.60798055", "0.6077412", "0.6056208", "0.60094726", "0.60094726", "0.60094726", "0.6004994", "0.5907688", "0.5907688", "0.5907688", "0.5907688", "0.5907688", "0.5907688", "0.5907688", "0.59062874", "0.5891157", "0.589115...
0.5791165
66
Scroll a given position into view (immediately), verifying that it actually became visible (as line heights are accurately measured, the position of something may 'drift' during drawing).
function scrollPosIntoView(cm, pos, end, margin) { if (margin == null) { margin = 0; } var rect; if (!cm.options.lineWrapping && pos == end) { // Set pos and end to the cursor positions around the character pos sticks to // If pos.sticky == "before", that is around pos.ch - 1, otherwise around 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.6941846", "0.6569337", "0.62933385", "0.61800575", "0.61191726", "0.6019441", "0.59948593", "0.597039", "0.5944806", "0.58684546", "0.58561337", "0.5852364", "0.58486384", "0.58313596", "0.5824516", "0.5813296", "0.5812549", "0.57976955", "0.57970214", "0.5781929", "0.5778...
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.6669822", "0.6622224", "0.6622224", "0.6622224", "0.65621066", "0.65621066", "0.65621066", "0.65621066", "0.65621066", "0.65621066", "0.65621066", "0.6510055", "0.64823157", "0.61906785", "0.61906785", "0.61906785", "0.61906785", "0.6184818", "0.61735964", "0.6156998", "0....
0.5908387
39
Calculate a new scroll position needed to scroll the given rectangle into view. Returns an object with scrollTop and scrollLeft properties. When these are undefined, the vertical/horizontal position does not need to be adjusted.
function calculateScrollPos(cm, rect) { var display = cm.display, snapMargin = textHeight(cm.display); if (rect.top < 0) { rect.top = 0; } var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop; var screen = displayHeight(cm), result = {}; if (rect.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.65926", "0.6490647", "0.6490647", "0.6490647", "0.6490647", "0.6490647", "0.6490647", "0.64872724", "0.6467502", "0.6460425", "0.6447043", "0.64178056", "0.64178056", "0.64178056", "0.64178056", "0.64178056", "0.64178056", "0.64178056", "0.64178056", "0.64178056", "0.64178...
0.6590855
10
Store a relative adjustment to the scroll position in the current operation (to be applied when the operation finishes).
function addToScrollTop(cm, top) { if (top == null) { return } resolveScrollToPos(cm); cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "saveScrollPosition({ commit }, value) {\n commit('setScrollPosition', value)\n }", "function addToScrollPos(cm, left, top) {\n\t if (left != null || top != null) resolveScrollToPos(cm);\n\t if (left != null)\n\t cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scro...
[ "0.6434745", "0.6315518", "0.6315518", "0.6315518", "0.6271345", "0.6246111", "0.6246111", "0.6246111", "0.6246111", "0.6246111", "0.6246111", "0.6246111", "0.6217396", "0.6204886", "0.6168477", "0.6106627", "0.60856074", "0.60713035", "0.60713035", "0.60713035", "0.606473", ...
0.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.71896726", "0.70795476", "0.70729387", "0.667339", "0.6522092", "0.6430521", "0.6329043", "0.62736994", "0.622839", "0.6224282", "0.6167339", "0.61538243", "0.61226624", "0.6042317", "0.6026656", "0.6026656", "0.6026656", "0.6026656", "0.60073024", "0.60073024", "0.6007302...
0.58007646
46
When an operation has its scrollToPos property set, and another scroll action is applied before the end of the operation, this 'simulates' scrolling that position into view in a cheap way, so that the effect of intermediate scroll commands is not ignored.
function resolveScrollToPos(cm) { var range = cm.curOp.scrollToPos; if (range) { cm.curOp.scrollToPos = null; var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to); scrollToCoordsRange(cm, from, to, range.margin); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "scrollBehavior (to, from, savedPosition) {\n if (savedPosition) {\n console.log(\"后退\")\n return savedPosition\n } else {\n console.log(\"前进\")\n return {x: 0, y: 0}\n }\n }", "scrollBehavior (to, from, savedPosition) {\n return new Promi...
[ "0.6445942", "0.64281124", "0.6380104", "0.6374943", "0.63135195", "0.63110936", "0.6300032", "0.6285562", "0.62773645", "0.62624735", "0.6240491", "0.6235333", "0.6234318", "0.6229291", "0.6197611", "0.61976075", "0.6192568", "0.6169131", "0.6149815", "0.61469245", "0.614692...
0.61753
23
Sync the scrollable area and scrollbars, ensure the viewport covers the visible area.
function updateScrollTop(cm, val) { if (Math.abs(cm.doc.scrollTop - val) < 2) { return } if (!gecko) { updateDisplaySimple(cm, {top: val}); } setScrollTop(cm, val, true); if (gecko) { updateDisplaySimple(cm); } startWorker(cm, 100); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_setScrollBars() {\r\n const that = this;\r\n\r\n if (!that._scrollView) {\r\n that._scrollView = new LW.Utilities.Scroll(that.$.timeline, that.$.horizontalScrollBar, that.$.verticalScrollBar);\r\n }\r\n\r\n const vScrollBar = that._scrollView.vScrollBar,\r\n hScro...
[ "0.63104016", "0.6014229", "0.597583", "0.59733564", "0.59518754", "0.5943817", "0.59371865", "0.59174764", "0.59174764", "0.59174764", "0.58966506", "0.5860512", "0.58578753", "0.58413035", "0.5810574", "0.57836545", "0.57833326", "0.5774653", "0.57643884", "0.5733071", "0.5...
0.0
-1
Sync scroller and scrollbar, ensure the gutter elements are aligned.
function setScrollLeft(cm, val, isScroller, forceScroll) { val = Math.max(0, Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth)); if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return } cm.doc.scrollLeft = val; alignHo...
{ "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.7326363", "0.7248495", "0.7248495", "0.7248495", "0.6466243", "0.6466243", "0.6466243", "0.6408239", "0.6333963", "0.6333963", "0.6333963", "0.6333963", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296...
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.69221926", "0.6867306", "0.68645257", "0.681939", "0.6619201", "0.6619201", "0.6619201", "0.66106427", "0.6462986", "0.6462986", "0.6462986", "0.6459632", "0.64464295", "0.639866", "0.6393667", "0.6378429", "0.6358009", "0.63557327", "0.63541985", "0.63348293", "0.63275594...
0.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.67457443", "0.6548727", "0.6544334", "0.6544334", "0.6544334", "0.6540867", "0.653737", "0.65143853", "0.6505358", "0.65028185", "0.6500194", "0.6498328", "0.64833677", "0.6422464", "0.6417735", "0.6417735", "0.6413763", "0.64106846", "0.64106846", "0.64106846", "0.6410684...
0.6532113
23
Start a new operation.
function startOperation(cm) { cm.curOp = { cm: cm, viewChanged: false, // Flag that indicates that lines might need to be redrawn startHeight: cm.doc.height, // Used to detect need to update scrollbar forceUpdate: false, // Used to force a redraw updateInput: 0, // Whet...
{ "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.5602222
32
Finish an operation, updating the display and signalling delayed events
function endOperation(cm) { var op = cm.curOp; if (op) { finishOperation(op, function (group) { for (var i = 0; i < group.ops.length; i++) { group.ops[i].cm.curOp = null; } endOperations(group); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "finishProcessing() {\n this.busy = false;\n this.successful = true;\n }", "function handleFinish(values) {\n job.current = getJob(values, job.current, writeMessage);\n setBusy(job.current.pendingTime);\n }", "finish() {\n window.setTimeout(\n this.displayAbsorptionTexts.bind(thi...
[ "0.629807", "0.61485785", "0.6140222", "0.612951", "0.6117914", "0.60944146", "0.6089772", "0.6063745", "0.60262775", "0.6023023", "0.6008797", "0.600425", "0.5962399", "0.5962399", "0.5962399", "0.5962399", "0.59612703", "0.5959648", "0.59489655", "0.59489655", "0.59301424",...
0.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.65626323", "0.65111285", "0.65111285", "0.65111285", "0.65111285", "0.65111285", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817...
0.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.721918", "0.7210265", "0.7210265", "0.7210265", "0.719278", "0.71893203", "0.7070357", "0.706983", "0.706983", "0.706983", "0.70266515", "0.70266515", "0.70266515", "0.70266515", "0.70266515", "0.70266515", "0.70266515", "0.70266515", "0.7011207", "0.69852394", "0.69852394...
0.70376015
22
Wraps a function in an operation. Returns the wrapped function.
function operation(cm, f) { return function() { if (cm.curOp) { return f.apply(cm, arguments) } startOperation(cm); try { return f.apply(cm, arguments) } finally { endOperation(cm); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "functio...
[ "0.6697798", "0.6697798", "0.6697798", "0.6697798", "0.6697798", "0.6697798", "0.6697798", "0.6697798", "0.6697798", "0.66419894", "0.6519431", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", ...
0.6096213
80
Used to add methods to editor and doc instances, wrapping them in operations.
function methodOp(f) { return function() { if (this.curOp) { return f.apply(this, arguments) } startOperation(this); try { return f.apply(this, arguments) } finally { endOperation(this); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addEditorMethods(CodeMirror) {\n\t\t var optionHandlers = CodeMirror.optionHandlers;\n\n\t\t var helpers = CodeMirror.helpers = {};\n\n\t\t CodeMirror.prototype = {\n\t\t constructor: CodeMirror,\n\t\t focus: function(){win(this).focus(); this.display.input.focus();},\n\n\t\t setOp...
[ "0.6233383", "0.61421245", "0.61421245", "0.6118489", "0.6118489", "0.6118489", "0.6118489", "0.6118489", "0.6118489", "0.6118489", "0.6118489", "0.6118489", "0.61172724", "0.61172724", "0.61172724", "0.61172724", "0.61172724", "0.61172724", "0.60847", "0.60688365", "0.606883...
0.0
-1
Does the actual updating of the line display. Bails out (returning false) when there is nothing to be done and forced is false.
function updateDisplayIfNeeded(cm, update) { var display = cm.display, doc = cm.doc; if (update.editorIsHidden) { resetView(cm); return false } // Bail out if the visible area is already rendered and nothing changed. if (!update.force && update.visible.from >= display.viewFrom ...
{ "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.61671597", "0.60710144", "0.60607845", "0.60607845", "0.6054482", "0.60209095", "0.6020216", "0.5998901", "0.5991269", "0.5989356", "0.59745157", "0.59646004", "0.5963395", "0.59491736", "0.59491736", "0.59491736", "0.59491736", "0.592617", "0.5924417", "0.5922792", "0.592...
0.59182984
32
Sync the actual display DOM structure with display.view, removing nodes for lines that are no longer in view, and creating the ones that are not there yet, and updating the ones that are out of date.
function patchDisplay(cm, updateNumbersFrom, dims) { var display = cm.display, lineNumbers = cm.options.lineNumbers; var container = display.lineDiv, cur = container.firstChild; function rm(node) { var next = node.nextSibling; // Works around a throw-scroll bug in OS X Webkit if (webkit &...
{ "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.6638065", "0.66379964", "0.66379964", "0.66375774", "0.66260344", "0.6615293", "0.65646994", "0.65646994", "0.65557706", "0.65557706", "0.65557706", "0.65557706", "0.65557706", "0.65557706", "0.6532206", "0.6509948", "0.65085167", "0.65085167", "0.646983", "0.646983", "0.6...
0.65705675
19
Realign line numbers and gutter marks to compensate for horizontal scrolling.
function alignHorizontally(cm) { var display = cm.display, view = display.view; if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return } var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft; var gutterW = display.gutters.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.6321616", "0.6283151", "0.6254765", "0.6179584", "0.6179584", "0.6179584", "0.61641204", "0.6133896", "0.6133896", "0.6133896", "0.6133896", "0.6133247", "0.6133247", "0.6133247", "0.6133247", "0.6133247", "0.6133247", "0.6124336", "0.6124336", "0.6117045", "0.61085737", ...
0.613407
19
Used to ensure that the line number gutter is still the right size for the current document size. Returns true when an update is needed.
function maybeUpdateLineNumberWidth(cm) { if (!cm.options.lineNumbers) { return false } var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display; if (last.length != display.lineNumChars) { var test = display.measure.appendChild(elt("div", [elt("div", last)], ...
{ "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.6707741", "0.6707741", "0.6707741", "0.6707741", "0.6707741", "0.6707741", "0.6697914", "0.6697914", "0.66803974", "0.66803974", "0.66803974", "0.66803974", "0.66591954", "0.66591954", "0.6634631", "0.6634631", "0.6634631", "0.66250575", "0.66222084", "0.66222084", "0.6622...
0.6648584
26
Rebuild the gutter elements, ensure the margin to the left of the code matches their width.
function renderGutters(display) { var gutters = display.gutters, specs = display.gutterSpecs; removeChildren(gutters); display.lineGutter = null; for (var i = 0; i < specs.length; ++i) { var ref = specs[i]; var className = ref.className; var style = ref.style; var gElt = gutters....
{ "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.6624648", "0.6136517", "0.5908344", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.58042896", ...
0.0
-1
The display handles the DOM integration, both for input reading and content drawing. It holds references to DOM nodes and displayrelated state.
function Display(place, doc, input, options) { var d = this; this.input = input; // Covers bottom-right square when both scrollbars are present. d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler"); d.scrollbarFiller.setAttribute("cm-not-content", "true"); // Covers bottom of gut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayDOM(){\r\n\t\tvar str = '';\r\n\t\tcontainer.getChildren().each(function(item){\r\n\t\t\tstr += '<div style=\"' + item.style.cssText + '\">' + item.get('text') + '</div>\\n';\r\n\t\t});\r\n\t\tdocument.id('output').set('text', str);\r\n\t}", "displayScene() {\n\n //Process all component n...
[ "0.71113545", "0.66074544", "0.6554401", "0.62461466", "0.62349385", "0.62249076", "0.6143888", "0.6131278", "0.6119149", "0.6119149", "0.61026573", "0.6072142", "0.60649383", "0.6028712", "0.6020695", "0.6014327", "0.60055435", "0.5979706", "0.58654046", "0.58615804", "0.579...
0.0
-1
Take an unsorted, potentially overlapping set of ranges, and build a selection out of it. 'Consumes' ranges array (modifying it).
function normalizeSelection(cm, ranges, primIndex) { var mayTouch = cm && cm.options.selectionsMayTouch; var prim = ranges[primIndex]; ranges.sort(function (a, b) { return cmp(a.from(), b.from()); }); primIndex = indexOf(ranges, prim); for (var i = 1; i < ranges.length; i++) { var cur = ranges...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static _mergeRanges(ranges, newRange) {\n let inRange = false;\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n if (!inRange) {\n if (newRange[1] <= range[0]) {\n // Case 1: New range is before the search range\n ...
[ "0.70186657", "0.6829976", "0.6789967", "0.6774615", "0.6716162", "0.66930807", "0.6687457", "0.6687457", "0.6687457", "0.6687457", "0.6687457", "0.6687457", "0.6687457", "0.6687457", "0.66794205", "0.66419154", "0.6637528", "0.6637528", "0.6637528", "0.6637528", "0.6637528",...
0.6089187
49
Compute the position of the end of a change (its 'to' property refers to the prechange end).
function changeEnd(change) { if (!change.text) { return change.to } return Pos(change.from.line + change.text.length - 1, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeEnd(change) {\n if (!change.text) {\n return change.to;\n }\n\n return Pos(change.from.line + change.text.length - 1, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0));\n } // Adjust a position to refer to the post-change position of the", "function changeEnd...
[ "0.81361943", "0.7953961", "0.78976995", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.6733018", "0.67322105", "0.6654323", "0.6598373", "0.6589914", ...
0.7954137
17
Adjust a position to refer to the postchange position of the same text, or the end of the change if the change covers it.
function adjustForChange(pos, change) { if (cmp(pos, change.from) < 0) { return pos } if (cmp(pos, change.to) <= 0) { return changeEnd(change) } var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch; if (pos.line == change.to.line) { ch += changeEnd(change).ch ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function adjustForChange(pos, change) {\n\t\t if (cmp(pos, change.from) < 0) return pos;\n\t\t if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\t\t\n\t\t var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n\t\t if (pos.line == change.to.line) ch +=...
[ "0.7517424", "0.75166106", "0.7476101", "0.7449859", "0.7449859", "0.7445846", "0.7444705", "0.7421281", "0.7421281", "0.7421281", "0.7421281", "0.7421281", "0.7421281", "0.7421281", "0.7408827", "0.7380149", "0.7380149", "0.7374359", "0.7374359", "0.7374359", "0.7374359", ...
0.741919
27
Used by replaceSelections to allow moving the selection to the start or around the replaced test. Hint may be "start" or "around".
function computeReplacedSel(doc, changes, hint) { var out = []; var oldPrev = Pos(doc.first, 0), newPrev = oldPrev; for (var i = 0; i < changes.length; i++) { var change = changes[i]; var from = offsetPos(change.from, oldPrev, newPrev); var to = offsetPos(changeEnd(change), oldPrev, newPre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "replaceBeforeCursor(start, text) {\n this.insertBetween(start, this.el.selectionStart, text);\n }", "function moveSelection(event) {\n event.preventDefault();\n event.stopPropagation();\n console.log('Calling moveSelection');\n \n optimalApp.selectionPosition[0] = event.pageX - optimalApp.selectionOffse...
[ "0.6645743", "0.6270994", "0.61845195", "0.6150499", "0.6104101", "0.60757375", "0.60718614", "0.60028625", "0.6002224", "0.5982876", "0.5982876", "0.5982876", "0.597064", "0.59512234", "0.59484506", "0.59484506", "0.59484506", "0.59349036", "0.58870625", "0.5841855", "0.5833...
0.5666932
66
Used to get the editor into a consistent state again when options change.
function loadMode(cm) { cm.doc.mode = getMode(cm.options, cm.doc.modeOption); resetModeState(cm); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateEditor() {\n\t\ttextToEditor();\n\t\tpositionEditorCaret();\n\t}", "optionsUpdateHook() { }", "function _onEditorChanged() {\n\t\t_close();\n\t\tcurrentEditor = EditorManager.getCurrentFullEditor();\n\n\t\tcurrentEditor.$textNode = $(currentEditor.getRootElement()).find(\".CodeMirror-lines\");\n...
[ "0.65174145", "0.6448267", "0.6407012", "0.6382705", "0.63655174", "0.63512903", "0.6341789", "0.6240036", "0.62384015", "0.62281793", "0.6186693", "0.61820716", "0.614012", "0.6127556", "0.61134076", "0.61133647", "0.6105441", "0.6083987", "0.6079587", "0.60270965", "0.60219...
0.0
-1
DOCUMENT DATA STRUCTURE By default, updates that start and end at the beginning of a line are treated specially, in order to make the association of line widgets and marker elements with the text behave more intuitive.
function isWholeLineUpdate(doc, change) { return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" && (!doc.cm || doc.cm.options.wholeLineUpdateBefore) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update(text, start, end) {\n this.lineOffsets = undefined;\n const content = this.getText();\n this.setText(content.slice(0, start) + text + content.slice(end));\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n\t\t function spansFor(n) {return markedSpans ? marke...
[ "0.62110734", "0.57639134", "0.5717615", "0.5717556", "0.5717556", "0.5697219", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56392586", "0.56392586", "0.56392586", ...
0.0
-1
Perform a change on the document data structure.
function updateDoc(doc, change, markedSpans, estimateHeight) { function spansFor(n) {return markedSpans ? markedSpans[n] : null} function update(line, text, spans) { updateLine(line, text, spans, estimateHeight); signalLater(line, "change", line, change); } function linesFor(start, end) { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "change(docId, doc) {\n const cleanedDoc = this._getCleanedObject(doc);\n let storedDoc = this.store[docId];\n deepExtend(storedDoc, cleanedDoc);\n\n let changedData = {};\n _.each(cleanedDoc, (value, key) => {\n changedData[key] = storedDoc[key];\n });\n\n ...
[ "0.70639664", "0.65255326", "0.60612947", "0.5983165", "0.57900375", "0.5765763", "0.57389504", "0.5728134", "0.56999445", "0.5689289", "0.568801", "0.5685086", "0.5677597", "0.5652581", "0.5643472", "0.563531", "0.563531", "0.563531", "0.56288433", "0.55978465", "0.5595986",...
0.0
-1
Call f for all linked documents.
function linkedDocs(doc, f, sharedHistOnly) { function propagate(doc, skip, sharedHist) { if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) { var rel = doc.linked[i]; if (rel.doc == skip) { continue } var shared = sharedHist && rel.sharedHist; if (sharedHistOnly && ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function linkedDocs(doc, f, sharedHistOnly) {\r\n function propagate(doc, skip, sharedHist) {\r\n if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\r\n var rel = doc.linked[i];\r\n if (rel.doc == skip) continue;\r\n var shared = sharedHist && rel.sharedHist;\r\n if (...
[ "0.72876906", "0.7267145", "0.7267145", "0.7267145", "0.7267145", "0.7267145", "0.7267145", "0.7267145", "0.72423947", "0.72423947", "0.72423947", "0.7223533", "0.72208107", "0.71978104", "0.716727", "0.716727", "0.716727", "0.716727", "0.716727", "0.716727", "0.716727", "0...
0.7237777
26
Attach a document to an editor.
function attachDoc(cm, doc) { if (doc.cm) { throw new Error("This document is already in use.") } cm.doc = doc; doc.cm = cm; estimateLineHeights(cm); loadMode(cm); setDirectionClass(cm); if (!cm.options.lineWrapping) { findMaxLine(cm); } cm.options.mode = doc.modeOption; regChange(cm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attachDoc(cm, doc) {\n\t\t if (doc.cm) throw new Error(\"This document is already in use.\");\n\t\t cm.doc = doc;\n\t\t doc.cm = cm;\n\t\t estimateLineHeights(cm);\n\t\t loadMode(cm);\n\t\t if (!cm.options.lineWrapping) findMaxLine(cm);\n\t\t cm.options.mode = doc.modeOption;\n\t\t ...
[ "0.6626215", "0.6624217", "0.6578821", "0.6578821", "0.6578821", "0.65262896", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.64938515", "0.64938515", "0.64938515", "0.6477321", "0.6477321", "0.6477321", "0.6477321", "0.6477321",...
0.64563096
37
Create a history change event from an updateDocstyle change object.
function historyChangeFromChange(doc, change) { var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}; attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function historyChangeFromChange(doc, change) {\n\t\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t\t linkedDocs(doc, function(doc) {attachLocalSpans(do...
[ "0.696248", "0.694849", "0.69350445", "0.69350445", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.69227433", "0.69227433", "0.69227433", "0.6911714", "0.6911714", "0.6911714", ...
0.68901587
38
Pop all selection events off the end of a history array. Stop at a change event.
function clearSelectionEvents(array) { while (array.length) { var last = lst(array); if (last.ranges) { array.pop(); } else { break } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearSelectionEvents(array) {\n\t\t while (array.length) {\n\t\t var last = lst(array);\n\t\t if (last.ranges) array.pop();\n\t\t else break;\n\t\t }\n\t\t }", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) ...
[ "0.7114935", "0.7105218", "0.7105218", "0.7105218", "0.7105218", "0.7105218", "0.7105218", "0.7105218", "0.71047795", "0.71020734", "0.71020734", "0.71020734", "0.70783186", "0.69916886", "0.69916886", "0.69916886", "0.69916886", "0.69916886", "0.69916886", "0.69916886", "0.6...
0.7082853
24
Find the top change event in the history. Pop off selection events that are in the way.
function lastChangeEvent(hist, force) { if (force) { clearSelectionEvents(hist.done); return lst(hist.done) } else if (hist.done.length && !lst(hist.done).ranges) { return lst(hist.done) } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) { hist.done.pop(); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist....
[ "0.6685738", "0.63823617", "0.6360518", "0.6342472", "0.6342472", "0.6342472", "0.6278475", "0.6278475", "0.6278475", "0.6278475", "0.6278475", "0.6278475", "0.6278475", "0.62490594", "0.623188", "0.623188", "0.62148124", "0.62148124", "0.62148124", "0.62148124", "0.62148124"...
0.6287687
22
Register a change in the history. Merges changes that are within a single operation, or are close together with an origin that allows merging (starting with "+") into a single event.
function addChangeToHistory(doc, change, selAfter, opId) { var hist = doc.history; hist.undone.length = 0; var time = +new Date, cur; var last; if ((hist.lastOp == opId || hist.lastOrigin == change.origin && change.origin && ((change.origin.charAt(0) == "+" && hist.lastModTime > t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastM...
[ "0.6184258", "0.6176788", "0.6174049", "0.6174049", "0.6174049", "0.6174049", "0.6174049", "0.6174049", "0.6159121", "0.6155636", "0.6155636", "0.61505264", "0.6144719", "0.61193234", "0.611699", "0.611699", "0.6108021", "0.6108021", "0.6108021", "0.6108021", "0.6108021", "...
0.6182238
17
Called whenever the selection changes, sets the new selection as the pending selection in the history, and pushes the old pending selection into the 'done' array when it was significantly different (in number of selected ranges, emptiness, or time).
function addSelectionToHistory(doc, sel, opId, options) { var hist = doc.history, origin = options && options.origin; // A new event is started when the previous origin does not match // the current, or the origins don't allow matching. Origins // starting with * are always merged, those starting with ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_gcSelections () {\n for (let i = 0; i < this._selections.length; ++i) {\n const s = this._selections[i]\n const oldOffset = s.offset\n\n // check for newly downloaded pieces in selection\n while (this.bitfield.get(s.from + s.offset) && s.from + s.offset < s.to) {\n s.offset += 1\n ...
[ "0.66112244", "0.66112244", "0.66112244", "0.6406183", "0.6334268", "0.62584734", "0.62584734", "0.62584734", "0.6165519", "0.6138466", "0.6100709", "0.6091438", "0.6091438", "0.60838115", "0.60519296", "0.60515946", "0.6047643", "0.6047643", "0.6046075", "0.60457534", "0.602...
0.6019837
38
Used to store marked span information in the history.
function attachLocalSpans(doc, change, from, to) { var existing = change["spans_" + doc.id], n = 0; doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) { if (line.markedSpans) { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMarkedSpan(line, span) {\n\t\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t\t span.marker.attachLine(line);\n\t\t }", "function addMarkedSpan(line, span) {\n\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t span....
[ "0.6327484", "0.6285503", "0.6285503", "0.6285503", "0.62029684", "0.61554384", "0.6131782", "0.6125477", "0.6125477", "0.6085742", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.6...
0.54982615
82
When un/redoing restores text containing marked spans, those that have been explicitly cleared should not be restored.
function removeClearedSpans(spans) { if (!spans) { return null } var out; for (var i = 0; i < spans.length; ++i) { if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } } else if (out) { out.push(spans[i]); } } return !out ? spans : out.length ? out : null }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function remark() {\n for (var i = 0; i < vm.game.marked.length; i++) {\n var element = angular.element(document.getElementById('text-' + i));\n var marked = vm.game.marked[i];\n element.removeClass('last');\n element.removeClass('first');\n ...
[ "0.6541307", "0.65243256", "0.64623547", "0.6354376", "0.63102525", "0.62996334", "0.6291705", "0.6282214", "0.62536573", "0.62536573", "0.62536573", "0.6238591", "0.62097794", "0.6202563", "0.62011385", "0.620092", "0.6195618", "0.6195618", "0.6195618", "0.6195618", "0.61956...
0.0
-1
Retrieve and filter the old marked spans stored in a change event.
function getOldSpans(doc, change) { var found = change["spans_" + doc.id]; if (!found) { return null } var nw = []; for (var i = 0; i < change.text.length; ++i) { nw.push(removeClearedSpans(found[i])); } return nw }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOldSpans(doc, change) {\n\t\t var found = change[\"spans_\" + doc.id];\n\t\t if (!found) { return null }\n\t\t var nw = [];\n\t\t for (var i = 0; i < change.text.length; ++i)\n\t\t { nw.push(removeClearedSpans(found[i])); }\n\t\t return nw\n\t\t }", "function getOldSpans(doc, cha...
[ "0.7795729", "0.7775589", "0.7745061", "0.7745061", "0.7745061", "0.76677495", "0.76677495", "0.76677495", "0.76677495", "0.76677495", "0.76677495", "0.76677495", "0.76551306", "0.7651843", "0.7651843", "0.7651643", "0.76475054", "0.76475054", "0.76475054", "0.76475054", "0.7...
0.77104664
21
Used for un/redoing changes from the history. Combines the result of computing the existing spans with the set of spans that existed in the history (so that deleting around a span and then undoing brings back the span).
function mergeOldSpans(doc, change) { var old = getOldSpans(doc, change); var stretched = stretchSpansOverChange(doc, change); if (!old) { return stretched } if (!stretched) { return old } for (var i = 0; i < old.length; ++i) { var oldCur = old[i], stretchCur = stretched[i]; if (oldCur ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOldSpans(doc, change) {\n\t\t var found = change[\"spans_\" + doc.id];\n\t\t if (!found) return null;\n\t\t for (var i = 0, nw = []; i < change.text.length; ++i)\n\t\t nw.push(removeClearedSpans(found[i]));\n\t\t return nw;\n\t\t }", "function getOldSpans(doc, change) {\n\t\t var...
[ "0.62034744", "0.6182492", "0.6147326", "0.6147326", "0.6147326", "0.60734504", "0.60734504", "0.60734504", "0.60734504", "0.60734504", "0.60734504", "0.60734504", "0.6068917", "0.6055901", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.60318...
0.0
-1
Used both to provide a JSONsafe object in .getHistory, and, when detaching a document, to split the history in two
function copyHistoryArray(events, newGroup, instantiateSel) { var copy = []; for (var i = 0; i < events.length; ++i) { var event = events[i]; if (event.ranges) { copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event); continue } var changes = event.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "serializeHistory(state) {\r\n if (!state)\r\n return null;\r\n // Ensure sure that all entries have url\r\n var entries = state.entries.filter(e => e.url);\r\n if (!entries.length)\r\n return null;\r\n // Ensure the index is in bounds.\r\n var index = (state.index || entries.length) - 1...
[ "0.6128736", "0.597194", "0.5751274", "0.5658887", "0.5648688", "0.55759466", "0.55759466", "0.55759466", "0.5567405", "0.5567405", "0.5567405", "0.5567405", "0.5567405", "0.5567405", "0.5567405", "0.55629796", "0.555769", "0.555769", "0.555769", "0.555769", "0.555769", "0....
0.0
-1
The 'scroll' parameter given to many of these indicated whether the new cursor position should be scrolled into view after modifying the selection. If shift is held or the extend flag is set, extends a range to include a given position (and optionally a second position). Otherwise, simply returns the range between the ...
function extendRange(range, head, other, extend) { if (extend) { var anchor = range.anchor; if (other) { var posBefore = cmp(head, anchor) < 0; if (posBefore != (cmp(other, anchor) < 0)) { anchor = head; head = other; } else if (posBefore != (cmp(head, other) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function extendRange(doc, range, head, other) {\n\t\t if (doc.cm && doc.cm.display.shift || doc.extend) {\n\t\t var anchor = range.anchor;\n\t\t if (other) {\n\t\t var posBefore = cmp(head, anchor) < 0;\n\t\t if (posBefore != (cmp(other, anchor) < 0)) {\n\t\t anchor = head;\n\t\...
[ "0.64107454", "0.6394376", "0.6394376", "0.6394376", "0.63048786", "0.626854", "0.626854", "0.626854", "0.626854", "0.626854", "0.626854", "0.626854", "0.626854", "0.6225508", "0.6225508", "0.6140053", "0.5967149", "0.5950152", "0.5857598", "0.58396757", "0.58396757", "0.58...
0.58298576
41
Extend the primary selection range, discard the rest.
function extendSelection(doc, head, other, options, extend) { if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); } setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n\n if (posBefore != cmp(other, anchor) < 0) {\n anchor = head;\n head = other;\n } else if (posBefore != cmp...
[ "0.7361317", "0.72121984", "0.71236956", "0.71236956", "0.71236956", "0.7040623", "0.7038878", "0.7036874", "0.7036874", "0.7036874", "0.7036874", "0.7036874", "0.7036874", "0.7036874", "0.7036874", "0.70040554", "0.70040554", "0.67941666", "0.6732129", "0.6732129", "0.673212...
0.6841599
28
Extend all selections (pos is an array of selections with length equal the number of selections)
function extendSelections(doc, heads, options) { var out = []; var extend = doc.cm && (doc.cm.display.shift || doc.extend); for (var i = 0; i < doc.sel.ranges.length; i++) { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); } var newSel = normalizeSelection(doc.cm, out, doc.sel.prim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function extendSelections(doc, heads, options) {\n\t\t for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n\t\t out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n\t\t var newSel = normalizeSelection(out, doc.sel.primIndex);\n\t\t setSelection(doc, newSel, options);\n\t\t }", "f...
[ "0.67251664", "0.66988546", "0.66988546", "0.66988546", "0.66708016", "0.6634704", "0.663125", "0.663125", "0.663125", "0.663125", "0.663125", "0.663125", "0.663125", "0.663125", "0.6623119", "0.65670156", "0.65670156", "0.6553308", "0.6553308", "0.6553308", "0.65335655", "...
0.6371589
36
Updates a single range in the selection.
function replaceOneSelection(doc, i, range, options) { var ranges = doc.sel.ranges.slice(0); ranges[i] = range; setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateInRange(editor, range, offset = 0, updateFunc) {\n const baseRange = editor.getSelectedRange();\n editor.setSelectedRange(range);\n updateFunc();\n editor.setSelectedRange([baseRange[0] + offset, baseRange[1] + offset]);\n }", "updateRange(start, end) {\n this.range.start = start\n this....
[ "0.7218381", "0.69966", "0.6366824", "0.6361162", "0.6361162", "0.6361162", "0.63484067", "0.63484067", "0.63484067", "0.63484067", "0.63484067", "0.63484067", "0.63484067", "0.63484067", "0.63363445", "0.63199526", "0.63136816", "0.63136816", "0.6311347", "0.6283103", "0.626...
0.62980735
30
Reset the selection to a single range.
function setSimpleSelection(doc, anchor, head, options) { setSelection(doc, simpleSelection(anchor, head), options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_resetSelection() {\n this.__selectedRangeArr = [];\n this.__anchorSelectionIndex = -1;\n this.__leadSelectionIndex = -1;\n }", "restoreRange() {\n if (this.lastRange) {\n this.lastRange.select();\n this.focus();\n }\n }", "reset() {\n this._selection = -1;\n }", "funct...
[ "0.79783505", "0.76575625", "0.7616093", "0.74678564", "0.7437772", "0.72755456", "0.72359824", "0.71725357", "0.69074774", "0.69074774", "0.69074774", "0.68833935", "0.68802726", "0.68802726", "0.68802726", "0.68802726", "0.68802726", "0.68802726", "0.68802726", "0.68802726", ...
0.0
-1
Give beforeSelectionChange handlers a change to influence a selection update.
function filterSelectionChange(doc, sel, options) { var obj = { ranges: sel.ranges, update: function(ranges) { this.ranges = []; for (var i = 0; i < ranges.length; i++) { this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor), clipPos(doc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() { }", "function SelectionChange() { }", "beforeSelectRow(rowid, e){\n }", "selectionChanged(context, onContextChanged) {\n retur...
[ "0.7436134", "0.7436134", "0.7436134", "0.7436134", "0.7315609", "0.7315609", "0.64987767", "0.6486742", "0.64495426", "0.64479816", "0.6396452", "0.6395277", "0.6395277", "0.6395277", "0.6390618", "0.6350694", "0.63113916", "0.6283778", "0.6238949", "0.6238949", "0.61821294"...
0.5942009
49
Set a new selection.
function setSelection(doc, sel, options) { setSelectionNoUndo(doc, sel, options); addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setSelection(doc, sel, options) {\n\t\t setSelectionNoUndo(doc, sel, options);\n\t\t addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n\t\t }", "function setSelection(doc, sel, options) {\n\t\t setSelectionNoUndo(doc, sel, options);\n\t\t addSelectionToHistory(d...
[ "0.7453179", "0.7453179", "0.7395772", "0.7395772", "0.7395772", "0.7356902", "0.72738075", "0.72738075", "0.7272042", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.7192502", "0.6912936...
0.7300484
24
Verify that the selection does not partially select any atomic marked ranges.
function reCheckSelection(doc) { setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get hasSelection() {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[0] !== end[0] || start[1] !== end[1];\n }", "function selectionIsSane() {\n\t\t\tvar minSi...
[ "0.6870172", "0.60677147", "0.6066715", "0.6055218", "0.60424894", "0.5962891", "0.5962891", "0.5962891", "0.5962891", "0.5962891", "0.5962891", "0.5962891", "0.596198", "0.5916995", "0.5891306", "0.5881634", "0.5881634", "0.5879924", "0.5879924", "0.5879924", "0.5879924", ...
0.57861257
69
Return a selection that does not partially select any atomic ranges.
function skipAtomicInSelection(doc, sel, bias, mayClear) { var out; for (var i = 0; i < sel.ranges.length; i++) { var range = sel.ranges[i]; var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]; var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "selection_excluding(cells) {\n const selection = new Set(this.selection);\n for (const cell of cells) {\n selection.delete(cell);\n }\n return selection;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.l...
[ "0.68471473", "0.6635531", "0.6635531", "0.6635531", "0.6635531", "0.6635531", "0.6635531", "0.6635531", "0.6594504", "0.6475148", "0.6474048", "0.6474048", "0.6436025", "0.6436025", "0.6436025", "0.6436025", "0.6436025", "0.6436025", "0.6436025", "0.6436025", "0.6436025", ...
0.64379954
22
Ensure a given position is not inside an atomic range.
function skipAtomic(doc, pos, oldPos, bias, mayClear) { var dir = bias || 1; var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) || (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) || skipAtomicInner(doc, pos, oldPos, -dir, mayClear) || (!mayClear && skipAtomicInner(d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static isInsideRange(position, range) {\n if (range.start.line === range.end.line) {\n return range.start.line === position.line\n && range.start.character <= position.character\n && position.character <= range.end.character;\n }\n else if (range.start....
[ "0.59879375", "0.5966708", "0.59146243", "0.562402", "0.56166", "0.5598513", "0.5584527", "0.5547357", "0.5532226", "0.5531274", "0.5508034", "0.54775023", "0.547714", "0.5409574", "0.54091066", "0.5399065", "0.5388472", "0.5386206", "0.53633547", "0.5344547", "0.5343511", ...
0.0
-1