code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
function getIndex(ranges, cursor, end) {
for (var i = 0; i < ranges.length; i++) {
var atAnchor = end != 'head' && cursorEqual(ranges[i].anchor, cursor);
var atHead = end != 'anchor' && cursorEqual(ranges[i].head, cursor);
if (atAnchor || atHead) {
return i;
}
}
... | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | getIndex | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function getSelectedAreaRange(cm, vim) {
var lastSelection = vim.lastSelection;
var getCurrentSelectedAreaRange = function () {
var selections = cm.listSelections();
var start = selections[0];
var end = selections[selections.length - 1];
var selectionStart = cursorIsBefore(st... | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | getSelectedAreaRange | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
getCurrentSelectedAreaRange = function () {
var selections = cm.listSelections();
var start = selections[0];
var end = selections[selections.length - 1];
var selectionStart = cursorIsBefore(start.anchor, start.head) ? start.anchor : start.head;
var selectionEnd = cursorIsBefore(e... | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | getCurrentSelectedAreaRange | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
getLastSelectedAreaRange = function () {
var selectionStart = cm.getCursor();
var selectionEnd = cm.getCursor();
var block = lastSelection.visualBlock;
if (block) {
var width = block.width;
var height = block.height;
selectionEnd = Pos(selectionStart.line + ... | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | getLastSelectedAreaRange | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function updateLastSelection(cm, vim) {
var anchor = vim.sel.anchor;
var head = vim.sel.head;
// To accommodate the effect of lastPastedText in the last selection
if (vim.lastPastedText) {
head = cm.posFromIndex(cm.indexFromPos(anchor) + vim.lastPastedText.length);
vim.lastPasted... | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | updateLastSelection | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function expandSelection(cm, start, end) {
var sel = cm.state.vim.sel;
var head = sel.head;
var anchor = sel.anchor;
var tmp;
if (cursorIsBefore(end, start)) {
tmp = end;
end = start;
start = tmp;
}
if (cursorIsBefore(head, anchor)) {
head = curs... | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | expandSelection | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function updateCmSelection(cm, sel, mode) {
var vim = cm.state.vim;
sel = sel || vim.sel;
var mode = mode || vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char';
var cmSel = makeCmSelection(cm, sel, mode);
cm.setSelections(cmSel.ranges, cmSel.primary);
updateFakeCursor(cm);
... | Updates the CodeMirror selection to match the provided vim selection.
If no arguments are given, it uses the current vim selection state. | updateCmSelection | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function makeCmSelection(cm, sel, mode, exclusive) {
var head = copyCursor(sel.head);
var anchor = copyCursor(sel.anchor);
if (mode == 'char') {
var headOffset = !exclusive && !cursorIsBefore(sel.head, sel.anchor) ? 1 : 0;
var anchorOffset = cursorIsBefore(sel.head, sel.anchor) ? 1 : 0... | Updates the CodeMirror selection to match the provided vim selection.
If no arguments are given, it uses the current vim selection state. | makeCmSelection | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function getHead(cm) {
var cur = cm.getCursor('head');
if (cm.getSelection().length == 1) {
// Small corner case when only 1 character is selected. The "real"
// head is the left of head and anchor.
cur = cursorMin(cur, cm.getCursor('anchor'));
}
return cur;
} | Updates the CodeMirror selection to match the provided vim selection.
If no arguments are given, it uses the current vim selection state. | getHead | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function exitVisualMode(cm, moveHead) {
var vim = cm.state.vim;
if (moveHead !== false) {
cm.setCursor(clipCursorToContent(cm, vim.sel.head));
}
updateLastSelection(cm, vim);
vim.visualMode = false;
vim.visualLine = false;
vim.visualBlock = false;
if (!vim.insertM... | If moveHead is set to false, the CodeMirror selection will not be
touched. The caller assumes the responsibility of putting the cursor
in the right place. | exitVisualMode | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function clipToLine(cm, curStart, curEnd) {
var selection = cm.getRange(curStart, curEnd);
// Only clip if the selection ends with trailing newline + whitespace
if (/\n\s*$/.test(selection)) {
var lines = selection.split('\n');
// We know this is all whitespace.
lines.pop();
... | If moveHead is set to false, the CodeMirror selection will not be
touched. The caller assumes the responsibility of putting the cursor
in the right place. | clipToLine | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function expandSelectionToLine(_cm, curStart, curEnd) {
curStart.ch = 0;
curEnd.ch = 0;
curEnd.line++;
} | If moveHead is set to false, the CodeMirror selection will not be
touched. The caller assumes the responsibility of putting the cursor
in the right place. | expandSelectionToLine | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function findFirstNonWhiteSpaceCharacter(text) {
if (!text) {
return 0;
}
var firstNonWS = text.search(/\S/);
return firstNonWS == -1 ? text.length : firstNonWS;
} | If moveHead is set to false, the CodeMirror selection will not be
touched. The caller assumes the responsibility of putting the cursor
in the right place. | findFirstNonWhiteSpaceCharacter | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function expandWordUnderCursor(cm, inclusive, _forward, bigWord, noSymbol) {
var cur = getHead(cm);
var line = cm.getLine(cur.line);
var idx = cur.ch;
// Seek to first word or non-whitespace character, depending on if
// noSymbol is true.
var test = noSymbol ? wordCharTest[0] : bigW... | If moveHead is set to false, the CodeMirror selection will not be
touched. The caller assumes the responsibility of putting the cursor
in the right place. | expandWordUnderCursor | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function expandTagUnderCursor(cm, head, inclusive) {
var cur = head;
if (!CodeMirror.findMatchingTag || !CodeMirror.findEnclosingTag) {
return { start: cur, end: cur };
}
var tags = CodeMirror.findMatchingTag(cm, head) || CodeMirror.findEnclosingTag(cm, head);
if (!tags || !tags.o... | Depends on the following:
- editor mode should be htmlmixedmode / xml
- mode/xml/xml.js should be loaded
- addon/fold/xml-fold.js should be loaded
If any of the above requirements are not true, this function noops.
This is _NOT_ a 100% accurate implementation of vim tag text objects.
The following caveats apply (bas... | expandTagUnderCursor | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function recordJumpPosition(cm, oldCur, newCur) {
if (!cursorEqual(oldCur, newCur)) {
vimGlobalState.jumpList.add(cm, oldCur, newCur);
}
} | Depends on the following:
- editor mode should be htmlmixedmode / xml
- mode/xml/xml.js should be loaded
- addon/fold/xml-fold.js should be loaded
If any of the above requirements are not true, this function noops.
This is _NOT_ a 100% accurate implementation of vim tag text objects.
The following caveats apply (bas... | recordJumpPosition | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function recordLastCharacterSearch(increment, args) {
vimGlobalState.lastCharacterSearch.increment = increment;
vimGlobalState.lastCharacterSearch.forward = args.forward;
vimGlobalState.lastCharacterSearch.selectedCharacter = args.selectedCharacter;
} | Depends on the following:
- editor mode should be htmlmixedmode / xml
- mode/xml/xml.js should be loaded
- addon/fold/xml-fold.js should be loaded
If any of the above requirements are not true, this function noops.
This is _NOT_ a 100% accurate implementation of vim tag text objects.
The following caveats apply (bas... | recordLastCharacterSearch | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function findSymbol(cm, repeat, forward, symb) {
var cur = copyCursor(cm.getCursor());
var increment = forward ? 1 : -1;
var endLine = forward ? cm.lineCount() : -1;
var curCh = cur.ch;
var line = cur.line;
var lineText = cm.getLine(line);
var state = {
lineText: lineTe... | Depends on the following:
- editor mode should be htmlmixedmode / xml
- mode/xml/xml.js should be loaded
- addon/fold/xml-fold.js should be loaded
If any of the above requirements are not true, this function noops.
This is _NOT_ a 100% accurate implementation of vim tag text objects.
The following caveats apply (bas... | findSymbol | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function findWord(cm, cur, forward, bigWord, emptyLineIsWord) {
var lineNum = cur.line;
var pos = cur.ch;
var line = cm.getLine(lineNum);
var dir = forward ? 1 : -1;
var charTests = bigWord ? bigWordCharTest : wordCharTest;
if (emptyLineIsWord && line == '') {
lineNum += dir... | Depends on the following:
- editor mode should be htmlmixedmode / xml
- mode/xml/xml.js should be loaded
- addon/fold/xml-fold.js should be loaded
If any of the above requirements are not true, this function noops.
This is _NOT_ a 100% accurate implementation of vim tag text objects.
The following caveats apply (bas... | findWord | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function moveToWord(cm, cur, repeat, forward, wordEnd, bigWord) {
var curStart = copyCursor(cur);
var words = [];
if ((forward && !wordEnd) || (!forward && wordEnd)) {
repeat++;
}
// For 'e', empty lines are not considered words, go figure.
var emptyLineIsWord = !(forward && ... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | moveToWord | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function moveToEol(cm, head, motionArgs, vim, keepHPos) {
var cur = head;
var retval = Pos(cur.line + motionArgs.repeat - 1, Infinity);
var end = cm.clipPos(retval);
end.ch--;
if (!keepHPos) {
vim.lastHPos = Infinity;
vim.lastHSPos = cm.charCoords(end, 'div').left;
}
... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | moveToEol | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function moveToCharacter(cm, repeat, forward, character) {
var cur = cm.getCursor();
var start = cur.ch;
var idx;
for (var i = 0; i < repeat; i++) {
var line = cm.getLine(cur.line);
idx = charIdxInLine(start, line, character, forward, true);
if (idx == -1) {
ret... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | moveToCharacter | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function moveToColumn(cm, repeat) {
// repeat is always >= 1, so repeat - 1 always corresponds
// to the column we want to go to.
var line = cm.getCursor().line;
return clipCursorToContent(cm, Pos(line, repeat - 1));
} | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | moveToColumn | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function updateMark(cm, vim, markName, pos) {
if (!inArray(markName, validMarks)) {
return;
}
if (vim.marks[markName]) {
vim.marks[markName].clear();
}
vim.marks[markName] = cm.setBookmark(pos);
} | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | updateMark | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function charIdxInLine(start, line, character, forward, includeChar) {
// Search for char in line.
// motion_options: {forward, includeChar}
// If includeChar = true, include it too.
// If forward = true, search forward, else search backwards.
// If char is not found on this line, do nothi... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | charIdxInLine | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function findParagraph(cm, head, repeat, dir, inclusive) {
var line = head.line;
var min = cm.firstLine();
var max = cm.lastLine();
var start,
end,
i = line;
function isEmpty(i) {
return !cm.getLine(i);
}
function isBoundary(i, dir, any) {
if (an... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | findParagraph | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function isEmpty(i) {
return !cm.getLine(i);
} | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | isEmpty | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function isBoundary(i, dir, any) {
if (any) {
return isEmpty(i) != isEmpty(i + dir);
}
return !isEmpty(i) && isEmpty(i + dir);
} | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | isBoundary | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function findSentence(cm, cur, repeat, dir) {
/*
Takes an index object
{
line: the line string,
ln: line number,
pos: index in line,
dir: direction of traversal (-1 or 1)
}
and modifies the line, ln, and pos members to represent the
n... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | findSentence | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function nextChar(cm, idx) {
if (idx.pos + idx.dir < 0 || idx.pos + idx.dir >= idx.line.length) {
idx.ln += idx.dir;
if (!isLine(cm, idx.ln)) {
idx.line = null;
idx.ln = null;
idx.pos = null;
return;
}
idx.line = cm.getLine(... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | nextChar | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function forward(cm, ln, pos, dir) {
var line = cm.getLine(ln);
var stop = line === '';
var curr = {
line: line,
ln: ln,
pos: pos,
dir: dir,
};
var last_valid = {
ln: curr.ln,
pos: curr.pos,
};
var ski... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | forward | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function reverse(cm, ln, pos, dir) {
var line = cm.getLine(ln);
var curr = {
line: line,
ln: ln,
pos: pos,
dir: dir,
};
var last_valid = {
ln: curr.ln,
pos: null,
};
var skip_empty_lines = curr.line === '';
... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | reverse | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function selectCompanionObject(cm, head, symb, inclusive) {
var cur = head,
start,
end;
var bracketRegexp = {
'(': /[()]/,
')': /[()]/,
'[': /[[\]]/,
']': /[[\]]/,
'{': /[{}]/,
'}': /[{}]/,
'<': /[<>]/,
'>': /[<>]/,
}[sym... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | selectCompanionObject | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function findBeginningAndEnd(cm, head, symb, inclusive) {
var cur = copyCursor(head);
var line = cm.getLine(cur.line);
var chars = line.split('');
var start, end, i, len;
var firstIndex = chars.indexOf(symb);
// the decision tree is to always look backwards for the beginning first,
... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | findBeginningAndEnd | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function getSearchState(cm) {
var vim = cm.state.vim;
return vim.searchState_ || (vim.searchState_ = new SearchState());
} | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | getSearchState | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function splitBySlash(argString) {
return splitBySeparator(argString, '/');
} | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | splitBySlash | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function findUnescapedSlashes(argString) {
return findUnescapedSeparators(argString, '/');
} | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | findUnescapedSlashes | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function splitBySeparator(argString, separator) {
var slashes = findUnescapedSeparators(argString, separator) || [];
if (!slashes.length) return [];
var tokens = [];
// in case of strings like foo/bar
if (slashes[0] !== 0) return;
for (var i = 0; i < slashes.length; i++) {
if... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | splitBySeparator | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function findUnescapedSeparators(str, separator) {
if (!separator) separator = '/';
var escapeNextChar = false;
var slashes = [];
for (var i = 0; i < str.length; i++) {
var c = str.charAt(i);
if (!escapeNextChar && c == separator) {
slashes.push(i);
}
e... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | findUnescapedSeparators | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function translateRegex(str) {
// When these match, add a '\' if unescaped or remove one if escaped.
var specials = '|(){';
// Remove, but never add, a '\' for these.
var unescape = '}';
var escapeNextChar = false;
var out = [];
for (var i = -1; i < str.length; i++) {
v... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | translateRegex | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function translateRegexReplace(str) {
var escapeNextChar = false;
var out = [];
for (var i = -1; i < str.length; i++) {
var c = str.charAt(i) || '';
var n = str.charAt(i + 1) || '';
if (charUnescapes[c + n]) {
out.push(charUnescapes[c + n]);
i++;
} e... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | translateRegexReplace | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function unescapeRegexReplace(str) {
var stream = new CodeMirror.StringStream(str);
var output = [];
while (!stream.eol()) {
// Search for \.
while (stream.peek() && stream.peek() != '\\') {
output.push(stream.next());
}
var matched = false;
for (var m... | @param {CodeMirror} cm CodeMirror object.
@param {Pos} cur The position to start from.
@param {int} repeat Number of words to move past.
@param {boolean} forward True to search forward. False to search
backward.
@param {boolean} wordEnd True to move to end of word. False to move to
beginning of word.
@param {bo... | unescapeRegexReplace | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function parseQuery(query, ignoreCase, smartCase) {
// First update the last search register
var lastSearchRegister = vimGlobalState.registerController.getRegister('/');
lastSearchRegister.setText(query);
// Check if the query is already a regex.
if (query instanceof RegExp) {
retu... | Extract the regular expression from the query and return a Regexp object.
Returns null if the query is blank.
If ignoreCase is passed in, the Regexp object will have the 'i' flag set.
If smartCase is passed in, and the query contains upper case letters,
then ignoreCase is overridden, and the 'i' flag will not be set.... | parseQuery | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function dom(n) {
if (typeof n === 'string') n = document.createElement(n);
for (var a, i = 1; i < arguments.length; i++) {
if (!(a = arguments[i])) continue;
if (typeof a !== 'object') a = document.createTextNode(a);
if (a.nodeType) n.appendChild(a);
else
for (var ... | dom - Document Object Manipulator
Usage:
dom('<tag>'|<node>[, ...{<attributes>|<$styles>}|<child-node>|'<text>'])
Examples:
dom('div', {id:'xyz'}, dom('p', 'CM rocks!', {$color:'red'}))
dom(document.head, dom('script', 'alert("hello!")'))
Not supported:
dom('p', ['arrays are objects'], Error('objects specify at... | dom | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function showConfirm(cm, template) {
var pre = dom('pre', { $color: 'red' }, template);
if (cm.openNotification) {
cm.openNotification(pre, { bottom: true, duration: 5000 });
} else {
alert(pre.innerText);
}
} | dom - Document Object Manipulator
Usage:
dom('<tag>'|<node>[, ...{<attributes>|<$styles>}|<child-node>|'<text>'])
Examples:
dom('div', {id:'xyz'}, dom('p', 'CM rocks!', {$color:'red'}))
dom(document.head, dom('script', 'alert("hello!")'))
Not supported:
dom('p', ['arrays are objects'], Error('objects specify at... | showConfirm | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function makePrompt(prefix, desc) {
return dom(
document.createDocumentFragment(),
dom(
'span',
{ $fontFamily: 'monospace', $whiteSpace: 'pre' },
prefix,
dom('input', { type: 'text', autocorrect: 'off', autocapitalize: 'off', spellcheck: 'false' })
)... | dom - Document Object Manipulator
Usage:
dom('<tag>'|<node>[, ...{<attributes>|<$styles>}|<child-node>|'<text>'])
Examples:
dom('div', {id:'xyz'}, dom('p', 'CM rocks!', {$color:'red'}))
dom(document.head, dom('script', 'alert("hello!")'))
Not supported:
dom('p', ['arrays are objects'], Error('objects specify at... | makePrompt | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function showPrompt(cm, options) {
var shortText = (options.prefix || '') + ' ' + (options.desc || '');
var template = makePrompt(options.prefix, options.desc);
if (cm.openDialog) {
cm.openDialog(template, options.onClose, {
onKeyDown: options.onKeyDown,
onKeyUp: options.on... | dom - Document Object Manipulator
Usage:
dom('<tag>'|<node>[, ...{<attributes>|<$styles>}|<child-node>|'<text>'])
Examples:
dom('div', {id:'xyz'}, dom('p', 'CM rocks!', {$color:'red'}))
dom(document.head, dom('script', 'alert("hello!")'))
Not supported:
dom('p', ['arrays are objects'], Error('objects specify at... | showPrompt | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function regexEqual(r1, r2) {
if (r1 instanceof RegExp && r2 instanceof RegExp) {
var props = ['global', 'multiline', 'ignoreCase', 'source'];
for (var i = 0; i < props.length; i++) {
var prop = props[i];
if (r1[prop] !== r2[prop]) {
return false;
}
... | dom - Document Object Manipulator
Usage:
dom('<tag>'|<node>[, ...{<attributes>|<$styles>}|<child-node>|'<text>'])
Examples:
dom('div', {id:'xyz'}, dom('p', 'CM rocks!', {$color:'red'}))
dom(document.head, dom('script', 'alert("hello!")'))
Not supported:
dom('p', ['arrays are objects'], Error('objects specify at... | regexEqual | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function updateSearchQuery(cm, rawQuery, ignoreCase, smartCase) {
if (!rawQuery) {
return;
}
var state = getSearchState(cm);
var query = parseQuery(rawQuery, !!ignoreCase, !!smartCase);
if (!query) {
return;
}
highlightSearchMatches(cm, query);
if (regexEq... | dom - Document Object Manipulator
Usage:
dom('<tag>'|<node>[, ...{<attributes>|<$styles>}|<child-node>|'<text>'])
Examples:
dom('div', {id:'xyz'}, dom('p', 'CM rocks!', {$color:'red'}))
dom(document.head, dom('script', 'alert("hello!")'))
Not supported:
dom('p', ['arrays are objects'], Error('objects specify at... | updateSearchQuery | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function searchOverlay(query) {
if (query.source.charAt(0) == '^') {
var matchSol = true;
}
return {
token: function (stream) {
if (matchSol && !stream.sol()) {
stream.skipToEnd();
return;
}
var match = stream.match(query, false);
... | dom - Document Object Manipulator
Usage:
dom('<tag>'|<node>[, ...{<attributes>|<$styles>}|<child-node>|'<text>'])
Examples:
dom('div', {id:'xyz'}, dom('p', 'CM rocks!', {$color:'red'}))
dom(document.head, dom('script', 'alert("hello!")'))
Not supported:
dom('p', ['arrays are objects'], Error('objects specify at... | searchOverlay | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function highlightSearchMatches(cm, query) {
clearTimeout(highlightTimeout);
highlightTimeout = setTimeout(function () {
var searchState = getSearchState(cm);
var overlay = searchState.getOverlay();
if (!overlay || query != overlay.query) {
if (overlay) {
cm.rem... | dom - Document Object Manipulator
Usage:
dom('<tag>'|<node>[, ...{<attributes>|<$styles>}|<child-node>|'<text>'])
Examples:
dom('div', {id:'xyz'}, dom('p', 'CM rocks!', {$color:'red'}))
dom(document.head, dom('script', 'alert("hello!")'))
Not supported:
dom('p', ['arrays are objects'], Error('objects specify at... | highlightSearchMatches | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function findNext(cm, prev, query, repeat) {
if (repeat === undefined) {
repeat = 1;
}
return cm.operation(function () {
var pos = cm.getCursor();
var cursor = cm.getSearchCursor(query, pos);
for (var i = 0; i < repeat; i++) {
var found = cursor.find(prev);
... | dom - Document Object Manipulator
Usage:
dom('<tag>'|<node>[, ...{<attributes>|<$styles>}|<child-node>|'<text>'])
Examples:
dom('div', {id:'xyz'}, dom('p', 'CM rocks!', {$color:'red'}))
dom(document.head, dom('script', 'alert("hello!")'))
Not supported:
dom('p', ['arrays are objects'], Error('objects specify at... | findNext | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function findNextFromAndToInclusive(cm, prev, query, repeat, vim) {
if (repeat === undefined) {
repeat = 1;
}
return cm.operation(function () {
var pos = cm.getCursor();
var cursor = cm.getSearchCursor(query, pos);
// Go back one result to ensure that if the cursor is ... | Pretty much the same as `findNext`, except for the following differences:
1. Before starting the search, move to the previous search. This way if our cursor is
already inside a match, we should return the current match.
2. Rather than only returning the cursor's from, we return the cursor's from and to as a tuple. | findNextFromAndToInclusive | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function clearSearchHighlight(cm) {
var state = getSearchState(cm);
cm.removeOverlay(getSearchState(cm).getOverlay());
state.setOverlay(null);
if (state.getScrollbarAnnotate()) {
state.getScrollbarAnnotate().clear();
state.setScrollbarAnnotate(null);
}
} | Pretty much the same as `findNext`, except for the following differences:
1. Before starting the search, move to the previous search. This way if our cursor is
already inside a match, we should return the current match.
2. Rather than only returning the cursor's from, we return the cursor's from and to as a tuple. | clearSearchHighlight | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function isInRange(pos, start, end) {
if (typeof pos != 'number') {
// Assume it is a cursor position. Get the line number.
pos = pos.line;
}
if (start instanceof Array) {
return inArray(pos, start);
} else {
if (typeof end == 'number') {
return pos >= s... | Check if pos is in the specified range, INCLUSIVE.
Range can be specified with 1 or 2 arguments.
If the first range argument is an array, treat it as an array of line
numbers. Match pos against any of the lines.
If the first range argument is a number,
if there is only 1 range argument, check if pos has the same line... | isInRange | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function getUserVisibleLines(cm) {
var scrollInfo = cm.getScrollInfo();
var occludeToleranceTop = 6;
var occludeToleranceBottom = 10;
var from = cm.coordsChar({ left: 0, top: occludeToleranceTop + scrollInfo.top }, 'local');
var bottomY = scrollInfo.clientHeight - occludeToleranceBottom + ... | Check if pos is in the specified range, INCLUSIVE.
Range can be specified with 1 or 2 arguments.
If the first range argument is an array, treat it as an array of line
numbers. Match pos against any of the lines.
If the first range argument is a number,
if there is only 1 range argument, check if pos has the same line... | getUserVisibleLines | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function getMarkPos(cm, vim, markName) {
if (markName == "'" || markName == '`') {
return vimGlobalState.jumpList.find(cm, -1) || Pos(0, 0);
} else if (markName == '.') {
return getLastEditPos(cm);
}
var mark = vim.marks[markName];
return mark && mark.find();
} | Check if pos is in the specified range, INCLUSIVE.
Range can be specified with 1 or 2 arguments.
If the first range argument is an array, treat it as an array of line
numbers. Match pos against any of the lines.
If the first range argument is a number,
if there is only 1 range argument, check if pos has the same line... | getMarkPos | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function getLastEditPos(cm) {
var done = cm.doc.history.done;
for (var i = done.length; i--; ) {
if (done[i].changes) {
return copyCursor(done[i].changes[0].to);
}
}
} | Check if pos is in the specified range, INCLUSIVE.
Range can be specified with 1 or 2 arguments.
If the first range argument is an array, treat it as an array of line
numbers. Match pos against any of the lines.
If the first range argument is a number,
if there is only 1 range argument, check if pos has the same line... | getLastEditPos | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function parseArgs() {
if (params.argString) {
var args = new CodeMirror.StringStream(params.argString);
if (args.eat('!')) {
reverse = true;
}
if (args.eol()) {
return;
}
if (!args.eatSpace()) {
... | Check if pos is in the specified range, INCLUSIVE.
Range can be specified with 1 or 2 arguments.
If the first range argument is an array, treat it as an array of line
numbers. Match pos against any of the lines.
If the first range argument is a number,
if there is only 1 range argument, check if pos has the same line... | parseArgs | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function compareFn(a, b) {
if (reverse) {
var tmp;
tmp = a;
a = b;
b = tmp;
}
if (ignoreCase) {
a = a.toLowerCase();
b = b.toLowerCase();
}
var anum = number && numberRegex.exec(a);
var bn... | Check if pos is in the specified range, INCLUSIVE.
Range can be specified with 1 or 2 arguments.
If the first range argument is an array, treat it as an array of line
numbers. Match pos against any of the lines.
If the first range argument is a number,
if there is only 1 range argument, check if pos has the same line... | compareFn | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function comparePatternFn(a, b) {
if (reverse) {
var tmp;
tmp = a;
a = b;
b = tmp;
}
if (ignoreCase) {
a[0] = a[0].toLowerCase();
b[0] = b[0].toLowerCase();
}
return a[0] < b[0] ? -1 : 1;
} | Check if pos is in the specified range, INCLUSIVE.
Range can be specified with 1 or 2 arguments.
If the first range argument is an array, treat it as an array of line
numbers. Match pos against any of the lines.
If the first range argument is a number,
if there is only 1 range argument, check if pos has the same line... | comparePatternFn | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function doReplace(cm, confirm, global, lineStart, lineEnd, searchCursor, query, replaceWith, callback) {
// Set up all the functions.
cm.state.vim.exMode = true;
var done = false;
var lastPos, modifiedLineNumber, joined;
function replaceAll() {
cm.operation(function () {
... | @param {CodeMirror} cm CodeMirror instance we are in.
@param {boolean} confirm Whether to confirm each replace.
@param {Cursor} lineStart Line to start replacing from.
@param {Cursor} lineEnd Line to stop replacing at.
@param {RegExp} query Query for performing matches with.
@param {string} replaceWith Text to replace ... | doReplace | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function replaceAll() {
cm.operation(function () {
while (!done) {
replace();
next();
}
stop();
});
} | @param {CodeMirror} cm CodeMirror instance we are in.
@param {boolean} confirm Whether to confirm each replace.
@param {Cursor} lineStart Line to start replacing from.
@param {Cursor} lineEnd Line to stop replacing at.
@param {RegExp} query Query for performing matches with.
@param {string} replaceWith Text to replace ... | replaceAll | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function replace() {
var text = cm.getRange(searchCursor.from(), searchCursor.to());
var newText = text.replace(query, replaceWith);
var unmodifiedLineNumber = searchCursor.to().line;
searchCursor.replace(newText);
modifiedLineNumber = searchCursor.to().line;
lineEnd += m... | @param {CodeMirror} cm CodeMirror instance we are in.
@param {boolean} confirm Whether to confirm each replace.
@param {Cursor} lineStart Line to start replacing from.
@param {Cursor} lineEnd Line to stop replacing at.
@param {RegExp} query Query for performing matches with.
@param {string} replaceWith Text to replace ... | replace | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function next() {
// The below only loops to skip over multiple occurrences on the same
// line when 'global' is not true.
while (searchCursor.findNext() && isInRange(searchCursor.from(), lineStart, lineEnd)) {
if (!global && searchCursor.from().line == modifiedLineNumber && !joined) {... | @param {CodeMirror} cm CodeMirror instance we are in.
@param {boolean} confirm Whether to confirm each replace.
@param {Cursor} lineStart Line to start replacing from.
@param {Cursor} lineEnd Line to stop replacing at.
@param {RegExp} query Query for performing matches with.
@param {string} replaceWith Text to replace ... | next | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function stop(close) {
if (close) {
close();
}
cm.focus();
if (lastPos) {
cm.setCursor(lastPos);
var vim = cm.state.vim;
vim.exMode = false;
vim.lastHPos = vim.lastHSPos = lastPos.ch;
}
if (callback) {
callback()... | @param {CodeMirror} cm CodeMirror instance we are in.
@param {boolean} confirm Whether to confirm each replace.
@param {Cursor} lineStart Line to start replacing from.
@param {Cursor} lineEnd Line to stop replacing at.
@param {RegExp} query Query for performing matches with.
@param {string} replaceWith Text to replace ... | stop | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function onPromptKeyDown(e, _value, close) {
// Swallow all keys.
CodeMirror.e_stop(e);
var keyName = CodeMirror.keyName(e);
switch (keyName) {
case 'Y':
replace();
next();
break;
case 'N':
next();
break;
... | @param {CodeMirror} cm CodeMirror instance we are in.
@param {boolean} confirm Whether to confirm each replace.
@param {Cursor} lineStart Line to start replacing from.
@param {Cursor} lineEnd Line to stop replacing at.
@param {RegExp} query Query for performing matches with.
@param {string} replaceWith Text to replace ... | onPromptKeyDown | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function exitInsertMode(cm) {
var vim = cm.state.vim;
var macroModeState = vimGlobalState.macroModeState;
var insertModeChangeRegister = vimGlobalState.registerController.getRegister('.');
var isPlaying = macroModeState.isPlaying;
var lastChange = macroModeState.lastInsertModeChanges;
... | @param {CodeMirror} cm CodeMirror instance we are in.
@param {boolean} confirm Whether to confirm each replace.
@param {Cursor} lineStart Line to start replacing from.
@param {Cursor} lineEnd Line to stop replacing at.
@param {RegExp} query Query for performing matches with.
@param {string} replaceWith Text to replace ... | exitInsertMode | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function onChange(cm, changeObj) {
var macroModeState = vimGlobalState.macroModeState;
var lastChange = macroModeState.lastInsertModeChanges;
if (!macroModeState.isPlaying) {
while (changeObj) {
lastChange.expectCursorActivityForChange = true;
if (lastChange.ignoreCount > 1... | Listens for changes made in insert mode.
Should only be active in insert mode. | onChange | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function onCursorActivity(cm) {
var vim = cm.state.vim;
if (vim.insertMode) {
// Tracking cursor activity in insert mode (for macro support).
var macroModeState = vimGlobalState.macroModeState;
if (macroModeState.isPlaying) {
return;
}
var lastChange = macro... | Listens for any kind of cursor activity on CodeMirror. | onCursorActivity | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function updateFakeCursor(cm) {
var className = 'cm-animate-fat-cursor';
var vim = cm.state.vim;
var from = clipCursorToContent(cm, copyCursor(vim.sel.head));
var to = offsetCursor(from, 0, 1);
clearFakeCursor(vim);
// In visual mode, the cursor may be positioned over EOL.
if (... | Keeps track of a fake cursor to support visual mode cursor behavior. | updateFakeCursor | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function clearFakeCursor(vim) {
if (vim.fakeCursor) {
vim.fakeCursor.clear();
vim.fakeCursor = null;
}
if (vim.fakeCursorBookmark) {
vim.fakeCursorBookmark.clear();
vim.fakeCursorBookmark = null;
}
} | Keeps track of a fake cursor to support visual mode cursor behavior. | clearFakeCursor | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function handleExternalSelection(cm, vim) {
var anchor = cm.getCursor('anchor');
var head = cm.getCursor('head');
// Enter or exit visual mode to match mouse selection.
if (vim.visualMode && !cm.somethingSelected()) {
exitVisualMode(cm, false);
} else if (!vim.visualMode && !vim.in... | Keeps track of a fake cursor to support visual mode cursor behavior. | handleExternalSelection | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function InsertModeKey(keyName) {
this.keyName = keyName;
} | Wrapper for special keys pressed in insert mode | InsertModeKey | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function onKeyEventTargetKeyDown(e) {
var macroModeState = vimGlobalState.macroModeState;
var lastChange = macroModeState.lastInsertModeChanges;
var keyName = CodeMirror.keyName(e);
if (!keyName) {
return;
}
function onKeyFound() {
if (lastChange.maybeReset) {
... | Handles raw key down events from the text area.
- Should only be active in insert mode.
- For recording deletes in insert mode. | onKeyEventTargetKeyDown | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function onKeyFound() {
if (lastChange.maybeReset) {
lastChange.changes = [];
lastChange.maybeReset = false;
}
lastChange.changes.push(new InsertModeKey(keyName));
return true;
} | Handles raw key down events from the text area.
- Should only be active in insert mode.
- For recording deletes in insert mode. | onKeyFound | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function repeatLastEdit(cm, vim, repeat, repeatForInsert) {
var macroModeState = vimGlobalState.macroModeState;
macroModeState.isPlaying = true;
var isAction = !!vim.lastEditActionCommand;
var cachedInputState = vim.inputState;
function repeatCommand() {
if (isAction) {
c... | Repeats the last edit, which includes exactly 1 command and at most 1
insert. Operator and motion commands are read from lastEditInputState,
while action commands are read from lastEditActionCommand.
If repeatForInsert is true, then the function was called by
exitInsertMode to repeat the insert mode changes the user j... | repeatLastEdit | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function repeatCommand() {
if (isAction) {
commandDispatcher.processAction(cm, vim, vim.lastEditActionCommand);
} else {
commandDispatcher.evalInput(cm, vim);
}
} | Repeats the last edit, which includes exactly 1 command and at most 1
insert. Operator and motion commands are read from lastEditInputState,
while action commands are read from lastEditActionCommand.
If repeatForInsert is true, then the function was called by
exitInsertMode to repeat the insert mode changes the user j... | repeatCommand | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function repeatInsert(repeat) {
if (macroModeState.lastInsertModeChanges.changes.length > 0) {
// For some reason, repeat cw in desktop VIM does not repeat
// insert mode changes. Will conform to that behavior.
repeat = !vim.lastEditActionCommand ? 1 : repeat;
var changeO... | Repeats the last edit, which includes exactly 1 command and at most 1
insert. Operator and motion commands are read from lastEditInputState,
while action commands are read from lastEditActionCommand.
If repeatForInsert is true, then the function was called by
exitInsertMode to repeat the insert mode changes the user j... | repeatInsert | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function repeatInsertModeChanges(cm, changes, repeat) {
function keyHandler(binding) {
if (typeof binding == 'string') {
CodeMirror.commands[binding](cm);
} else {
binding(cm);
}
return true;
}
var head = cm.getCursor('head');
var visualBlock =... | Repeats the last edit, which includes exactly 1 command and at most 1
insert. Operator and motion commands are read from lastEditInputState,
while action commands are read from lastEditActionCommand.
If repeatForInsert is true, then the function was called by
exitInsertMode to repeat the insert mode changes the user j... | repeatInsertModeChanges | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function keyHandler(binding) {
if (typeof binding == 'string') {
CodeMirror.commands[binding](cm);
} else {
binding(cm);
}
return true;
} | Repeats the last edit, which includes exactly 1 command and at most 1
insert. Operator and motion commands are read from lastEditInputState,
while action commands are read from lastEditActionCommand.
If repeatForInsert is true, then the function was called by
exitInsertMode to repeat the insert mode changes the user j... | keyHandler | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function makeKeywords(str) {
var obj = {},
words = str.split(' ');
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
} | Author: Gautam Mehta
Branched from CodeMirror's Scheme mode | makeKeywords | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/cobol/cobol.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/cobol/cobol.js | MIT |
function isNumber(ch, stream) {
// hex
if (ch === '0' && stream.eat(/x/i)) {
stream.eatWhile(tests.hex);
return true;
}
// leading sign
if ((ch == '+' || ch == '-') && tests.digit.test(stream.peek())) {
stream.eat(tests.sign);
ch = stream.next();
}
... | Author: Gautam Mehta
Branched from CodeMirror's Scheme mode | isNumber | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/cobol/cobol.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/cobol/cobol.js | MIT |
function wordRegexp(words) {
return new RegExp('^((' + words.join(')|(') + '))\\b');
} | Link to the project's GitHub page:
https://github.com/pickhardt/coffeescript-codemirror-mode | wordRegexp | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/coffeescript/coffeescript.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/coffeescript/coffeescript.js | MIT |
function tokenBase(stream, state) {
// Handle scope changes
if (stream.sol()) {
if (state.scope.align === null) state.scope.align = false;
var scopeOffset = state.scope.offset;
if (stream.eatSpace()) {
var lineOffset = stream.indentation();
if (lineOffset > scopeO... | Link to the project's GitHub page:
https://github.com/pickhardt/coffeescript-codemirror-mode | tokenBase | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/coffeescript/coffeescript.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/coffeescript/coffeescript.js | MIT |
function tokenFactory(delimiter, singleline, outclass) {
return function (stream, state) {
while (!stream.eol()) {
stream.eatWhile(/[^'"\/\\]/);
if (stream.eat('\\')) {
stream.next();
if (singleline && stream.eol()) {
return outclass;
}... | Link to the project's GitHub page:
https://github.com/pickhardt/coffeescript-codemirror-mode | tokenFactory | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/coffeescript/coffeescript.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/coffeescript/coffeescript.js | MIT |
function longComment(stream, state) {
while (!stream.eol()) {
stream.eatWhile(/[^#]/);
if (stream.match('###')) {
state.tokenize = tokenBase;
break;
}
stream.eatWhile('#');
}
return 'comment';
} | Link to the project's GitHub page:
https://github.com/pickhardt/coffeescript-codemirror-mode | longComment | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/coffeescript/coffeescript.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/coffeescript/coffeescript.js | MIT |
function indent(stream, state, type) {
type = type || 'coffee';
var offset = 0,
align = false,
alignOffset = null;
for (var scope = state.scope; scope; scope = scope.prev) {
if (scope.type === 'coffee' || scope.type == '}') {
offset = scope.offset + conf.indentUnit;
... | Link to the project's GitHub page:
https://github.com/pickhardt/coffeescript-codemirror-mode | indent | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/coffeescript/coffeescript.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/coffeescript/coffeescript.js | MIT |
function dedent(stream, state) {
if (!state.scope.prev) return;
if (state.scope.type === 'coffee') {
var _indent = stream.indentation();
var matched = false;
for (var scope = state.scope; scope; scope = scope.prev) {
if (_indent === scope.offset) {
matched = tru... | Link to the project's GitHub page:
https://github.com/pickhardt/coffeescript-codemirror-mode | dedent | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/coffeescript/coffeescript.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/coffeescript/coffeescript.js | MIT |
function tokenLexer(stream, state) {
var style = state.tokenize(stream, state);
var current = stream.current();
// Handle scope changes.
if (current === 'return') {
state.dedent = true;
}
if (((current === '->' || current === '=>') && stream.eol()) || style === 'indent') {
... | Link to the project's GitHub page:
https://github.com/pickhardt/coffeescript-codemirror-mode | tokenLexer | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/coffeescript/coffeescript.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/coffeescript/coffeescript.js | MIT |
tokenBase = function (stream, state) {
var next_rule = state.next || 'start';
if (next_rule) {
state.next = state.next;
var nr = Rules[next_rule];
if (nr.splice) {
for (var i$ = 0; i$ < nr.length; ++i$) {
var r = nr[i$];
if (r.regex && stream.match(r... | Link to the project's GitHub page:
https://github.com/duralog/CodeMirror | tokenBase | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/livescript/livescript.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/livescript/livescript.js | MIT |
function tokenCComment(stream, state) {
var maybeEnd = false,
ch;
while ((ch = stream.next()) != null) {
if (maybeEnd && ch == '/') {
state.tokenize = tokenBase;
break;
}
maybeEnd = ch == '*';
}
return ret('comment', 'comment');
} | /
var ch = stream.next();
if (ch == '@') {
stream.eatWhile(/[\w\\\-]/);
return ret('meta', stream.current());
} else if (ch == '/' && stream.eat('*')) {
state.tokenize = tokenCComment;
return tokenCComment(stream, state);
} else if (ch == '<' && stream.eat('!')) ... | tokenCComment | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/nginx/nginx.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/nginx/nginx.js | MIT |
function tokenSGMLComment(stream, state) {
var dashes = 0,
ch;
while ((ch = stream.next()) != null) {
if (dashes >= 2 && ch == '>') {
state.tokenize = tokenBase;
break;
}
dashes = ch == '-' ? dashes + 1 : 0;
}
return ret('comment', 'comment');
... | /
var ch = stream.next();
if (ch == '@') {
stream.eatWhile(/[\w\\\-]/);
return ret('meta', stream.current());
} else if (ch == '/' && stream.eat('*')) {
state.tokenize = tokenCComment;
return tokenCComment(stream, state);
} else if (ch == '<' && stream.eat('!')) ... | tokenSGMLComment | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/nginx/nginx.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/nginx/nginx.js | MIT |
function tokenString(quote) {
return function (stream, state) {
var escaped = false,
ch;
while ((ch = stream.next()) != null) {
if (ch == quote && !escaped) break;
escaped = !escaped && ch == '\\';
}
if (!escaped) state.tokenize = tokenBase;
re... | /
var ch = stream.next();
if (ch == '@') {
stream.eatWhile(/[\w\\\-]/);
return ret('meta', stream.current());
} else if (ch == '/' && stream.eat('*')) {
state.tokenize = tokenCComment;
return tokenCComment(stream, state);
} else if (ch == '<' && stream.eat('!')) ... | tokenString | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/nginx/nginx.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/nginx/nginx.js | MIT |
function transitState(currState, c) {
var currLocation = currState.location;
var ret;
// Opening.
if (currLocation == Location.PRE_SUBJECT && c == '<') ret = Location.WRITING_SUB_URI;
else if (currLocation == Location.PRE_SUBJECT && c == '_') ret = Location.WRITING_BNODE_URI;
else i... | *******************************************************
This script provides syntax highlighting support for
the N-Triples format.
N-Triples format specification:
https://www.w3.org/TR/n-triples/
********************************************************* | transitState | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/ntriples/ntriples.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/ntriples/ntriples.js | MIT |
function nextToken(stream, state) {
var tok =
innerMode(stream, state) ||
restOfLine(stream, state) ||
interpolationContinued(stream, state) ||
includeFilteredContinued(stream, state) ||
eachContinued(stream, state) ||
attrsContinued(stream, state) ||
... | Get the next token in the stream
@param {Stream} stream
@param {State} state | nextToken | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/pug/pug.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/pug/pug.js | MIT |
function makeKeywords(str) {
var obj = {},
words = str.split(' ');
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
} | Author: Koh Zi Han, based on implementation by Koh Zi Chun | makeKeywords | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js | MIT |
function stateStack(indent, type, prev) {
// represents a state stack object
this.indent = indent;
this.type = type;
this.prev = prev;
} | Author: Koh Zi Han, based on implementation by Koh Zi Chun | stateStack | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js | MIT |
function pushStack(state, indent, type) {
state.indentStack = new stateStack(indent, type, state.indentStack);
} | Author: Koh Zi Han, based on implementation by Koh Zi Chun | pushStack | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js | MIT |
function popStack(state) {
state.indentStack = state.indentStack.prev;
} | Author: Koh Zi Han, based on implementation by Koh Zi Chun | popStack | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.