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
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.7300484", "0.7300484", "0.7300484", "0.7300484", "0.7300484", "0.7300484", "0.7300484", "0.7300484", "0.7300484", "0.7300484", "0.7300484", "0.7300484", "0.7300484", "0.7300484", "0.7300484", "...
0.7272042
33
Verify that the selection does not partially select any atomic marked ranges.
function reCheckSelection(doc) { setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll); }
{ "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.0
-1
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 newAnchor = skipAtomic(doc, range.anchor, bias, mayClear); var newHead = skipAtomic(doc, range.head, bias, mayClear); if (out || newAncho...
{ "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.6847842", "0.6637457", "0.6637457", "0.6637457", "0.6637457", "0.6637457", "0.6637457", "0.6637457", "0.6477013", "0.6475794", "0.6475794", "0.6439841", "0.6439841", "0.6439841", "0.6439841", "0.6439841", "0.6439841", "0.6439841", "0.6439841", "0.6439841", "0.6439841", "...
0.6596417
8
Ensure a given position is not inside an atomic range.
function skipAtomic(doc, pos, bias, mayClear) { var flipped = false, curPos = pos; var dir = bias || 1; doc.cantEdit = false; search: for (;;) { var line = getLine(doc, curPos.line); if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) { var sp ...
{ "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.59889543", "0.59686285", "0.5916081", "0.56262064", "0.56172895", "0.5600432", "0.55854857", "0.55482024", "0.55333084", "0.55325186", "0.5510936", "0.54777867", "0.54776806", "0.541091", "0.54105973", "0.53991055", "0.53884256", "0.5388403", "0.5365578", "0.53471917", "0....
0.0
-1
SELECTION DRAWING Redraw the selection and/or cursor
function drawSelection(cm) { var display = cm.display, doc = cm.doc, result = {}; var curFragment = result.cursors = document.createDocumentFragment(); var selFragment = result.selection = document.createDocumentFragment(); for (var i = 0; i < doc.sel.ranges.length; i++) { var range = doc.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawSelections() {\n\t\thideSelectionRect();\n\t}", "function updateSelection(){\n\t\t\tif(lastMousePos.pageX == null) return;\n\t\t\t\n\t\t\tsetSelectionPos(selection.second, lastMousePos);\n\t\t\tclearSelection();\n\t\t\t\n\t\t\tif(selectionIsSane()) drawSelection();\n\t\t}", "function drawSelection...
[ "0.78486377", "0.7741627", "0.7313765", "0.7160716", "0.69569415", "0.694826", "0.6926943", "0.68883574", "0.6829901", "0.6801858", "0.6770737", "0.6767673", "0.67041683", "0.67026585", "0.6661518", "0.6613574", "0.6611723", "0.66105074", "0.66044146", "0.65924394", "0.659029...
0.0
-1
Draws a cursor for the given range
function drawSelectionCursor(cm, range, output) { var pos = cursorCoords(cm, range.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"; ...
{ "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.68451244", "0.6837227", "0.6837227", "0.6837227", "0.6837227", "0.6835953", "0.6835953", "0.6835953", "0.6835953", "0.68251777", "0.68251777", "0.6819444", "0.68056154", "0.68...
0.6950206
7
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, rightSide = display.lineSpace.offsetWidth - padding.right; function add(left, top, width, bottom) ...
{ "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.75189173", "0.75186044", "0.75186044", "0.75186044", "0.75186044", "0.7513986", "0.74924827", "0.74924827", "0.74924827", "0.74924827", "0.7467988", "0.7455654", "0.74446476", "0.74446476", "0.74435604", "0.74435604", "0.74435604", "0.74435604", "0.74435604", "0.74435604", ...
0.7454901
12
Finds the line to start with when starting a parse. Tries to find a line with a stateAfter, so that it can start with a valid state. If that fails, it returns the line with the smallest indentation, which tends to need the least context to parse correctly.
function findStartLine(cm, n, precise) { var minindent, minline, doc = cm.doc; var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100); for (var search = n; search > lim; --search) { if (search <= doc.first) return doc.first; var line = getLine(doc, search - 1); if (line.st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findStartLine(n) {\n var minindent, minline;\n for (var search = n, lim = n - 40; search > lim; --search) {\n if (search == 0) return 0;\n var line = lines[search-1];\n if (line.stateAfter) return search;\n var indented = line.indentation();\n if (minline == nu...
[ "0.6962411", "0.6955082", "0.6955082", "0.69002736", "0.6820576", "0.6820576", "0.6820576", "0.6815363", "0.6718006", "0.6714978", "0.6714978", "0.6714978", "0.6714978", "0.6714978", "0.6714978", "0.6714978", "0.6714978", "0.6714978", "0.6714978", "0.6714978", "0.6714978", ...
0.6334255
57
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 && cm.display.scroller.clientWidth; if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) { var heights = lineView.measure.heights = []; if (wrapping) ...
{ "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.7544686", "0.7544686", "0.7544686", "0.7544686", "0.73758477", "0.73758477", "0.73758477", "0.73758477", "0.73758477", "0.73758477", "0.73758477", "0.73758477", "0.73758477", "0.73758477", "0.73758477", "0.73758477", "0.73758477", "0.73758477", "0.73758477", "0.73758477", ...
0.7497
4
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.cac...
{ "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.75460523", "0.7488654", "0.74369943", "0.74369943", "0.74369943", "0.74369943", "0.74369943", "0.74369943", "0.74369943", "0.74369943", "0.74369943", "0.74369943", "0.74369943", "0.74369943", "0.74369943", "0.74369943", "0.74369943", "0.7417173", "0.7417173", "0.74095714", ...
0.7348773
46
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; removeChildrenA...
{ "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.7484259", "0.7475978", "0.7475978", "0.7475978", "0.7475978", "0.7475978", "0.7475978", "0.7475978", "0.7475978", "0.7475978", "0.7475978", "0.7475978", "0.7475978", "0.7475978", "0.7475978", "0.7475978", "0.7475978", "0.7475978", "0.74745804", "0.74694103", "...
0.7487335
1
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 }", "funct...
[ "0.7498672", "0.7498672", "0.7498672", "0.7498672", "0.7498672", "0.7498672", "0.7498672", "0.7498672", "0.7498672", "0.7498672", "0.7498672", "0.7498672", "0.7498672", "0.7498672", "0.7498672", "0.7498672", "0.7498672", "0.7490927", "0.7490927", "0.7490927", "0.7490927", "...
0.7378883
45
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)); if (!view) view = updateExternalMeasurem...
{ "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.61011076", "0.60801214", "0.6048344", "0.5924275", "0.59188163", "0.59188163", "0.590181", "0.590181", "0.590181", "0.590181", "0.590181", "0.590181", "0.590181", "0.590181", "0.590181", "0.590181", "0.590181", "0.590181", "0.590181", "0.590181", "0.590181", "0.590181", ...
0.5844106
38
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.getBoundin...
{ "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.6956743", "0.6956743", "0.6956743", "0.6956743", "0.6956743", "0.6956743", "0.6956743", "0.6956743", "0.6948188", "0.6948188", "0.6948188", "0.6948188", "0.6948188", "0.6948188", "0.6948188", "0.6948188", "0.6948188", "0.6948188", "0.6948188", "0.6948188", "0.6948188", "...
0.69280237
27
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.device...
{ "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" || !contex...
{ "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.65310293", "0.65310293", "0.65310293", "0.65310293", "0.6393128", "0.63907343", "0.6347056", "0.6333921", "0.6333921", "0.6333921", "0.6333921", "0.6333921", "0.6333921", "0.6333921", "0.6333921", "0.6323886", "0.6311887", "0.6311887", "0.63112855", "0.63112855", "0.630852...
0.633435
7
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.
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 cursor_box_size() { return { x: 10, y: 10 }; }", "function getBox(o) {\n return {\n xMin: o.position.x,\n xMax: o.position.x + o.width,\n yMin: o.position.y,\n yMax: o.position.y + o.height\n };\n }", "function getBox(o) {\n return {\n xMin: o.position.x,\n ...
[ "0.61951715", "0.56517017", "0.5637188", "0.55549294", "0.5481452", "0.5451724", "0.51886904", "0.51287645", "0.51277184", "0.51277184", "0.51277184", "0.51277184", "0.51277184", "0.51277184", "0.51277184", "0.51277184", "0.51277184", "0.51277184", "0.51277184", "0.51277184", ...
0.49929026
54
Used to cheaply estimate the coordinates for a position. Used for intermediate scroll updates.
function estimateCoords(cm, pos) { var left = 0, pos = clipPos(cm.doc, pos); if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch; var lineObj = getLine(cm.doc, pos.line); var top = heightAtLine(lineObj) + paddingTop(cm.display); return {left: left, right: left, top: top, bottom:...
{ "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.6922836", "0.6853012", "0.6800622", "0.67038745", "0.67038745", "0.67038745", "0.6692944", "0.66866237", "0.6674445", "0.6644042", "0.66426384", "0.6631865", "0.6619488", "0.6619488", "0.6619488", "0.6619488", "0.6619488", "0.6619488", "0.6619488", "0.6619488", "0.66040397...
0.66073644
20
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, outside, xRel) { var pos = Pos(line, ch); pos.xRel = xRel; if (outside) pos.outside = true; return pos; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function PosWithInfo(line, ch, sticky, outside, xRel) {\n var pos = Pos(line, ch, sticky);\n pos.xRel = xRel;\n\n if (outside) {\n pos.outside = outside;\n }\n\n return pos;\n } // Compute the character position closest to the given coordinates.", "function coordsChar(cm, x, y) {\n var do...
[ "0.6488047", "0.63717175", "0.63717175", "0.63717175", "0.63369083", "0.6326008", "0.6326008", "0.6326008", "0.6326008", "0.6326008", "0.6326008", "0.6326008", "0.6326008", "0.6310346", "0.6300315", "0.6300315", "0.6300315", "0.6300315", "0.62870514", "0.62870514", "0.6287051...
0.6315894
13
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, true, -1); var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1; if (lineN > last) return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.l...
{ "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.7138738", "0.626187", "0.626187", "0.626187", "0.626187", "0.6206231", "0.6206231", "0.6206231", "0.6206231", "0.6206231", "0.6206231", "0.6206231", "0.6206231", "0.6192183", "0.6177129", "0.6174354", "0.61715925", "0.61715925", "0.6164382", "0.6132255", "0.6120749", "0....
0.6153348
19
Compute the default text height.
function textHeight(display) { if (display.cachedTextHeight != null) return display.cachedTextHeight; if (measureText == null) { measureText = elt("pre"); // Measure a bunch of lines, for browsers that compute // fractional heights. for (var i = 0; i < 49; ++i) { measureTe...
{ "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.7177637", "0.69138646", "0.6897135", "0.6894641", "0.6894641", "0.6894641", "0.6894641", "0.6894641", "0.6894641", "0.6894641", "0.6894641", "0.6894641", "0.6894641", "0.6894641", "0.6894641", "0.68879944", "0.68811613", "0.6807327", "0.6807327", "0.6807327", "0.6807327", ...
0.67182964
32
Compute the default character width.
function charWidth(display) { if (display.cachedCharWidth != null) return display.cachedCharWidth; var anchor = elt("span", "xxxxxxxxxx"); var pre = elt("pre", [anchor]); removeChildrenAndAdd(display.measure, pre); var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get defaultCharacterWidth() { return this.viewState.heightOracle.charWidth; }", "function charWidth(display) {\n\t\t if (display.cachedCharWidth != null) return display.cachedCharWidth;\n\t\t var anchor = elt(\"span\", \"xxxxxxxxxx\");\n\t\t var pre = elt(\"pre\", [anchor]);\n\t\t removeChildrenAndAd...
[ "0.7920131", "0.7037969", "0.7021818", "0.7021073", "0.7021073", "0.7021073", "0.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.6948909", "0.6948909"...
0.6951675
19
Start a new operation.
function startOperation(cm) { cm.curOp = { cm: cm, viewChanged: false, // Flag that indicates that lines might need to be redrawn startHeight: cm.doc.height, // Used to detect need to update scrollbar forceUpdate: false, // Used to force a redraw updateInput: null, ...
{ "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.57061714", "0.5692559", "0.5688068", "0.5688068", "0.5688068", "0.5681768", "0.5661453", "0.5646481", "0.5626896", "0.5626896", "0.5626896", "0.5626896", "0.5626896", "0.5621532", "0.5621532"...
0.57273746
6
Finish an operation, updating the display and signalling delayed events
function endOperation(cm) { var op = cm.curOp, group = op.ownsGroup; if (!group) return; try { fireCallbacksForOps(group); } finally { operationGroup = null; for (var i = 0; i < group.ops.length; i++) group.ops[i].cm.curOp = null; endOperations(group); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "finishProcessing() {\n this.busy = false;\n this.successful = true;\n }", "function handleFinish(values) {\n job.current = getJob(values, job.current, writeMessage);\n setBusy(job.current.pendingTime);\n }", "finish() {\n window.setTimeout(\n this.displayAbsorptionTexts.bind(thi...
[ "0.6298353", "0.6149194", "0.6141501", "0.61294717", "0.61197203", "0.6094414", "0.60886836", "0.6063711", "0.60263014", "0.602398", "0.60091406", "0.6005056", "0.59634334", "0.59634334", "0.59634334", "0.59634334", "0.5962261", "0.59593785", "0.5950094", "0.5950094", "0.5931...
0.0
-1
The DOM updates done when an operation finishes are batched so that the minimum number of relayouts are required.
function endOperations(group) { var ops = group.ops; for (var i = 0; i < ops.length; i++) // Read DOM endOperation_R1(ops[i]); for (var i = 0; i < ops.length; i++) // Write DOM (maybe) endOperation_W1(ops[i]); for (var i = 0; i < ops.length; i++) // Read DOM endOperation_R2(ops[...
{ "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.65620655", "0.6510543", "0.6510543", "0.6510543", "0.6510543", "0.6510543", "0.64983904", "0.64983904", "0.64983904", "0.64983904", "0.64983904", "0.64983904", "0.64983904", "0.64983904", "0.64983904", "0.64983904", "0.64983904", "0.64983904", "0.64983904", "0.64983904", "...
0.5745588
87
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.72196746", "0.72107506", "0.72107506", "0.72107506", "0.719325", "0.7188428", "0.7068937", "0.70685226", "0.70685226", "0.70685226", "0.70382166", "0.70382166", "0.70382166", "0.70382166", "0.70382166", "0.70382166", "0.70382166", "0.70382166", "0.70382166", "0.70382166", ...
0.7011758
35
Wraps a function in an operation. Returns the wrapped function.
function operation(cm, f) { return function() { if (cm.curOp) return f.apply(cm, arguments); startOperation(cm); try { return f.apply(cm, arguments); } finally { endOperation(cm); } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "functio...
[ "0.6697844", "0.6697844", "0.6697844", "0.6697844", "0.6697844", "0.6697844", "0.6697844", "0.6697844", "0.6697844", "0.66415626", "0.6519331", "0.64675987", "0.64675987", "0.64675987", "0.64675987", "0.64675987", "0.64675987", "0.64675987", "0.64675987", "0.64675987", "0.646...
0.0
-1
Used to add methods to editor and doc instances, wrapping them in operations.
function methodOp(f) { return function() { if (this.curOp) return f.apply(this, arguments); startOperation(this); try { return f.apply(this, arguments); } finally { endOperation(this); } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addEditorMethods(CodeMirror) {\n\t\t var optionHandlers = CodeMirror.optionHandlers;\n\n\t\t var helpers = CodeMirror.helpers = {};\n\n\t\t CodeMirror.prototype = {\n\t\t constructor: CodeMirror,\n\t\t focus: function(){win(this).focus(); this.display.input.focus();},\n\n\t\t setOp...
[ "0.6234695", "0.61433893", "0.61433893", "0.611974", "0.611974", "0.611974", "0.611974", "0.611974", "0.611974", "0.611974", "0.611974", "0.611974", "0.61185527", "0.61185527", "0.61185527", "0.61185527", "0.61185527", "0.61185527", "0.6086015", "0.6070089", "0.6070089", "0...
0.0
-1
VIEW TRACKING 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; ...
{ "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.7227958", "0.6997179", "0.6997179", "0.69601446", "0.69601446", "0.69601446", "0.69601446", "0.69601446", "0.69601446", "0.69601446", "0.69601446", "0.69601446", "0.69601446", "0.69601446", "0.6944605", "0.6944605", "0.6944605", "0.6944605", "0.6944605", "0.6944605", "0.69...
0.68997264
40
Create a range of LineView objects for the given lines.
function buildViewArray(cm, from, to) { var array = [], nextPos; for (var pos = from; pos < to; pos = nextPos) { var view = new LineView(cm.doc, getLine(cm.doc, pos), pos); nextPos = pos + view.size; array.push(view); } return array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line; // Continuing lines, if any\n\n this.rest = visualLineContinued(line); // Number of logical lines in this visual line\n\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n...
[ "0.7717119", "0.6600235", "0.6600235", "0.6600235", "0.6600235", "0.6600235", "0.6600235", "0.6600235", "0.6600235", "0.6588617", "0.6588617", "0.6588617", "0.6588617", "0.6588617", "0.6588617", "0.6588617", "0.6588617", "0.6588617", "0.6588617", "0.6588617", "0.6588617", "...
0.6575102
28
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.updateLineNumbe...
{ "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.7041117", "0.70191276", "0.7001752", "0.7001752", "0.6953793", "0.6953793", "0.6953793", "0.6953793", "0.6953793", "0.6953793", "0.6953793", "0.6953793", "0.6953793", "0.6953793", "0.6953793", "0.6953793", "0.6953793", "0.6953793", "0.6953793", "0.6953793", "0.6953793", ...
0.6969179
4
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.75807256", "0.71199244", "0.71199244", "0.7101364", "0.7101364", "0.7101364", "0.7101364", "0.7101364", "0.7101364", "0.7101364", "0.7101364", "0.7101364", "0.7101364", "0.7101364", "0.70958996", "0.70958996", "0.70958996", "0.70958996", "0.70958996", "0.70958996", "0.7095...
0.7067052
40
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.7009115", "0.7009115", "0.7009115", "0.7009115", "0.7009115", "0.7009115", "0.7009115", "0.7009115", "0.7009115", "0.7009115", "0.7009115", "0.7009115", "0.7009115", "0.7009115", "0.7009115", "0.7009115", "0.7009115", "0.6991372", "0.6991372", "0.6991372", "0.6991372", "...
0.0
-1
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....
{ "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.0
-1
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.64771295", "0.6393244", "0.6393244", "0.6393244", "0.6393244", "0.6393244", "0.6393244", "0.6393244", "0.6393244", "0.6393244", "0.6393244", "0.6393244", "0.6393244", "0.6393244", "0.6393244", "0.6393244", "0.6393244", "0.6393244", "0.6392505", "0.6392505", "0.6392505", ...
0.6377945
26
INPUT HANDLING Poll for input changes, using the normal rate of polling. This runs as long as the editor is focused.
function slowPoll(cm) { if (cm.display.pollingFast) return; cm.display.poll.set(cm.options.pollInterval, function() { readInput(cm); if (cm.state.focused) slowPoll(cm); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "pollInput() {\n this.Mouse.poll();\n this.Keyboard.poll();\n }", "internalOnInput(event) {\n const me = this; // Keep the value synced with the inputValue at all times.\n\n me.inputting = true;\n me.value = me.input.value;\n me.inputting = false;\n me.trigger('input', {\n value: me.val...
[ "0.66223204", "0.66153526", "0.65691286", "0.65496546", "0.6438963", "0.64073694", "0.6386468", "0.630443", "0.62575155", "0.6193845", "0.6191011", "0.6055958", "0.6055958", "0.6055958", "0.6055958", "0.6055958", "0.6055958", "0.6052023", "0.6042059", "0.6042058", "0.6020005"...
0.60592455
11
When an event has just come in that is likely to add or change something in the input textarea, we poll faster, to ensure that the change appears on the screen quickly.
function fastPoll(cm) { var missed = false; cm.display.pollingFast = true; function p() { var changed = readInput(cm); if (!changed && !missed) {missed = true; cm.display.poll.set(60, p);} else {cm.display.pollingFast = false; slowPoll(cm);} } cm.display.poll.set(20, p); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function slowPoll(cm) {\r\n if (cm.display.pollingFast) return;\r\n cm.display.poll.set(cm.options.pollInterval, function() {\r\n readInput(cm);\r\n if (cm.state.focused) slowPoll(cm);\r\n });\r\n }", "function fastPoll(cm) {\n var missed = false;\n cm.display.pollingFast = true;\n f...
[ "0.66384095", "0.66259307", "0.66259307", "0.66259307", "0.66259307", "0.66259307", "0.66259307", "0.661385", "0.661385", "0.661385", "0.661385", "0.661385", "0.661385", "0.65797645", "0.6477442", "0.6477442", "0.6477442", "0.63370305", "0.62778944", "0.62778944", "0.62778944...
0.6627468
1
Read input from the textarea, and update the document to match. When something is selected, it is present in the textarea, and selected (unless it is huge, in which case a placeholder is used). When nothing is selected, the cursor sits after previously seen text (can be empty), which is stored in prevInput (we must not...
function readInput(cm) { var input = cm.display.input, prevInput = cm.display.prevInput, doc = cm.doc; // Since this is called a *lot*, try to bail out as cheaply as // possible when it is clear that nothing happened. hasSelection // will be the case when there is a lot of text in the textarea, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function readInput() {\n if (leaveInputAlone || !focused) return;\n var changed = false, text = input.value, sr = selRange(input);\n if (!sr) return false;\n var changed = editing.text != text, rs = reducedSelection;\n var moved = changed || sr.start != editing.start || sr.end != (rs ? edi...
[ "0.6916783", "0.6916783", "0.6916783", "0.6318288", "0.6169842", "0.6169842", "0.6166273", "0.6166273", "0.6166273", "0.60491717", "0.60491717", "0.60491717", "0.60276484", "0.60057247", "0.60057247", "0.5980917", "0.5718081", "0.5718081", "0.5718081", "0.5718081", "0.5671565...
0.6072766
9
Reset the input to correspond to the selection (or to be empty, when not typing and nothing is selected)
function resetInput(cm, typing) { var minimal, selected, doc = cm.doc; if (cm.somethingSelected()) { cm.display.prevInput = ""; var range = doc.sel.primary(); minimal = hasCopyEvent && (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetInput(cm, typing) {\n var minimal, selected, doc = cm.doc;\n if (cm.somethingSelected()) {\n cm.display.prevInput = \"\";\n var range = doc.sel.primary();\n minimal = hasCopyEvent &&\n (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 10...
[ "0.8101943", "0.8101943", "0.8101943", "0.8101943", "0.7824159", "0.7824159", "0.74899524", "0.74849355", "0.7368271", "0.71624076", "0.71624076", "0.71624076", "0.71624076", "0.7149499", "0.7149499", "0.7133767", "0.7074472", "0.7054121", "0.7049481", "0.7049481", "0.7013619...
0.80305445
4
EVENT HANDLERS Attach the necessary event handlers when initializing the editor
function registerEventHandlers(cm) { var d = cm.display; on(d.scroller, "mousedown", operation(cm, onMouseDown)); // Older IE's will not fire a second mousedown for a double click if (ie && ie_version < 11) on(d.scroller, "dblclick", operation(cm, function(e) { if (signalDOMEvent(cm,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n\n\t\t// Bind the editor elements to variables\n\t\tbindElements();\n\n\t\t// Create event listeners for keyup, mouseup, etc.\n\t\tcreateEventBindings();\n\t}", "initEventListners() {\n this.engine.getSession().selection.on('changeCursor', () => this.updateCursorLabels());\n\n th...
[ "0.75899404", "0.7451777", "0.715617", "0.7042855", "0.7040459", "0.7005983", "0.6992898", "0.6976246", "0.69648314", "0.69638443", "0.6944345", "0.6893292", "0.68734", "0.6776197", "0.67756134", "0.67407024", "0.67152727", "0.6639332", "0.65564615", "0.6555081", "0.6547914",...
0.0
-1
Prevent clicks in the scrollbars from killing focus
function reFocus() { if (cm.state.focused) setTimeout(bind(focusInput, cm), 0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function disableMiddleBtnScroll()\n{\n document.addEventListener(\"mousedown\", function(e){\n if(e.button==1)\n {\n e.preventDefault(); \n return false\n }\n });\n}", "_preventUserScrollForDefaultBehavior() {\n return;\n }", "function preventScrollEvents(e){\n e.stopPropagatio...
[ "0.72163326", "0.70704013", "0.7011935", "0.7011935", "0.69783056", "0.6931328", "0.6713907", "0.66733676", "0.6662504", "0.6662504", "0.6634197", "0.6634197", "0.6634197", "0.6634197", "0.66214454", "0.6586554", "0.65724975", "0.65635526", "0.65566754", "0.65494287", "0.6544...
0.0
-1
Called when the window resizes
function onResize(cm) { // Might be a text scaling operation, clear size caches. var d = cm.display; d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; cm.setSize(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onWindowResize() {\n updateSizes();\n }", "function windowResized() {\n resize();\n redraw();\n}", "onWindowResize() {\n\t\tthis.windowHeight = this.getWindowHeight();\n\t\tthis.updatePosition();\n\t}", "function onWindowResize() {\n\n\t\t\t}", "function windowResized() {\n resizeCanvas...
[ "0.87504816", "0.8489634", "0.84696436", "0.8312124", "0.7998738", "0.79904795", "0.7962713", "0.7941597", "0.79165184", "0.79024243", "0.7881844", "0.7881551", "0.78685206", "0.78685206", "0.7828244", "0.78222525", "0.78173137", "0.7804665", "0.7797177", "0.778925", "0.77879...
0.0
-1
MOUSE EVENTS 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.ignoreEvents || n.parentNode == display.sizer && n != display.mover) return true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleMouseDown(xpos, ypos, state, evnt, widgets) {\n\tfor(var i = 0; i < widgets.length; i++) {\n\t\tvar widg = widgets[i];\n\t\tif(xpos > widg.x - widg.width/2 && xpos < widg.x + widg.width/2 && ypos > widg.y - widg.height/2 && ypos < widg.y + widg.height/2) {\n\t\t\tisWidgetLocked = true;\n\t\t\tlocked...
[ "0.69559646", "0.6932037", "0.6662541", "0.66276175", "0.65991014", "0.65874517", "0.65803057", "0.6566328", "0.65234137", "0.6465692", "0.6464835", "0.64126956", "0.6410146", "0.6397285", "0.6397285", "0.63822424", "0.6356875", "0.6343323", "0.6343323", "0.6343323", "0.63433...
0.6262401
42
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) { var target = e_target(e); if (target == display.scrollbarH || target == display.scrollbarV || target == display.scrollbarFiller || target == display.gutterFiller) return null; } var x,...
{ "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.7708518", "0.7708518", "0.7708518", "0.7708518", "0.7514741", "0.7514741", "0.74732226", "0.74732226", "0.74575555", "0.74575555", "0.7456957", "0.7456957", "0.7456957", "0.7456957", "0.7456957", "0.7456957", "0.7456957", "0.7456957", "0.74547905", "0.74547905", "0.7454790...
0.76387554
4
A mouse down can be a single click, double click, triple click, start of selection drag, start of text drag, new cursor (ctrlclick), rectangle drag (altdrag), or xwin middleclickpaste. Or it might be a click on something we should not interfere with, such as a scrollbar or widget.
function onMouseDown(e) { if (signalDOMEvent(this, e)) return; var cm = this, display = cm.display; display.shift = e.shiftKey; if (eventInWidget(display, e)) { if (!webkit) { // Briefly turn off draggability, to allow widgets to do // normal dragging things. disp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefl...
[ "0.70923996", "0.70923996", "0.7091965", "0.7091965", "0.7091965", "0.7091965", "0.7091965", "0.7091965", "0.7091965", "0.7091965", "0.7091965", "0.70916486", "0.70872766", "0.7082329", "0.70563495", "0.7055906", "0.7055906", "0.7039263", "0.70240754", "0.70240754", "0.702407...
0.68553513
57
Start a text drag. When it ends, see if any dragging actually happen, and treat as a click if it didn't.
function leftButtonStartDrag(cm, e, start, modifier) { var display = cm.display; var dragEnd = operation(cm, function(e2) { if (webkit) display.scroller.draggable = false; cm.state.draggingText = false; off(document, "mouseup", dragEnd); off(display.scroller, "drop", dragEnd); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startDragText(evt)\r\n{\r\n\r\n if(ActiveElem&&!DraggingObj) //---prevents dragging conflicts on other draggable elements---\r\n {\r\n if(evt.target.parentNode.getAttribute(\"id\")==\"activeText\")\r\n {\r\n if(evt.target.parentNode.parentNode.getAttribute(\"class\")==\"drag...
[ "0.66870064", "0.64880925", "0.64526504", "0.643963", "0.63796633", "0.6295826", "0.62258095", "0.6052833", "0.6033996", "0.6015346", "0.60106355", "0.60037816", "0.59898204", "0.5974962", "0.5962932", "0.5919407", "0.5909692", "0.58979154", "0.58868265", "0.5882919", "0.5857...
0.0
-1
Normal selection, as opposed to text dragging.
function leftButtonSelect(cm, e, start, type, addNew) { var display = cm.display, doc = cm.doc; e_preventDefault(e); var ourRange, ourIndex, startSel = doc.sel; if (addNew && !e.shiftKey) { ourIndex = doc.sel.contains(start); if (ourIndex > -1) ourRange = doc.sel.ranges[ourI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "unselectText_() {\n try {\n this.win.getSelection().removeAllRanges();\n } catch (e) {\n // Selection API not supported.\n }\n }", "clearSelection() {\n this._clearSelection();\n }", "cut() {\n if (this.owner.isReadOnlyMode || this.selection.isEmpty) {\n return;\...
[ "0.74885833", "0.7268716", "0.7257491", "0.72482944", "0.72482944", "0.72482944", "0.7164153", "0.7164153", "0.71332663", "0.7116289", "0.7114912", "0.7097566", "0.7063641", "0.704988", "0.70417166", "0.70114183", "0.7003303", "0.69794875", "0.6955937", "0.6951775", "0.693761...
0.0
-1
Determines whether an event happened in the gutter, and fires the handlers for the corresponding event.
function gutterEvent(cm, e, type, prevent, signalfn) { try { var mX = e.clientX, mY = e.clientY; } catch(e) { return false; } if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false; if (prevent) e_preventDefault(e); var display = cm.display; var lineBox = di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gutterEvent(cm, e, type, prevent, signalfn) {\n try { var mX = e.clientX, mY = e.clientY; }\n catch(e) { return false; }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n if (prevent) e_preventDefault(e);\n\n var display = cm.display;\n var lineBox...
[ "0.64240617", "0.64240617", "0.64240617", "0.64240617", "0.64240617", "0.64240617", "0.64240617", "0.63816375", "0.6362373", "0.6352625", "0.63408446", "0.63368946", "0.63368946", "0.63368946", "0.63368946", "0.63368946", "0.63368946", "0.63254106", "0.63254106", "0.63254106", ...
0.64164716
7
SCROLL EVENTS Sync the scrollable area and scrollbars, ensure the viewport covers the visible area.
function setScrollTop(cm, val) { if (Math.abs(cm.doc.scrollTop - val) < 2) return; cm.doc.scrollTop = val; if (!gecko) updateDisplaySimple(cm, {top: val}); if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val; if (cm.display.scrollbarV.scrollTop != val) cm.display.scrol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mkdOnWindowScroll() {\n \n }", "scrollChanged(indices) {\n this.internalControlEventOccurred('ArrayScrolledEvent', indices);\n }", "function Simulator_OnScroll()\n{\n\t//has simulator?\n\tif (__SIMULATOR)\n\t{\n\t\t//has controller?\n\t\tif (__CONTROLLER)\n\t\t{\n\t\t\t//no...
[ "0.6627659", "0.6600968", "0.6538907", "0.6503334", "0.64662033", "0.6455364", "0.6419602", "0.6419602", "0.6419602", "0.6419602", "0.6393245", "0.63877255", "0.638458", "0.63838536", "0.6375988", "0.6371613", "0.6371613", "0.6356219", "0.6298325", "0.6290961", "0.628675", ...
0.0
-1
Sync scroller and scrollbar, ensure the gutter elements are aligned.
function setScrollLeft(cm, val, isScroller) { if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) return; val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth); cm.doc.scrollLeft = val; alignHorizontally(cm); if (cm.display.scrolle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px...
[ "0.7326835", "0.7249031", "0.7249031", "0.7249031", "0.64672166", "0.64672166", "0.64672166", "0.64092076", "0.63350016", "0.63350016", "0.63350016", "0.63350016", "0.63306326", "0.63306326", "0.63306326", "0.63306326", "0.63306326", "0.63306326", "0.63306326", "0.63306326", ...
0.0
-1
KEY EVENTS Run a handler that was bound to a key.
function doHandleBinding(cm, bound, dropShift) { if (typeof bound == "string") { bound = commands[bound]; if (!bound) return false; } // Ensure previous input has been read, so that the handler sees a // consistent view of the document if (cm.display.pollingFast && readInput(cm)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function receive(key, handler) {\n pxsim.board().bus.listen(key, 0x1, handler);\n }", "function listen(key, callback) {\n handlers[key] = callback;\n}", "function keyPressed() {\n if (handler.active === handler.nameplate) {\n doorbell.keyPressed();\n }\n}", "static eventCallback(ful...
[ "0.6941176", "0.6512591", "0.6502818", "0.6433134", "0.6433134", "0.6433134", "0.6433134", "0.6433134", "0.6398334", "0.6292813", "0.62025106", "0.61664945", "0.6148886", "0.60888934", "0.6086359", "0.6081665", "0.607988", "0.6079462", "0.6077048", "0.6070363", "0.60488915", ...
0.0
-1
Collect the currently active keymaps.
function allKeyMaps(cm) { var maps = cm.state.keyMaps.slice(0); if (cm.options.extraKeys) maps.push(cm.options.extraKeys); maps.push(cm.options.keyMap); return maps; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function allKeyMaps(cm) {\n var maps = cm.state.keyMaps.slice(0);\n if (cm.options.extraKeys) maps.push(cm.options.extraKeys);\n maps.push(cm.options.keyMap);\n return maps;\n }", "function allKeyMaps(cm) {\n var maps = cm.state.keyMaps.slice(0);\n if (cm.options.extraKeys) maps.push(cm.option...
[ "0.6481273", "0.6481273", "0.6481273", "0.5782414", "0.5754308", "0.5750213", "0.5676832", "0.5676832", "0.5676832", "0.5676832", "0.5676832", "0.52943546", "0.52911264", "0.52725035", "0.5158715", "0.5131795", "0.51256", "0.512041", "0.5100498", "0.5100498", "0.5100498", "...
0.64718777
3
Handle a key from the keydown event.
function handleKeyBinding(cm, e) { // Handle automatic keymap transitions var startMap = getKeyMap(cm.options.keyMap), next = startMap.auto; clearTimeout(maybeTransition); if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() { if (getKeyMap(cm.options.keyMap) == startMap) { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "HandleKeyDown(event) {}", "function keydown_handler(event)\n{\n\tif (event.defaultPrevented) return;\n\tif (game.handle_key(event.code, true)) return;\n\n\t// cancel the default action to avoid it being handled twice\n\tevent.preventDefault();\n}", "function keyDownHandler(event) {\n keyHandler(true, event)...
[ "0.7754498", "0.7530854", "0.725298", "0.71965206", "0.7193362", "0.71909934", "0.71838784", "0.7157211", "0.71227103", "0.7111613", "0.7088491", "0.705151", "0.70506364", "0.70471364", "0.70471364", "0.7042559", "0.70307916", "0.70020014", "0.69745636", "0.6955427", "0.69540...
0.0
-1
Handle a key from the keypress event
function handleCharBinding(cm, e, ch) { var handled = lookupKey("'" + ch + "'", allKeyMaps(cm), function(b) { return doHandleBinding(cm, b, true); }); if (handled) { e_preventDefault(e); restartBlink(cm); signalLater(cm, "keyHandled", cm, "'" + ch + "'", e); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "HandleKeyDown(event) {}", "function handleKeyPress({ key }) {\n dispatch(playerTyped(key.toLowerCase()));\n }", "handleInput(keycode) {\n if (keycode !== undefined && player.moves === true) {\n key = keycode;\n }\n }", "handleKeyPress(kEvent) {\n switch (kEvent.keyCod...
[ "0.7767834", "0.765871", "0.758574", "0.74911857", "0.741585", "0.7402115", "0.7374124", "0.737354", "0.73173136", "0.72986954", "0.7289434", "0.7274268", "0.7264864", "0.72491187", "0.72488683", "0.7228675", "0.7217789", "0.7216279", "0.7157265", "0.71438694", "0.71438676", ...
0.0
-1
CONTEXT MENU HANDLING To make the context menu work, we need to briefly unhide the textarea (making it as unobtrusive as possible) to let the rightclick take effect on it.
function onContextMenu(cm, e) { if (signalDOMEvent(cm, e, "contextmenu")) return; var display = cm.display; if (eventInWidget(display, e) || contextMenuInGutter(cm, e)) return; var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop; if (!pos || presto) return; // Opera is diffi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rightClickHandler(ev, textarea, screenElement, selectionService, shouldSelectWord) {\n moveTextAreaUnderMouseCursor(ev, textarea, screenElement);\n if (shouldSelectWord) {\n selectionService.rightClickSelect(ev);\n }\n // Get textarea ready to copy from the context menu\n textarea.va...
[ "0.68549496", "0.66134685", "0.66105276", "0.65586615", "0.65378284", "0.65269154", "0.6480186", "0.64347166", "0.635688", "0.6342562", "0.63181025", "0.63181025", "0.63043785", "0.6293949", "0.6293949", "0.62910026", "0.6225243", "0.6213995", "0.62080663", "0.6180426", "0.61...
0.5895472
41
Selectall will be greyed out if there's nothing to select, so this adds a zerowidth space so that we can later check whether it got selected.
function prepareSelectAllHack() { if (display.input.selectionStart != null) { var selected = cm.somethingSelected(); var extval = display.input.value = "\u200b" + (selected ? display.input.value : ""); display.prevInput = selected ? "" : "\u200b"; display.input.selectionStart ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectAll()\r\n\t\t{\r\n\t\t\tthis.focus();\r\n\t\t\tthis.select();\r\n\t\t}", "function show_select_all(){\r\n var th = getPatternResult(PATTERN['select_all']).snapshotItem(0);\r\n if (th == null) \r\n return;\r\n th.innerHTML = '<input type=\"checkbox\"/>';\r\n th.setAttribute('titl...
[ "0.79616094", "0.68496317", "0.6849021", "0.6849021", "0.6849021", "0.6849021", "0.6849021", "0.67935604", "0.6774863", "0.6762403", "0.6762403", "0.6762403", "0.67509896", "0.67509896", "0.674237", "0.674237", "0.67349464", "0.67318714", "0.67183095", "0.67183095", "0.671830...
0.6836254
7
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 - c...
{ "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.7519226", "0.7518439", "0.7451729", "0.7451729", "0.74473965", "0.7446557", "0.74229974", "0.74229974", "0.74229974", "0.74229974", "0.74229974", "0.74229974", "0.74229974", "0.7420914", "0.7420914", "0.7420914", "0.7420914", "0.7420914", "0.7420914", "0.7420914", "0.74209...
0.7477772
2
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, ...
{ "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.66459006", "0.6271295", "0.61861014", "0.61493886", "0.6106035", "0.6076117", "0.60731566", "0.60044765", "0.60039896", "0.59836966", "0.59836966", "0.59836966", "0.5970549", "0.5949476", "0.5948122", "0.5948122", "0.5948122", "0.59362864", "0.58872396", "0.58431464", "0.5...
0.5642735
70
Allow "beforeChange" event handlers to influence a change
function filterChange(doc, change, update) { var obj = { canceled: false, from: change.from, to: change.to, text: change.text, origin: change.origin, cancel: function() { this.canceled = true; } }; if (update) obj.update = function(from, to, text, origin) { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_beforeChange () {\n // nop\n }", "_beforeChange () {\n // nop\n }", "afterValidChange() { }", "change() { }", "internalOnChange(event) {\n const me = this,\n value = me.value,\n oldValue = me._lastValue;\n\n // Don't trigger change if we enter invalid value or if value has not chan...
[ "0.81645423", "0.81645423", "0.71159774", "0.70279074", "0.7022524", "0.68986124", "0.6856265", "0.6830239", "0.6816121", "0.6798605", "0.67954934", "0.67927516", "0.67825234", "0.67575413", "0.6720733", "0.6697086", "0.66936785", "0.6654987", "0.66254723", "0.6593608", "0.65...
0.0
-1
Apply a change to a document, and add it to the document's history, and propagating it to all linked documents.
function makeChange(doc, change, ignoreReadOnly) { if (doc.cm) { if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly); if (doc.cm.state.suppressEdits) return; } if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "apply(doc) {\n if (this.length != doc.length)\n throw new RangeError(\"Applying change set to a document with the wrong length\");\n iterChanges(this, (fromA, toA, fromB, _toB, text) => doc = doc.replace(fromB, fromB + (toA - fromA), text), false);\n return doc;\n }", "function...
[ "0.6361561", "0.62873036", "0.62873036", "0.62873036", "0.62873036", "0.62873036", "0.62873036", "0.62873036", "0.62873036", "0.62873036", "0.62873036", "0.62873036", "0.6285451", "0.6272269", "0.6272269", "0.6272269", "0.6272269", "0.6272269", "0.6272269", "0.6272269", "0.62...
0.0
-1
Revert a change stored in a document's history.
function makeChangeFromHistory(doc, type, allowSelectionOnly) { if (doc.cm && doc.cm.state.suppressEdits) return; var hist = doc.history, event, selAfter = doc.sel; var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done; // Verify that there is a u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function undo() {\n var doc = app.activeDocument;\n var states = doc.historyStates;\n \n var curr = 0;\n for (var i=0; i<states.length; i++) {\n if (states[i] == doc.activeHistoryState) {\n curr = i;\n }\n }\n \n var prev ...
[ "0.66696423", "0.6660121", "0.6657044", "0.64068717", "0.6341633", "0.6332736", "0.6280933", "0.62805986", "0.62805986", "0.62659883", "0.620718", "0.61387384", "0.61312824", "0.61018074", "0.61000323", "0.6094208", "0.6079001", "0.5996461", "0.597296", "0.59380674", "0.59320...
0.0
-1
Subviews need their line numbers shifted when text is added above or below them in the parent document.
function shiftDoc(doc, distance) { if (distance == 0) return; doc.first += distance; doc.sel = new Selection(map(doc.sel.ranges, function(range) { return new Range(Pos(range.anchor.line + distance, range.anchor.ch), Pos(range.head.line + distance, range.head.ch)); }), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bn(e,t,a,n){null==t&&(t=e.doc.first),null==a&&(a=e.doc.first+e.doc.size),n||(n=0);var r=e.display;if(n&&a<r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>t)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)// Change after\n Jo&&pe(e.doc,t)<r.viewTo&&vn(e);else if(a<=r.viewFrom)// C...
[ "0.5986818", "0.5932057", "0.5650373", "0.56363535", "0.5577781", "0.55256647", "0.55159706", "0.5509551", "0.5506837", "0.54515785", "0.5449042", "0.5448814", "0.54456145", "0.54456145", "0.54456145", "0.54456145", "0.54456145", "0.54456145", "0.54456145", "0.54456145", "0.5...
0.0
-1
More lowerlevel change function, handling only a single document (not linked ones).
function makeChangeSingleDoc(doc, change, selAfter, spans) { if (doc.cm && !doc.cm.curOp) return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans); if (change.to.line < doc.first) { shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line)); return; ...
{ "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.700297", "0.660607", "0.657349", "0.65440965", "0.64870083", "0.64870083", "0.6453983", "0.6453983", "0.6453983", "0.6453983", "0.6453983", "0.6453983", "0.6453983", "0.6453983", "0.6453983", "0.6453983", "0.6453983", "0.6453983", "0.64350307", "0.64350307", "0.64350307", ...
0.63992995
30
Handle the interaction of a change to a document with the editor that this document is part of.
function makeChangeSingleDocInEditor(cm, change, spans) { var doc = cm.doc, display = cm.display, from = change.from, to = change.to; var recomputeMaxLength = false, checkWidthStart = from.line; if (!cm.options.lineWrapping) { checkWidthStart = lineNo(visualLine(getLine(doc, from.line))); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _onCurrentDocumentChange() {\n var doc = DocumentManager.getCurrentDocument(),\n container = _editorHolder.get(0);\n \n var perfTimerName = PerfUtils.markStart(\"EditorManager._onCurrentDocumentChange():\\t\" + (!doc || doc.file.fullPath));\n\n // Remove scroller-sha...
[ "0.6989578", "0.68647164", "0.6661219", "0.6592309", "0.65232587", "0.63881063", "0.63272256", "0.63092566", "0.6279335", "0.62503177", "0.61630493", "0.61265033", "0.61171705", "0.61171705", "0.6100543", "0.6096026", "0.60762805", "0.60762805", "0.6016115", "0.601135", "0.60...
0.6036763
18
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, coords) { var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null; if (coords.top + box.top < 0) doScroll = true; else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false; if (doSc...
{ "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.6380827", "0.62958086", "0.6136729", "0.6135841", "0.6080174", "0.6078307", "0.6056505", "0.6009804", "0.6009804", "0.6009804", "0.600625", "0.59079796", "0.59079796", "0.59079796", "0.59079796", "0.59079796", "0.59079796", "0.59079796", "0.5907465", "0.5891595", "0.589147...
0.0
-1
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; for (;;) { var changed = false, coords = cursorCoords(cm, pos); var endCoords = !end || end == pos ? coords : cursorCoords(cm, end); var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.le...
{ "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.6941039", "0.65672356", "0.62917775", "0.61791223", "0.6119063", "0.601864", "0.5993806", "0.59667224", "0.59440273", "0.5869851", "0.58540875", "0.5849482", "0.5846473", "0.5828448", "0.58210266", "0.5809784", "0.5808769", "0.57965076", "0.5795773", "0.5781369", "0.577449...
0.0
-1
Scroll a given set of coordinates into view (immediately).
function scrollIntoView(cm, x1, y1, x2, y2) { var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2); if (scrollPos.scrollTop != null) setScrollTop(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.66701293", "0.6622403", "0.6622403", "0.6622403", "0.65619946", "0.65619946", "0.65619946", "0.65619946", "0.65619946", "0.65619946", "0.65619946", "0.6482107", "0.61915034", "0.61915034", "0.61915034", "0.61915034", "0.61856335", "0.61743706", "0.61577165", "0.61577165", ...
0.65100485
11
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, x1, y1, x2, y2) { var display = cm.display, snapMargin = textHeight(cm.display); if (y1 < 0) y1 = 0; var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop; var screen = display.scroller.clientHeight - scrollerCutOff, ...
{ "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.6595175", "0.6591926", "0.6591926", "0.6591926", "0.6591926", "0.6591926", "0.6591926", "0.6591926", "0.6591926", "0.6591926", "0.6591926", "0.6591926", "0.6491554", "0.6491554", "0.6491554", "0.6491554", "0.6491554", "0.6491554", "0.64889026", "0.6469144", "0.64613694", ...
0.62290764
41
Store a relative adjustment to the scroll position in the current operation (to be applied when the operation finishes).
function addToScrollPos(cm, left, top) { if (left != null || top != null) resolveScrollToPos(cm); if (left != null) cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left; if (top != null) cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.do...
{ "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.64328575", "0.63141257", "0.63141257", "0.63141257", "0.6269965", "0.62446713", "0.62446713", "0.62446713", "0.62446713", "0.62446713", "0.62446713", "0.62446713", "0.6215512", "0.6166497", "0.6105691", "0.6085317", "0.60724515", "0.60724515", "0.60724515", "0.6065848", "0...
0.6203502
13
Make sure that at the end of the operation the current cursor is shown.
function ensureCursorVisible(cm) { resolveScrollToPos(cm); var cur = cm.getCursor(), from = cur, to = cur; if (!cm.options.lineWrapping) { from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur; to = Pos(cur.line, cur.ch + 1); } cm.curOp.scrollToPos = {from: from, to: to, margin: cm.opti...
{ "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.0
-1
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); var sPos = calculateScrollPos(cm, Math.min(from.left, to.left), ...
{ "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.64442915", "0.6427002", "0.6380351", "0.6374905", "0.6312776", "0.6310328", "0.6300054", "0.6284562", "0.62773097", "0.6261587", "0.62396413", "0.6234451", "0.62333477", "0.6228509", "0.61966586", "0.6196645", "0.619365", "0.6175256", "0.6175256", "0.6175256", "0.6175256",...
0.6013901
59
API UTILITIES Indent the given line. The how parameter can be "smart", "add"/null, "subtract", or "prev". When aggressive is false (typically set to true for forced singleline indents), empty lines are not indented, and places where the mode returns Pass are left alone.
function indentLine(cm, n, how, aggressive) { var doc = cm.doc, state; if (how == null) how = "add"; if (how == "smart") { // Fall back to "prev" when the mode doesn't have an indentation // method. if (!doc.mode.indent) how = "prev"; else state = getStateBefore(cm, n); }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc,\n state;\n\n if (how == null) {\n how = \"add\";\n }\n\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) {\n how = \"prev...
[ "0.7768561", "0.7728095", "0.7727709", "0.7727709", "0.7727709", "0.7727709", "0.7727709", "0.7727709", "0.7727709", "0.7727709", "0.7727709", "0.7727709", "0.7727709", "0.7727709", "0.7727709", "0.7727709", "0.7727709", "0.7727709", "0.7727709", "0.77135223", "0.770854", "...
0.76691395
26
Utility for applying a change to a line by handle or number, returning the number and optionally registering the line as changed.
function changeLine(doc, handle, changeType, op) { var no = handle, line = handle; if (typeof handle == "number") line = getLine(doc, clipLine(doc, handle)); else no = lineNo(handle); if (no == null) return null; if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType); return lin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeLine(doc, handle, changeType, op) {\n\t var no = handle, line = handle;\n\t if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n\t else no = lineNo(handle);\n\t if (no == null) return null;\n\t if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType)...
[ "0.73564804", "0.73564804", "0.73564804", "0.73487985", "0.73487985", "0.73487985", "0.73487985", "0.73487985", "0.73487985", "0.73487985", "0.73463076", "0.73418856", "0.73418856", "0.73418856", "0.73418856", "0.73418856", "0.73418856", "0.73418856", "0.73418856", "0.73418856"...
0.73161405
28
Helper for deleting text near the selection(s), used to implement backspace, delete, and similar functionality.
function deleteNearSelection(cm, compute) { var ranges = cm.doc.sel.ranges, kill = []; // Build up a set of ranges to kill first, merging overlapping // ranges. for (var i = 0; i < ranges.length; i++) { var toKill = compute(ranges[i]); while (kill.length && cmp(toKill.from, lst(kill).t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeTextSelections() {\n if (document.selection) document.selection.empty();\n else if (window.getSelection) window.getSelection().removeAllRanges();\n}", "function removeTextSelection() {\n\n if (window.getSelection) {\n\n window.getSelection().removeAllRanges();\n\n } else if (document.se...
[ "0.7446558", "0.7391313", "0.709859", "0.7049477", "0.6970693", "0.69385004", "0.6919004", "0.68240345", "0.6810697", "0.68011355", "0.6721915", "0.6719395", "0.6719395", "0.6719395", "0.6719395", "0.6719395", "0.6719395", "0.6719395", "0.6719395", "0.6719395", "0.6687007", ...
0.5778332
75
Used for horizontal relative motion. Dir is 1 or 1 (left or right), unit can be "char", "column" (like char, but doesn't cross line boundaries), "word" (across next word), or "group" (to the start of next group of word or nonwordnonwhitespace chars). The visually param controls whether, in righttoleft text, direction 1...
function findPosH(doc, pos, dir, unit, visually) { var line = pos.line, ch = pos.ch, origDir = dir; var lineObj = getLine(doc, line); var possible = true; function findNextLine() { var l = line + dir; if (l < doc.first || l >= doc.first + doc.size) return (possible = false); lin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n var possible = true;\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return (possible = false);\n ...
[ "0.6126276", "0.6126276", "0.6126276", "0.6126276", "0.6126276", "0.6126276", "0.61237055", "0.6094494", "0.60565525", "0.6052763", "0.60278237", "0.60217786", "0.60217786", "0.60217786", "0.59992564", "0.59992564", "0.59971863", "0.5986649", "0.5975884", "0.5975884", "0.5975...
0.6130347
0
For relative vertical movement. Dir may be 1 or 1. Unit can be "page" or "line". The resulting position will have a hitSide=true property if it reached the end of the document.
function findPosV(cm, pos, dir, unit) { var doc = cm.doc, x = pos.left, y; if (unit == "page") { var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight); y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display)); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n ...
[ "0.6914866", "0.6914866", "0.6870082", "0.6870082", "0.6870082", "0.6870082", "0.6870082", "0.6870082", "0.6870082", "0.6870082", "0.6870082", "0.6870082", "0.6870082", "0.6870082", "0.6870082", "0.6870082", "0.6870082", "0.6821437", "0.68100506", "0.68100506", "0.68100506", ...
0.67162454
39
Find the word at the given position (as returned by coordsChar).
function findWordAt(cm, pos) { var doc = cm.doc, line = getLine(doc, pos.line).text; var start = pos.ch, end = pos.ch; if (line) { var helper = cm.getHelper(pos, "wordChars"); if ((pos.xRel < 0 || end == line.length) && start) --start; else ++end; var startChar = line.charAt(start); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "wordAt(pos) {\n let { text, from, length } = this.doc.lineAt(pos);\n let cat = this.charCategorizer(pos);\n let start = pos - from, end = pos - from;\n while (start > 0) {\n let prev = findClusterBreak(text, start, false);\n if (cat(text.slice(prev, start)) != expo...
[ "0.7163546", "0.7014515", "0.6941773", "0.6941773", "0.6912063", "0.6561325", "0.6549947", "0.65433896", "0.6538319", "0.6538319", "0.6503659", "0.6503659", "0.6503659", "0.6503659", "0.64854646", "0.64854646", "0.64854646", "0.64854646", "0.64854646", "0.64854646", "0.648546...
0.69475126
2
Create a marker, wire it up to the right lines, and
function markText(doc, from, to, options, type) { // Shared markers (across linked documents) are handled separately // (markTextShared will call out to this again, once per // document). if (options && options.shared) return markTextShared(doc, from, to, options, type); // Ensure we are in an ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawMarker(lineWidth, lineHeightPerc, offset, markerLength, horiz) {\n var start, end;\n var height = em.height();\n if (horiz) {\n start = { x: offset, y: height};\n end = { x: offset, y: height - (markerLength*lineHeightPerc)};\n...
[ "0.706403", "0.6922555", "0.6829682", "0.67605793", "0.6707079", "0.66788775", "0.6592433", "0.6586964", "0.6577096", "0.6535049", "0.645897", "0.6454014", "0.6452927", "0.644539", "0.6428748", "0.64162165", "0.63716215", "0.6367775", "0.63661844", "0.6362076", "0.6345258", ...
0.0
-1
Search an array of spans for a span matching the given marker.
function getMarkedSpanFor(spans, marker) { if (spans) for (var i = 0; i < spans.length; ++i) { var span = spans[i]; if (span.marker == marker) return span; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans...
[ "0.7195285", "0.7195285", "0.7195285", "0.7195285", "0.7195285", "0.7195285", "0.7195285", "0.7182503", "0.7182503", "0.7182503", "0.7182503", "0.7182503", "0.7182503", "0.7182503", "0.7182503", "0.7182503", "0.7182503", "0.7182503", "0.7182503", "0.7182503", "0.7182503", "...
0.7141147
25
Remove a span from an array, returning undefined if no spans are left (we don't store arrays for lines without spans).
function removeMarkedSpan(spans, span) { for (var r, i = 0; i < spans.length; ++i) if (spans[i] != span) (r || (r = [])).push(spans[i]); return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeMarkedSpan(spans, span) {\n\t\t for (var r, i = 0; i < spans.length; ++i)\n\t\t if (spans[i] != span) (r || (r = [])).push(spans[i]);\n\t\t return r;\n\t\t }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r...
[ "0.74040127", "0.7397826", "0.7397826", "0.7397826", "0.7397826", "0.7397826", "0.7397826", "0.7397826", "0.73853534", "0.73853534", "0.73853534", "0.73151606", "0.7314696", "0.729348", "0.729348", "0.729348", "0.729348", "0.729348", "0.729348", "0.729348", "0.729348", "0.7...
0.7361935
11
Add a span to a line.
function addMarkedSpan(line, span) { line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]; span.marker.attachLine(line); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLin...
[ "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "0.7689838", "...
0.7690222
0
Used for the algorithm that adjusts markers for a change in the document. These functions cut an array of spans at a given character position, returning an array of remaining chunks (or undefined if nothing remains).
function markedSpansBefore(old, startCh, isInsert) { if (old) for (var i = 0, nw; i < old.length; ++i) { var span = old[i], marker = span.marker; var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh); if (startsBefore || span.from == startC...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOldSpans(doc, change) {\n\t\t var found = change[\"spans_\" + doc.id];\n\t\t if (!found) return null;\n\t\t for (var i = 0, nw = []; i < change.text.length; ++i)\n\t\t nw.push(removeClearedSpans(found[i]));\n\t\t return nw;\n\t\t }", "function removeClearedSpans(spans) {\n if (!s...
[ "0.54903406", "0.5486872", "0.5478584", "0.54643", "0.54643", "0.54643", "0.5456619", "0.5456619", "0.5456619", "0.5456619", "0.5456619", "0.5456619", "0.5456619", "0.54424185", "0.5440055", "0.54209167", "0.54209167", "0.54209167", "0.54209167", "0.54209167", "0.54209167", ...
0.0
-1
Given a change object, compute the new set of marker spans that cover the line in which the change took place. Removes spans entirely within the change, reconnects spans belonging to the same marker that appear on both sides of the change, and cuts off spans partially within the change. Returns an array of span arrays ...
function stretchSpansOverChange(doc, change) { var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans; var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans; if (!oldFirst && !oldLast) return null; var startCh = change.from.ch, en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" +...
[ "0.6804883", "0.6804883", "0.6804883", "0.6804883", "0.6804883", "0.6804883", "0.6804883", "0.6798043", "0.6798043", "0.6798043", "0.6798043", "0.6798043", "0.6798043", "0.6798043", "0.6798043", "0.6798043", "0.6798043", "0.6798043", "0.6798043", "0.6798043", "0.6798043", "...
0.6699681
55
Remove spans that are empty and don't have a clearWhenEmpty option of false.
function clearEmptySpans(spans) { for (var i = 0; i < spans.length; ++i) { var span = spans[i]; if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false) spans.splice(i--, 1); } if (!spans.length) return null; return spans; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearEmptySpans(spans) {\n\t\t for (var i = 0; i < spans.length; ++i) {\n\t\t var span = spans[i];\n\t\t if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)\n\t\t spans.splice(i--, 1);\n\t\t }\n\t\t if (!spans.length) return null;\n\t\t retur...
[ "0.75844175", "0.7581774", "0.7581774", "0.7581774", "0.7581774", "0.7581774", "0.7581774", "0.7581774", "0.7581774", "0.7581774", "0.7581774", "0.7581774", "0.7581774", "0.7581774", "0.7581774", "0.7581774", "0.7581774", "0.7581774", "0.75752497", "0.75752497", "0.75752497",...
0.7570095
26
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 (oldCu...
{ "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.6204524", "0.6183464", "0.61482537", "0.61482537", "0.61482537", "0.6074324", "0.6074324", "0.6074324", "0.6074324", "0.6074324", "0.6074324", "0.6074324", "0.60686743", "0.6056806", "0.60326916", "0.60326916", "0.60326916", "0.60326916", "0.60326916", "0.60326916", "0.603...
0.0
-1
Used to 'clip' out readOnly ranges when making a change.
function removeReadOnlyRanges(doc, from, to) { var markers = null; doc.iter(from.line, to.line + 1, function(line) { if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) { var mark = line.markedSpans[i].marker; if (mark.readOnly && (!markers || indexOf(markers, mark...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clipRange(range, min, max) {\n return range\n .filter(segment => segment[1] >= min && segment[0] <= max)\n .map(segment => [Math.max(segment[0], min), Math.min(segment[1], max)]);\n}", "function removeReadOnlyRanges(doc, from, to) {\n\t\t var markers = null;\n\t\t doc.iter(from.line, to.lin...
[ "0.6547939", "0.6417559", "0.64017415", "0.6282898", "0.6282898", "0.6282898", "0.61574495", "0.61574495", "0.61574495", "0.61574495", "0.61574495", "0.61574495", "0.61574495", "0.61574495", "0.61574495", "0.61574495", "0.61574495", "0.61574495", "0.61574495", "0.61574495", "...
0.614353
30
Connect or disconnect spans from a line.
function detachMarkedSpans(line) { var spans = line.markedSpans; if (!spans) return; for (var i = 0; i < spans.length; ++i) spans[i].marker.detachLine(line); line.markedSpans = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLin...
[ "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "...
0.0
-1
Helpers used when computing which overlapping collapsed span counts as the larger one.
function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareCollapsedMarkers(a, b) {\n var lenDiff = a.lines.length - b.lines.length;\n\n if (lenDiff != 0) {\n return lenDiff;\n }\n\n var aPos = a.find(),\n bPos = b.find();\n var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n\n if (fromCmp) {\n retur...
[ "0.6158327", "0.5892967", "0.5875146", "0.5875146", "0.5875146", "0.58443254", "0.58443254", "0.58443254", "0.58443254", "0.58443254", "0.58443254", "0.58443254", "0.58198965", "0.58142793", "0.5766265", "0.5766265", "0.5766265", "0.5766265", "0.5766265", "0.5766265", "0.5766...
0.0
-1
Returns a number indicating which of two overlapping collapsed spans is larger (and thus includes the other). Falls back to comparing ids when the spans cover exactly the same range.
function compareCollapsedMarkers(a, b) { var lenDiff = a.lines.length - b.lines.length; if (lenDiff != 0) return lenDiff; var aPos = a.find(), bPos = b.find(); var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b); if (fromCmp) return -fromCmp; var toCmp = cmp(aPos.to, bPo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareCollapsedMarkers(a, b) {\n var lenDiff = a.lines.length - b.lines.length;\n\n if (lenDiff != 0) {\n return lenDiff;\n }\n\n var aPos = a.find(),\n bPos = b.find();\n var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n\n if (fromCmp) {\n retur...
[ "0.7142431", "0.6935029", "0.6935029", "0.6935029", "0.6935029", "0.6935029", "0.6935029", "0.6935029", "0.69114345", "0.69114345", "0.69114345", "0.69104326", "0.6881797", "0.6881797", "0.6881797", "0.6881797", "0.6881797", "0.6881797", "0.6881797", "0.6881797", "0.6881797",...
0.68953055
12
Find out whether a line ends or starts in a collapsed span. If so, return the marker for that span.
function collapsedSpanAtSide(line, start) { var sps = sawCollapsedSpans && line.markedSpans, found; if (sps) for (var sp, i = 0; i < sps.length; ++i) { sp = sps[i]; if (sp.marker.collapsed && (start ? sp.from : sp.to) == null && (!found || compareCollapsedMarkers(found, sp.marker) < 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function collapsedSpanAtSide(line, start) {\n\t\t var sps = sawCollapsedSpans && line.markedSpans, found;\n\t\t if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {\n\t\t sp = sps[i];\n\t\t if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&\n\t\t (!found || compare...
[ "0.7781851", "0.77472335", "0.77472335", "0.77472335", "0.77472335", "0.77472335", "0.77472335", "0.77472335", "0.77472335", "0.77472335", "0.77472335", "0.77472335", "0.77472335", "0.77472335", "0.77472335", "0.77472335", "0.77472335", "0.77472335", "0.77291834", "0.77291834",...
0.7656547
30
Test whether there exists a collapsed span that partially overlaps (covers the start or end, but not both) of a new span. Such overlap is not allowed.
function conflictingCollapsedRange(doc, lineNo, from, to, marker) { var line = getLine(doc, lineNo); var sps = sawCollapsedSpans && line.markedSpans; if (sps) for (var i = 0; i < sps.length; ++i) { var sp = sps[i]; if (!sp.marker.collapsed) continue; var found = sp.marker.find(0); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function conflictingCollapsedRange(doc, lineNo, from, to, marker) {\n var line = getLine(doc, lineNo);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) continue;\n var found = sp.marker.find(0...
[ "0.6864755", "0.6864755", "0.6864755", "0.6864755", "0.6864755", "0.6864755", "0.685666", "0.68406713", "0.68406713", "0.68406713", "0.68406713", "0.68406713", "0.68406713", "0.68406713", "0.68406713", "0.68317807", "0.68317807", "0.682337", "0.6810524", "0.6806325", "0.67974...
0.6841365
7
A visual line is a line as drawn on the screen. Folding, for example, can cause multiple logical lines to appear on the same visual line. This finds the start of the visual line that the given line is part of (usually that is the line itself).
function visualLine(line) { var merged; while (merged = collapsedSpanAtStart(line)) line = merged.find(-1, true).line; return line; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visualLine(line) {\n\t\t var merged;\n\t\t while (merged = collapsedSpanAtStart(line))\n\t\t line = merged.find(-1, true).line;\n\t\t return line;\n\t\t }", "function visualLine(line) {\n\t\t var merged;\n\t\t while (merged = collapsedSpanAtStart(line))\n\t\t { line = merged.fi...
[ "0.8249701", "0.8240324", "0.82310987", "0.82310987", "0.82310987", "0.8211684", "0.81788206", "0.81788206", "0.81788206", "0.81788206", "0.81788206", "0.81788206", "0.81788206", "0.81788206", "0.81788206", "0.81788206", "0.81788206", "0.81788206", "0.81788206", "0.81788206", ...
0.8173319
30
Returns an array of logical lines that continue the visual line started by the argument, or undefined if there are no such lines.
function visualLineContinued(line) { var merged, lines; while (merged = collapsedSpanAtEnd(line)) { line = merged.find(1, true).line; (lines || (lines = [])).push(line); } return lines; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visualLineContinued(line) {\n var merged, lines;\n\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line;\n (lines || (lines = [])).push(line);\n }\n\n return lines;\n } // Get the line number of the start of the visual line that the", "function visualLi...
[ "0.6935793", "0.66301644", "0.6583158", "0.6580819", "0.6580819", "0.6580819", "0.6580819", "0.6580819", "0.6580819", "0.6580819", "0.6579544", "0.6579544", "0.6579544", "0.65731263", "0.65731263", "0.65731263", "0.65731263", "0.65731263", "0.65731263", "0.65731263", "0.65731...
0.6561416
30
Get the line number of the start of the visual line that the given line number is part of.
function visualLineNo(doc, lineN) { var line = getLine(doc, lineN), vis = visualLine(line); if (line == vis) return lineN; return lineNo(vis); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN),\n vis = visualLine(line);\n\n if (line == vis) {\n return lineN;\n }\n\n return lineNo(vis);\n } // Get the line number of the start of the next visual line after", "function visualLineNo(doc, lineN) {\n\t\t var lin...
[ "0.79719335", "0.7488473", "0.74559027", "0.74559027", "0.74559027", "0.74559027", "0.74559027", "0.74559027", "0.74559027", "0.74559027", "0.74559027", "0.74559027", "0.74559027", "0.74559027", "0.74559027", "0.74559027", "0.74559027", "0.74559027", "0.74559027", "0.74231917",...
0.7371761
32
Get the line number of the start of the next visual line after the given line.
function visualLineEndNo(doc, lineN) { if (lineN > doc.lastLine()) return lineN; var line = getLine(doc, lineN), merged; if (!lineIsHidden(doc, line)) return lineN; while (merged = collapsedSpanAtEnd(line)) line = merged.find(1, true).line; return lineNo(line) + 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN),\n vis = visualLine(line);\n\n if (line == vis) {\n return lineN;\n }\n\n return lineNo(vis);\n } // Get the line number of the start of the next visual line after", "function nextLine() {\n\t\t_this._compConst('LINE', ...
[ "0.79053533", "0.73212373", "0.70655745", "0.7048663", "0.70483404", "0.704656", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", ...
0.69670045
88
Compute whether a line is hidden. Lines count as hidden when they are part of a visual line that starts with another line, or when they are entirely covered by collapsed, nonwidget span.
function lineIsHidden(doc, line) { var sps = sawCollapsedSpans && line.markedSpans; if (sps) for (var sp, i = 0; i < sps.length; ++i) { sp = sps[i]; if (!sp.marker.collapsed) continue; if (sp.from == null) return true; if (sp.marker.widgetNode) continue; if (sp.from == 0 && ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lineIsHidden(doc, line) {\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) for (var sp, i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (!sp.marker.collapsed) continue;\n if (sp.from == null) return true;\n if (sp.marker.widgetNode) continue;\n if (sp.from == ...
[ "0.850484", "0.850484", "0.850484", "0.850484", "0.850484", "0.850484", "0.850484", "0.85011065", "0.85011065", "0.85011065", "0.85011065", "0.85011065", "0.85011065", "0.85011065", "0.85011065", "0.85011065", "0.85011065", "0.85011065", "0.85011065", "0.85011065", "0.8501106...
0.84692115
25
Change the content (text, markers) of a line. Automatically invalidates cached information and tries to reestimate the line's height.
function updateLine(line, text, markedSpans, estimateHeight) { line.text = text; if (line.stateAfter) line.stateAfter = null; if (line.styles) line.styles = null; if (line.order != null) line.order = null; detachMarkedSpans(line); attachMarkedSpans(line, markedSpans); var estHeight = ...
{ "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.749166", "0.7394869", "0.7390498", "0.7390498", "0.7390498", "0.7390498", "0.7390498", "0.7390498", "0.7390498", "0.7390498", "0.7390498", "0.7390498", "0.7390498", "0.7390498", "0.7390498", "0.7390498", "0.7390498", "0.7390498", "0.7390498", "0.73896736", "0.73896736", ...
0.7328578
32
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.74187696", "0.74187696", "0.7408218", "0.7399272", "0.7399272", "0.7396458", "0.73904276", "0.7388251", "0.7385665", "0.7383718", "0.7383718", "0.7383718", "0.7383718", "0.7383718", "0.7383718", "0.7383718", "0.7383718", "0.7383718", "0.7383718", "0.7383718", "0.7383718", ...
0.72677463
58
Run the given mode's parser over a line, calling f for each token.
function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) { var flattenSpans = mode.flattenSpans; if (flattenSpans == null) flattenSpans = cm.options.flattenSpans; var curStart = 0, curStyle = null; var stream = new StringStream(text, cm.options.tabSize), style; if (text == "") extrac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runMode(cm, text, mode, state, f) {\n var flattenSpans = cm.options.flattenSpans;\n var curText = \"\", curStyle = null;\n var stream = new StringStream(text, cm.options.tabSize);\n if (text == \"\" && mode.blankLine) mode.blankLine(state);\n while (!stream.eol()) {\n var style = mode....
[ "0.6841281", "0.68301743", "0.68301743", "0.6777866", "0.6612709", "0.64859253", "0.64420784", "0.6336574", "0.6336574", "0.629284", "0.62294865", "0.62294865", "0.62294865", "0.62294865", "0.62294865", "0.62294865", "0.62294865", "0.62294865", "0.62294865", "0.62294865", "0....
0.6292484
10
Compute a style array (an array starting with a mode generation for invalidation followed by pairs of end positions and style strings), which is used to highlight the tokens on the line.
function highlightLine(cm, line, state, forceToEnd) { // A styles array always starts with a number identifying the // mode/overlays that it is based on (for easy invalidation). var st = [cm.state.modeGen], lineClasses = {}; // Compute the base array of styles runMode(cm, line.text, cm.doc.mode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStyleArrayForBlock(block) {\n var text = block.text,\n inlineStyleRanges = block.inlineStyleRanges;\n\n var inlineStyles = {\n BOLD: new Array(text.length),\n ITALIC: new Array(text.length),\n UNDERLINE: new Array(text.length),\n STRIKETHROUGH: new Array(text.length),\n CODE: new ...
[ "0.65245426", "0.64413244", "0.613997", "0.5957505", "0.5834924", "0.57767236", "0.5775472", "0.5775472", "0.5693552", "0.5693552", "0.5693552", "0.5693552", "0.5693552", "0.5693552", "0.5693552", "0.5663078", "0.5663078", "0.56104505", "0.56104505", "0.56104505", "0.56104505...
0.56565195
17