chore(plugins): update plugin dist files
This commit is contained in:
31
plugins/codemirror/addon/search/searchcursor.js
vendored
31
plugins/codemirror/addon/search/searchcursor.js
vendored
@@ -202,6 +202,7 @@
|
||||
|
||||
function SearchCursor(doc, query, pos, options) {
|
||||
this.atOccurrence = false
|
||||
this.afterEmptyMatch = false
|
||||
this.doc = doc
|
||||
pos = pos ? doc.clipPos(pos) : Pos(0, 0)
|
||||
this.pos = {from: pos, to: pos}
|
||||
@@ -237,21 +238,29 @@
|
||||
findPrevious: function() {return this.find(true)},
|
||||
|
||||
find: function(reverse) {
|
||||
var result = this.matches(reverse, this.doc.clipPos(reverse ? this.pos.from : this.pos.to))
|
||||
|
||||
// Implements weird auto-growing behavior on null-matches for
|
||||
// backwards-compatibility with the vim code (unfortunately)
|
||||
while (result && CodeMirror.cmpPos(result.from, result.to) == 0) {
|
||||
var head = this.doc.clipPos(reverse ? this.pos.from : this.pos.to);
|
||||
if (this.afterEmptyMatch && this.atOccurrence) {
|
||||
// do not return the same 0 width match twice
|
||||
head = Pos(head.line, head.ch)
|
||||
if (reverse) {
|
||||
if (result.from.ch) result.from = Pos(result.from.line, result.from.ch - 1)
|
||||
else if (result.from.line == this.doc.firstLine()) result = null
|
||||
else result = this.matches(reverse, this.doc.clipPos(Pos(result.from.line - 1)))
|
||||
head.ch--;
|
||||
if (head.ch < 0) {
|
||||
head.line--;
|
||||
head.ch = (this.doc.getLine(head.line) || "").length;
|
||||
}
|
||||
} else {
|
||||
if (result.to.ch < this.doc.getLine(result.to.line).length) result.to = Pos(result.to.line, result.to.ch + 1)
|
||||
else if (result.to.line == this.doc.lastLine()) result = null
|
||||
else result = this.matches(reverse, Pos(result.to.line + 1, 0))
|
||||
head.ch++;
|
||||
if (head.ch > (this.doc.getLine(head.line) || "").length) {
|
||||
head.ch = 0;
|
||||
head.line++;
|
||||
}
|
||||
}
|
||||
if (CodeMirror.cmpPos(head, this.doc.clipPos(head)) != 0) {
|
||||
return this.atOccurrence = false
|
||||
}
|
||||
}
|
||||
var result = this.matches(reverse, head)
|
||||
this.afterEmptyMatch = result && CodeMirror.cmpPos(result.from, result.to) == 0
|
||||
|
||||
if (result) {
|
||||
this.pos = result
|
||||
|
||||
@@ -60,19 +60,13 @@
|
||||
.cm-fat-cursor div.CodeMirror-cursors {
|
||||
z-index: 1;
|
||||
}
|
||||
.cm-fat-cursor-mark {
|
||||
background-color: rgba(20, 255, 20, 0.5);
|
||||
-webkit-animation: blink 1.06s steps(1) infinite;
|
||||
-moz-animation: blink 1.06s steps(1) infinite;
|
||||
animation: blink 1.06s steps(1) infinite;
|
||||
}
|
||||
.cm-animate-fat-cursor {
|
||||
width: auto;
|
||||
-webkit-animation: blink 1.06s steps(1) infinite;
|
||||
-moz-animation: blink 1.06s steps(1) infinite;
|
||||
animation: blink 1.06s steps(1) infinite;
|
||||
background-color: #7e7;
|
||||
}
|
||||
.cm-fat-cursor .CodeMirror-line::selection,
|
||||
.cm-fat-cursor .CodeMirror-line > span::selection,
|
||||
.cm-fat-cursor .CodeMirror-line > span > span::selection { background: transparent; }
|
||||
.cm-fat-cursor .CodeMirror-line::-moz-selection,
|
||||
.cm-fat-cursor .CodeMirror-line > span::-moz-selection,
|
||||
.cm-fat-cursor .CodeMirror-line > span > span::-moz-selection { background: transparent; }
|
||||
.cm-fat-cursor { caret-color: transparent; }
|
||||
@-moz-keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
|
||||
@@ -2351,12 +2351,14 @@
|
||||
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.caches[i]} } }
|
||||
for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
|
||||
{ if (lineNo(lineView.rest[i$1]) > lineN)
|
||||
{ return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
|
||||
if (lineView.rest) {
|
||||
for (var i = 0; i < lineView.rest.length; i++)
|
||||
{ if (lineView.rest[i] == line)
|
||||
{ return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
|
||||
for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
|
||||
{ if (lineNo(lineView.rest[i$1]) > lineN)
|
||||
{ return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
|
||||
}
|
||||
}
|
||||
|
||||
// Render a line into the hidden node display.externalMeasured. Used
|
||||
@@ -3150,13 +3152,19 @@
|
||||
var curFragment = result.cursors = document.createDocumentFragment();
|
||||
var selFragment = result.selection = document.createDocumentFragment();
|
||||
|
||||
var customCursor = cm.options.$customCursor;
|
||||
if (customCursor) { primary = true; }
|
||||
for (var i = 0; i < doc.sel.ranges.length; i++) {
|
||||
if (!primary && i == doc.sel.primIndex) { continue }
|
||||
var range = doc.sel.ranges[i];
|
||||
if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }
|
||||
var collapsed = range.empty();
|
||||
if (collapsed || cm.options.showCursorWhenSelecting)
|
||||
{ drawSelectionCursor(cm, range.head, curFragment); }
|
||||
if (customCursor) {
|
||||
var head = customCursor(cm, range);
|
||||
if (head) { drawSelectionCursor(cm, head, curFragment); }
|
||||
} else if (collapsed || cm.options.showCursorWhenSelecting) {
|
||||
drawSelectionCursor(cm, range.head, curFragment);
|
||||
}
|
||||
if (!collapsed)
|
||||
{ drawSelectionRange(cm, range, selFragment); }
|
||||
}
|
||||
@@ -3174,7 +3182,8 @@
|
||||
|
||||
if (/\bcm-fat-cursor\b/.test(cm.getWrapperElement().className)) {
|
||||
var charPos = charCoords(cm, head, "div", null, null);
|
||||
cursor.style.width = Math.max(0, charPos.right - charPos.left) + "px";
|
||||
var width = charPos.right - charPos.left;
|
||||
cursor.style.width = (width > 0 ? width : cm.defaultCharWidth()) + "px";
|
||||
}
|
||||
|
||||
if (pos.other) {
|
||||
@@ -3349,10 +3358,14 @@
|
||||
function updateHeightsInViewport(cm) {
|
||||
var display = cm.display;
|
||||
var prevBottom = display.lineDiv.offsetTop;
|
||||
var viewTop = Math.max(0, display.scroller.getBoundingClientRect().top);
|
||||
var oldHeight = display.lineDiv.getBoundingClientRect().top;
|
||||
var mustScroll = 0;
|
||||
for (var i = 0; i < display.view.length; i++) {
|
||||
var cur = display.view[i], wrapping = cm.options.lineWrapping;
|
||||
var height = (void 0), width = 0;
|
||||
if (cur.hidden) { continue }
|
||||
oldHeight += cur.line.height;
|
||||
if (ie && ie_version < 8) {
|
||||
var bot = cur.node.offsetTop + cur.node.offsetHeight;
|
||||
height = bot - prevBottom;
|
||||
@@ -3367,6 +3380,7 @@
|
||||
}
|
||||
var diff = cur.line.height - height;
|
||||
if (diff > .005 || diff < -.005) {
|
||||
if (oldHeight < viewTop) { mustScroll -= diff; }
|
||||
updateLineHeight(cur.line, height);
|
||||
updateWidgetHeight(cur.line);
|
||||
if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
|
||||
@@ -3381,6 +3395,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; }
|
||||
}
|
||||
|
||||
// Read and store the height of line widgets associated with the
|
||||
@@ -3641,6 +3656,7 @@
|
||||
this.vert.firstChild.style.height =
|
||||
Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
|
||||
} else {
|
||||
this.vert.scrollTop = 0;
|
||||
this.vert.style.display = "";
|
||||
this.vert.firstChild.style.height = "0";
|
||||
}
|
||||
@@ -4492,6 +4508,12 @@
|
||||
|
||||
function onScrollWheel(cm, e) {
|
||||
var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
|
||||
var pixelsPerUnit = wheelPixelsPerUnit;
|
||||
if (e.deltaMode === 0) {
|
||||
dx = e.deltaX;
|
||||
dy = e.deltaY;
|
||||
pixelsPerUnit = 1;
|
||||
}
|
||||
|
||||
var display = cm.display, scroll = display.scroller;
|
||||
// Quit if there's nothing to scroll here
|
||||
@@ -4520,10 +4542,10 @@
|
||||
// estimated pixels/delta value, we just handle horizontal
|
||||
// scrolling entirely here. It'll be slightly off from native, but
|
||||
// better than glitching out.
|
||||
if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
|
||||
if (dx && !gecko && !presto && pixelsPerUnit != null) {
|
||||
if (dy && canScrollY)
|
||||
{ updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); }
|
||||
setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit));
|
||||
{ updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * pixelsPerUnit)); }
|
||||
setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * pixelsPerUnit));
|
||||
// Only prevent default scrolling if vertical scrolling is
|
||||
// actually possible. Otherwise, it causes vertical scroll
|
||||
// jitter on OSX trackpads when deltaX is small and deltaY
|
||||
@@ -4536,15 +4558,15 @@
|
||||
|
||||
// 'Project' the visible viewport to cover the area that is being
|
||||
// scrolled into view (if we know enough to estimate it).
|
||||
if (dy && wheelPixelsPerUnit != null) {
|
||||
var pixels = dy * wheelPixelsPerUnit;
|
||||
if (dy && pixelsPerUnit != null) {
|
||||
var pixels = dy * pixelsPerUnit;
|
||||
var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
|
||||
if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
|
||||
else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
|
||||
updateDisplaySimple(cm, {top: top, bottom: bot});
|
||||
}
|
||||
|
||||
if (wheelSamples < 20) {
|
||||
if (wheelSamples < 20 && e.deltaMode !== 0) {
|
||||
if (display.wheelStartX == null) {
|
||||
display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
|
||||
display.wheelDX = dx; display.wheelDY = dy;
|
||||
@@ -8221,7 +8243,7 @@
|
||||
}
|
||||
|
||||
function hiddenTextarea() {
|
||||
var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");
|
||||
var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none");
|
||||
var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
|
||||
// The textarea is kept positioned near the cursor to prevent the
|
||||
// fact that it'll be scrolled into view on input from scrolling
|
||||
@@ -8985,9 +9007,11 @@
|
||||
ContentEditableInput.prototype.supportsTouch = function () { return true };
|
||||
|
||||
ContentEditableInput.prototype.receivedFocus = function () {
|
||||
var this$1 = this;
|
||||
|
||||
var input = this;
|
||||
if (this.selectionInEditor())
|
||||
{ this.pollSelection(); }
|
||||
{ setTimeout(function () { return this$1.pollSelection(); }, 20); }
|
||||
else
|
||||
{ runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }
|
||||
|
||||
@@ -9816,7 +9840,7 @@
|
||||
|
||||
addLegacyProps(CodeMirror);
|
||||
|
||||
CodeMirror.version = "5.62.3";
|
||||
CodeMirror.version = "5.64.0";
|
||||
|
||||
return CodeMirror;
|
||||
|
||||
|
||||
343
plugins/codemirror/keymap/vim.js
vendored
343
plugins/codemirror/keymap/vim.js
vendored
@@ -44,6 +44,27 @@
|
||||
})(function(CodeMirror) {
|
||||
'use strict';
|
||||
|
||||
var Pos = CodeMirror.Pos;
|
||||
|
||||
function transformCursor(cm, range) {
|
||||
var vim = cm.state.vim;
|
||||
if (!vim || vim.insertMode) return range.head;
|
||||
var head = vim.sel.head;
|
||||
if (!head) return range.head;
|
||||
|
||||
if (vim.visualBlock) {
|
||||
if (range.head.line != head.line) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (range.from() == range.anchor && !range.empty()) {
|
||||
if (range.head.line == head.line && range.head.ch != head.ch)
|
||||
return new Pos(range.head.line, range.head.ch - 1);
|
||||
}
|
||||
|
||||
return range.head;
|
||||
}
|
||||
|
||||
var defaultKeymap = [
|
||||
// Key to key mapping. This goes first to make it possible to override
|
||||
// existing mappings.
|
||||
@@ -154,6 +175,7 @@
|
||||
{ keys: 'C', type: 'operator', operator: 'change', operatorArgs: { linewise: true }, context: 'visual'},
|
||||
{ keys: '~', type: 'operatorMotion', operator: 'changeCase', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorArgs: { shouldMoveCursor: true }, context: 'normal'},
|
||||
{ keys: '~', type: 'operator', operator: 'changeCase', context: 'visual'},
|
||||
{ keys: '<C-u>', type: 'operatorMotion', operator: 'delete', motion: 'moveToStartOfLine', context: 'insert' },
|
||||
{ keys: '<C-w>', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' },
|
||||
//ignore C-w in normal mode
|
||||
{ keys: '<C-w>', type: 'idle', context: 'normal' },
|
||||
@@ -248,8 +270,6 @@
|
||||
{ name: 'global', shortName: 'g' }
|
||||
];
|
||||
|
||||
var Pos = CodeMirror.Pos;
|
||||
|
||||
var Vim = function() {
|
||||
function enterVimMode(cm) {
|
||||
cm.setOption('disableInput', true);
|
||||
@@ -265,15 +285,13 @@
|
||||
cm.off('cursorActivity', onCursorActivity);
|
||||
CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm));
|
||||
cm.state.vim = null;
|
||||
if (highlightTimeout) clearTimeout(highlightTimeout);
|
||||
}
|
||||
|
||||
function detachVimMap(cm, next) {
|
||||
if (this == CodeMirror.keyMap.vim) {
|
||||
cm.options.$customCursor = null;
|
||||
CodeMirror.rmClass(cm.getWrapperElement(), "cm-fat-cursor");
|
||||
if (cm.getOption("inputStyle") == "contenteditable" && document.body.style.caretColor != null) {
|
||||
disableFatCursorMark(cm);
|
||||
cm.getInputField().style.caretColor = "";
|
||||
}
|
||||
}
|
||||
|
||||
if (!next || next.attach != attachVimMap)
|
||||
@@ -281,57 +299,15 @@
|
||||
}
|
||||
function attachVimMap(cm, prev) {
|
||||
if (this == CodeMirror.keyMap.vim) {
|
||||
if (cm.curOp) cm.curOp.selectionChanged = true;
|
||||
cm.options.$customCursor = transformCursor;
|
||||
CodeMirror.addClass(cm.getWrapperElement(), "cm-fat-cursor");
|
||||
if (cm.getOption("inputStyle") == "contenteditable" && document.body.style.caretColor != null) {
|
||||
enableFatCursorMark(cm);
|
||||
cm.getInputField().style.caretColor = "transparent";
|
||||
}
|
||||
}
|
||||
|
||||
if (!prev || prev.attach != attachVimMap)
|
||||
enterVimMode(cm);
|
||||
}
|
||||
|
||||
function updateFatCursorMark(cm) {
|
||||
if (!cm.state.fatCursorMarks) return;
|
||||
clearFatCursorMark(cm);
|
||||
var ranges = cm.listSelections(), result = []
|
||||
for (var i = 0; i < ranges.length; i++) {
|
||||
var range = ranges[i];
|
||||
if (range.empty()) {
|
||||
var lineLength = cm.getLine(range.anchor.line).length;
|
||||
if (range.anchor.ch < lineLength) {
|
||||
result.push(cm.markText(range.anchor, Pos(range.anchor.line, range.anchor.ch + 1),
|
||||
{className: "cm-fat-cursor-mark"}));
|
||||
} else {
|
||||
result.push(cm.markText(Pos(range.anchor.line, lineLength - 1),
|
||||
Pos(range.anchor.line, lineLength),
|
||||
{className: "cm-fat-cursor-mark"}));
|
||||
}
|
||||
}
|
||||
}
|
||||
cm.state.fatCursorMarks = result;
|
||||
}
|
||||
|
||||
function clearFatCursorMark(cm) {
|
||||
var marks = cm.state.fatCursorMarks;
|
||||
if (marks) for (var i = 0; i < marks.length; i++) marks[i].clear();
|
||||
}
|
||||
|
||||
function enableFatCursorMark(cm) {
|
||||
cm.state.fatCursorMarks = [];
|
||||
updateFatCursorMark(cm)
|
||||
cm.on("cursorActivity", updateFatCursorMark)
|
||||
}
|
||||
|
||||
function disableFatCursorMark(cm) {
|
||||
clearFatCursorMark(cm);
|
||||
cm.off("cursorActivity", updateFatCursorMark);
|
||||
// explicitly set fatCursorMarks to null because event listener above
|
||||
// can be invoke after removing it, if off is called from operation
|
||||
cm.state.fatCursorMarks = null;
|
||||
}
|
||||
|
||||
// Deprecated, simply setting the keymap works again.
|
||||
CodeMirror.defineOption('vimMode', false, function(cm, val, prev) {
|
||||
if (val && cm.getOption("keyMap") != "vim")
|
||||
@@ -347,7 +323,7 @@
|
||||
if (!vimKey) {
|
||||
return false;
|
||||
}
|
||||
var cmd = CodeMirror.Vim.findKey(cm, vimKey);
|
||||
var cmd = vimApi.findKey(cm, vimKey);
|
||||
if (typeof cmd == 'function') {
|
||||
CodeMirror.signal(cm, 'vim-keypress', vimKey);
|
||||
}
|
||||
@@ -691,8 +667,6 @@
|
||||
// executed in between.
|
||||
lastMotion: null,
|
||||
marks: {},
|
||||
// Mark for rendering fake cursor for visual mode.
|
||||
fakeCursor: null,
|
||||
insertMode: false,
|
||||
// Repeat count for changes made in insert mode, triggered by key
|
||||
// sequences like 3,i. Only exists when insertMode is true.
|
||||
@@ -764,7 +738,7 @@
|
||||
exCommandDispatcher.map(lhs, rhs, ctx);
|
||||
},
|
||||
unmap: function(lhs, ctx) {
|
||||
exCommandDispatcher.unmap(lhs, ctx);
|
||||
return exCommandDispatcher.unmap(lhs, ctx);
|
||||
},
|
||||
// Non-recursive map function.
|
||||
// NOTE: This will not create mappings to key maps that aren't present
|
||||
@@ -904,7 +878,7 @@
|
||||
match = (/<\w+-.+?>|<\w+>|./).exec(keys);
|
||||
key = match[0];
|
||||
keys = keys.substring(match.index + key.length);
|
||||
CodeMirror.Vim.handleKey(cm, key, 'mapping');
|
||||
vimApi.handleKey(cm, key, 'mapping');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -951,7 +925,12 @@
|
||||
if (!keysMatcher) { clearInputState(cm); return false; }
|
||||
var context = vim.visualMode ? 'visual' :
|
||||
'normal';
|
||||
var match = commandDispatcher.matchCommand(keysMatcher[2] || keysMatcher[1], defaultKeymap, vim.inputState, context);
|
||||
var mainKey = keysMatcher[2] || keysMatcher[1];
|
||||
if (vim.inputState.operatorShortcut && vim.inputState.operatorShortcut.slice(-1) == mainKey) {
|
||||
// multikey operators act linewise by repeating only the last character
|
||||
mainKey = vim.inputState.operatorShortcut;
|
||||
}
|
||||
var match = commandDispatcher.matchCommand(mainKey, defaultKeymap, vim.inputState, context);
|
||||
if (match.type == 'none') { clearInputState(cm); return false; }
|
||||
else if (match.type == 'partial') { return true; }
|
||||
|
||||
@@ -987,7 +966,7 @@
|
||||
// clear VIM state in case it's in a bad state.
|
||||
cm.state.vim = undefined;
|
||||
maybeInitVimState(cm);
|
||||
if (!CodeMirror.Vim.suppressErrorLogging) {
|
||||
if (!vimApi.suppressErrorLogging) {
|
||||
console['log'](e);
|
||||
}
|
||||
throw e;
|
||||
@@ -1311,6 +1290,9 @@
|
||||
}
|
||||
inputState.operator = command.operator;
|
||||
inputState.operatorArgs = copyArgs(command.operatorArgs);
|
||||
if (command.keys.length > 1) {
|
||||
inputState.operatorShortcut = command.keys;
|
||||
}
|
||||
if (command.exitVisualBlock) {
|
||||
vim.visualBlock = false;
|
||||
updateCmSelection(cm);
|
||||
@@ -1639,17 +1621,17 @@
|
||||
var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch);
|
||||
if (lastSel.visualLine) {
|
||||
// Linewise Visual mode: The same number of lines.
|
||||
newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch);
|
||||
newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch);
|
||||
} else if (lastSel.visualBlock) {
|
||||
// Blockwise Visual mode: The same number of lines and columns.
|
||||
newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset);
|
||||
newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset);
|
||||
} else if (lastSel.head.line == lastSel.anchor.line) {
|
||||
// Normal Visual mode within one line: The same number of characters.
|
||||
newHead = Pos(oldAnchor.line, oldAnchor.ch + chOffset);
|
||||
newHead = new Pos(oldAnchor.line, oldAnchor.ch + chOffset);
|
||||
} else {
|
||||
// Normal Visual mode with several lines: The same number of lines, in the
|
||||
// last line the same number of characters as in the last line the last time.
|
||||
newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch);
|
||||
newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch);
|
||||
}
|
||||
vim.visualMode = true;
|
||||
vim.visualLine = lastSel.visualLine;
|
||||
@@ -1689,7 +1671,7 @@
|
||||
ranges[i].head.ch = lineLength(cm, ranges[i].head.line);
|
||||
}
|
||||
} else if (mode == 'line') {
|
||||
ranges[0].head = Pos(ranges[0].head.line + 1, 0);
|
||||
ranges[0].head = new Pos(ranges[0].head.line + 1, 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1751,22 +1733,22 @@
|
||||
var motions = {
|
||||
moveToTopLine: function(cm, _head, motionArgs) {
|
||||
var line = getUserVisibleLines(cm).top + motionArgs.repeat -1;
|
||||
return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));
|
||||
return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));
|
||||
},
|
||||
moveToMiddleLine: function(cm) {
|
||||
var range = getUserVisibleLines(cm);
|
||||
var line = Math.floor((range.top + range.bottom) * 0.5);
|
||||
return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));
|
||||
return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));
|
||||
},
|
||||
moveToBottomLine: function(cm, _head, motionArgs) {
|
||||
var line = getUserVisibleLines(cm).bottom - motionArgs.repeat +1;
|
||||
return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));
|
||||
return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));
|
||||
},
|
||||
expandToLine: function(_cm, head, motionArgs) {
|
||||
// Expands forward to end of line, and then to next line if repeat is
|
||||
// >1. Does not handle backward motion!
|
||||
var cur = head;
|
||||
return Pos(cur.line + motionArgs.repeat - 1, Infinity);
|
||||
return new Pos(cur.line + motionArgs.repeat - 1, Infinity);
|
||||
},
|
||||
findNext: function(cm, _head, motionArgs) {
|
||||
var state = getSearchState(cm);
|
||||
@@ -1823,7 +1805,7 @@
|
||||
// For whatever reason, when we use the "to" as returned by searchcursor.js directly,
|
||||
// the resulting selection is extended by 1 char. Let's shrink it so that only the
|
||||
// match is selected.
|
||||
var to = Pos(next[1].line, next[1].ch - 1);
|
||||
var to = new Pos(next[1].line, next[1].ch - 1);
|
||||
|
||||
if (vim.visualMode) {
|
||||
// If we were in visualLine or visualBlock mode, get out of it.
|
||||
@@ -1872,8 +1854,8 @@
|
||||
if (vim.visualBlock && motionArgs.sameLine) {
|
||||
var sel = vim.sel;
|
||||
return [
|
||||
clipCursorToContent(cm, Pos(sel.anchor.line, sel.head.ch)),
|
||||
clipCursorToContent(cm, Pos(sel.head.line, sel.anchor.ch))
|
||||
clipCursorToContent(cm, new Pos(sel.anchor.line, sel.head.ch)),
|
||||
clipCursorToContent(cm, new Pos(sel.head.line, sel.anchor.ch))
|
||||
];
|
||||
} else {
|
||||
return ([vim.sel.head, vim.sel.anchor]);
|
||||
@@ -1913,7 +1895,7 @@
|
||||
// Vim places the cursor on the first non-whitespace character of
|
||||
// the line if there is one, else it places the cursor at the end
|
||||
// of the line, regardless of whether a mark was found.
|
||||
best = Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line)));
|
||||
best = new Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line)));
|
||||
}
|
||||
return best;
|
||||
},
|
||||
@@ -1921,7 +1903,7 @@
|
||||
var cur = head;
|
||||
var repeat = motionArgs.repeat;
|
||||
var ch = motionArgs.forward ? cur.ch + repeat : cur.ch - repeat;
|
||||
return Pos(cur.line, ch);
|
||||
return new Pos(cur.line, ch);
|
||||
},
|
||||
moveByLines: function(cm, head, motionArgs, vim) {
|
||||
var cur = head;
|
||||
@@ -1963,8 +1945,8 @@
|
||||
endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line));
|
||||
vim.lastHPos = endCh;
|
||||
}
|
||||
vim.lastHSPos = cm.charCoords(Pos(line, endCh),'div').left;
|
||||
return Pos(line, endCh);
|
||||
vim.lastHSPos = cm.charCoords(new Pos(line, endCh),'div').left;
|
||||
return new Pos(line, endCh);
|
||||
},
|
||||
moveByDisplayLines: function(cm, head, motionArgs, vim) {
|
||||
var cur = head;
|
||||
@@ -1986,7 +1968,7 @@
|
||||
var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos };
|
||||
var res = cm.coordsChar(goalCoords, 'div');
|
||||
} else {
|
||||
var resCoords = cm.charCoords(Pos(cm.firstLine(), 0), 'div');
|
||||
var resCoords = cm.charCoords(new Pos(cm.firstLine(), 0), 'div');
|
||||
resCoords.left = vim.lastHSPos;
|
||||
res = cm.coordsChar(resCoords, 'div');
|
||||
}
|
||||
@@ -2066,7 +2048,7 @@
|
||||
// Go to the start of the line where the text begins, or the end for
|
||||
// whitespace-only lines
|
||||
var cursor = head;
|
||||
return Pos(cursor.line,
|
||||
return new Pos(cursor.line,
|
||||
findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line)));
|
||||
},
|
||||
moveToMatchedSymbol: function(cm, head) {
|
||||
@@ -2078,7 +2060,7 @@
|
||||
for (; ch < lineText.length; ch++) {
|
||||
symbol = lineText.charAt(ch);
|
||||
if (symbol && isMatchableSymbol(symbol)) {
|
||||
var style = cm.getTokenTypeAt(Pos(line, ch + 1));
|
||||
var style = cm.getTokenTypeAt(new Pos(line, ch + 1));
|
||||
if (style !== "string" && style !== "comment") {
|
||||
break;
|
||||
}
|
||||
@@ -2087,21 +2069,21 @@
|
||||
if (ch < lineText.length) {
|
||||
// Only include angle brackets in analysis if they are being matched.
|
||||
var re = (ch === '<' || ch === '>') ? /[(){}[\]<>]/ : /[(){}[\]]/;
|
||||
var matched = cm.findMatchingBracket(Pos(line, ch), {bracketRegex: re});
|
||||
var matched = cm.findMatchingBracket(new Pos(line, ch), {bracketRegex: re});
|
||||
return matched.to;
|
||||
} else {
|
||||
return cursor;
|
||||
}
|
||||
},
|
||||
moveToStartOfLine: function(_cm, head) {
|
||||
return Pos(head.line, 0);
|
||||
return new Pos(head.line, 0);
|
||||
},
|
||||
moveToLineOrEdgeOfDocument: function(cm, _head, motionArgs) {
|
||||
var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine();
|
||||
if (motionArgs.repeatIsExplicit) {
|
||||
lineNum = motionArgs.repeat - cm.getOption('firstLineNumber');
|
||||
}
|
||||
return Pos(lineNum,
|
||||
return new Pos(lineNum,
|
||||
findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum)));
|
||||
},
|
||||
textObjectManipulation: function(cm, head, motionArgs, vim) {
|
||||
@@ -2264,7 +2246,7 @@
|
||||
if (anchor.line == cm.firstLine()) {
|
||||
anchor.ch = 0;
|
||||
} else {
|
||||
anchor = Pos(anchor.line - 1, lineLength(cm, anchor.line - 1));
|
||||
anchor = new Pos(anchor.line - 1, lineLength(cm, anchor.line - 1));
|
||||
}
|
||||
}
|
||||
text = cm.getRange(anchor, head);
|
||||
@@ -2277,7 +2259,7 @@
|
||||
text = cm.getSelection();
|
||||
var replacement = fillArray('', ranges.length);
|
||||
cm.replaceSelections(replacement);
|
||||
finalHead = ranges[0].anchor;
|
||||
finalHead = cursorMin(ranges[0].head, ranges[0].anchor);
|
||||
}
|
||||
vimGlobalState.registerController.pushText(
|
||||
args.registerName, 'delete', text,
|
||||
@@ -2411,7 +2393,7 @@
|
||||
},
|
||||
scrollToCursor: function(cm, actionArgs) {
|
||||
var lineNum = cm.getCursor().line;
|
||||
var charCoords = cm.charCoords(Pos(lineNum, 0), 'local');
|
||||
var charCoords = cm.charCoords(new Pos(lineNum, 0), 'local');
|
||||
var height = cm.getScrollInfo().clientHeight;
|
||||
var y = charCoords.top;
|
||||
var lineHeight = charCoords.bottom - y;
|
||||
@@ -2463,9 +2445,9 @@
|
||||
var head = actionArgs.head || cm.getCursor('head');
|
||||
var height = cm.listSelections().length;
|
||||
if (insertAt == 'eol') {
|
||||
head = Pos(head.line, lineLength(cm, head.line));
|
||||
head = new Pos(head.line, lineLength(cm, head.line));
|
||||
} else if (insertAt == 'bol') {
|
||||
head = Pos(head.line, 0);
|
||||
head = new Pos(head.line, 0);
|
||||
} else if (insertAt == 'charAfter') {
|
||||
head = offsetCursor(head, 0, 1);
|
||||
} else if (insertAt == 'firstNonBlank') {
|
||||
@@ -2477,10 +2459,10 @@
|
||||
if (sel.head.line < sel.anchor.line) {
|
||||
head = sel.head;
|
||||
} else {
|
||||
head = Pos(sel.anchor.line, 0);
|
||||
head = new Pos(sel.anchor.line, 0);
|
||||
}
|
||||
} else {
|
||||
head = Pos(
|
||||
head = new Pos(
|
||||
Math.min(sel.head.line, sel.anchor.line),
|
||||
Math.min(sel.head.ch, sel.anchor.ch));
|
||||
height = Math.abs(sel.head.line - sel.anchor.line) + 1;
|
||||
@@ -2492,12 +2474,12 @@
|
||||
if (sel.head.line >= sel.anchor.line) {
|
||||
head = offsetCursor(sel.head, 0, 1);
|
||||
} else {
|
||||
head = Pos(sel.anchor.line, 0);
|
||||
head = new Pos(sel.anchor.line, 0);
|
||||
}
|
||||
} else {
|
||||
head = Pos(
|
||||
head = new Pos(
|
||||
Math.min(sel.head.line, sel.anchor.line),
|
||||
Math.max(sel.head.ch + 1, sel.anchor.ch));
|
||||
Math.max(sel.head.ch, sel.anchor.ch) + 1);
|
||||
height = Math.abs(sel.head.line - sel.anchor.line) + 1;
|
||||
}
|
||||
} else if (insertAt == 'inplace') {
|
||||
@@ -2541,7 +2523,7 @@
|
||||
vim.visualLine = !!actionArgs.linewise;
|
||||
vim.visualBlock = !!actionArgs.blockwise;
|
||||
head = clipCursorToContent(
|
||||
cm, Pos(anchor.line, anchor.ch + repeat - 1));
|
||||
cm, new Pos(anchor.line, anchor.ch + repeat - 1));
|
||||
vim.sel = {
|
||||
anchor: anchor,
|
||||
head: head
|
||||
@@ -2604,13 +2586,13 @@
|
||||
// Repeat is the number of lines to join. Minimum 2 lines.
|
||||
var repeat = Math.max(actionArgs.repeat, 2);
|
||||
curStart = cm.getCursor();
|
||||
curEnd = clipCursorToContent(cm, Pos(curStart.line + repeat - 1,
|
||||
curEnd = clipCursorToContent(cm, new Pos(curStart.line + repeat - 1,
|
||||
Infinity));
|
||||
}
|
||||
var finalCh = 0;
|
||||
for (var i = curStart.line; i < curEnd.line; i++) {
|
||||
finalCh = lineLength(cm, curStart.line);
|
||||
var tmp = Pos(curStart.line + 1,
|
||||
var tmp = new Pos(curStart.line + 1,
|
||||
lineLength(cm, curStart.line + 1));
|
||||
var text = cm.getRange(curStart, tmp);
|
||||
text = actionArgs.keepSpaces
|
||||
@@ -2618,7 +2600,7 @@
|
||||
: text.replace(/\n\s*/g, ' ');
|
||||
cm.replaceRange(text, curStart, tmp);
|
||||
}
|
||||
var curFinalPos = Pos(curStart.line, finalCh);
|
||||
var curFinalPos = new Pos(curStart.line, finalCh);
|
||||
if (vim.visualMode) {
|
||||
exitVisualMode(cm, false);
|
||||
}
|
||||
@@ -2629,7 +2611,7 @@
|
||||
var insertAt = copyCursor(cm.getCursor());
|
||||
if (insertAt.line === cm.firstLine() && !actionArgs.after) {
|
||||
// Special case for inserting newline before start of document.
|
||||
cm.replaceRange('\n', Pos(cm.firstLine(), 0));
|
||||
cm.replaceRange('\n', new Pos(cm.firstLine(), 0));
|
||||
cm.setCursor(cm.firstLine(), 0);
|
||||
} else {
|
||||
insertAt.line = (actionArgs.after) ? insertAt.line :
|
||||
@@ -2730,7 +2712,7 @@
|
||||
// first delete the selected text
|
||||
cm.replaceSelections(emptyStrings);
|
||||
// Set new selections as per the block length of the yanked text
|
||||
selectionEnd = Pos(selectionStart.line + text.length-1, selectionStart.ch);
|
||||
selectionEnd = new Pos(selectionStart.line + text.length-1, selectionStart.ch);
|
||||
cm.setCursor(selectionStart);
|
||||
selectBlock(cm, selectionEnd);
|
||||
cm.replaceSelections(text);
|
||||
@@ -2757,7 +2739,7 @@
|
||||
for (var i = 0; i < text.length; i++) {
|
||||
var line = cur.line+i;
|
||||
if (line > cm.lastLine()) {
|
||||
cm.replaceRange('\n', Pos(line, 0));
|
||||
cm.replaceRange('\n', new Pos(line, 0));
|
||||
}
|
||||
var lastCh = lineLength(cm, line);
|
||||
if (lastCh < cur.ch) {
|
||||
@@ -2765,18 +2747,18 @@
|
||||
}
|
||||
}
|
||||
cm.setCursor(cur);
|
||||
selectBlock(cm, Pos(cur.line + text.length-1, cur.ch));
|
||||
selectBlock(cm, new Pos(cur.line + text.length-1, cur.ch));
|
||||
cm.replaceSelections(text);
|
||||
curPosFinal = cur;
|
||||
} else {
|
||||
cm.replaceRange(text, cur);
|
||||
// Now fine tune the cursor to where we want it.
|
||||
if (linewise && actionArgs.after) {
|
||||
curPosFinal = Pos(
|
||||
curPosFinal = new Pos(
|
||||
cur.line + 1,
|
||||
findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1)));
|
||||
} else if (linewise && !actionArgs.after) {
|
||||
curPosFinal = Pos(
|
||||
curPosFinal = new Pos(
|
||||
cur.line,
|
||||
findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line)));
|
||||
} else if (!linewise && actionArgs.after) {
|
||||
@@ -2824,7 +2806,7 @@
|
||||
if (replaceTo > line.length) {
|
||||
replaceTo=line.length;
|
||||
}
|
||||
curEnd = Pos(curStart.line, replaceTo);
|
||||
curEnd = new Pos(curStart.line, replaceTo);
|
||||
}
|
||||
if (replaceWith=='\n') {
|
||||
if (!vim.visualMode) cm.replaceRange('', curStart, curEnd);
|
||||
@@ -2880,13 +2862,13 @@
|
||||
} else {
|
||||
numberStr = baseStr + zeroPadding + numberStr;
|
||||
}
|
||||
var from = Pos(cur.line, start);
|
||||
var to = Pos(cur.line, end);
|
||||
var from = new Pos(cur.line, start);
|
||||
var to = new Pos(cur.line, end);
|
||||
cm.replaceRange(numberStr, from, to);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
cm.setCursor(Pos(cur.line, start + numberStr.length - 1));
|
||||
cm.setCursor(new Pos(cur.line, start + numberStr.length - 1));
|
||||
},
|
||||
repeatLastEdit: function(cm, actionArgs, vim) {
|
||||
var lastEditInputState = vim.lastEditInputState;
|
||||
@@ -2923,7 +2905,7 @@
|
||||
var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() );
|
||||
var maxCh = lineLength(cm, line) - 1 + !!includeLineBreak;
|
||||
var ch = Math.min(Math.max(0, cur.ch), maxCh);
|
||||
return Pos(line, ch);
|
||||
return new Pos(line, ch);
|
||||
}
|
||||
function copyArgs(args) {
|
||||
var ret = {};
|
||||
@@ -2939,7 +2921,7 @@
|
||||
offsetCh = offsetLine.ch;
|
||||
offsetLine = offsetLine.line;
|
||||
}
|
||||
return Pos(cur.line + offsetLine, cur.ch + offsetCh);
|
||||
return new Pos(cur.line + offsetLine, cur.ch + offsetCh);
|
||||
}
|
||||
function commandMatches(keys, keyMap, context, inputState) {
|
||||
// Partial matches are not applied. They inform the key handler
|
||||
@@ -2999,7 +2981,7 @@
|
||||
};
|
||||
}
|
||||
function copyCursor(cur) {
|
||||
return Pos(cur.line, cur.ch);
|
||||
return new Pos(cur.line, cur.ch);
|
||||
}
|
||||
function cursorEqual(cur1, cur2) {
|
||||
return cur1.ch == cur2.ch && cur1.line == cur2.line;
|
||||
@@ -3046,7 +3028,7 @@
|
||||
function extendLineToColumn(cm, lineNum, column) {
|
||||
var endCh = lineLength(cm, lineNum);
|
||||
var spaces = new Array(column-endCh+1).join(' ');
|
||||
cm.setCursor(Pos(lineNum, endCh));
|
||||
cm.setCursor(new Pos(lineNum, endCh));
|
||||
cm.replaceRange(spaces, cm.getCursor());
|
||||
}
|
||||
// This functions selects a rectangular block
|
||||
@@ -3127,13 +3109,13 @@
|
||||
if (block) {
|
||||
var width = block.width;
|
||||
var height = block.height;
|
||||
selectionEnd = Pos(selectionStart.line + height, selectionStart.ch + width);
|
||||
selectionEnd = new Pos(selectionStart.line + height, selectionStart.ch + width);
|
||||
var selections = [];
|
||||
// selectBlock creates a 'proper' rectangular block.
|
||||
// We do not want that in all cases, so we manually set selections.
|
||||
for (var i = selectionStart.line; i < selectionEnd.line; i++) {
|
||||
var anchor = Pos(i, selectionStart.ch);
|
||||
var head = Pos(i, selectionEnd.ch);
|
||||
var anchor = new Pos(i, selectionStart.ch);
|
||||
var head = new Pos(i, selectionEnd.ch);
|
||||
var range = {anchor: anchor, head: head};
|
||||
selections.push(range);
|
||||
}
|
||||
@@ -3145,8 +3127,8 @@
|
||||
var ch = end.ch - start.ch;
|
||||
selectionEnd = {line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch};
|
||||
if (lastSelection.visualLine) {
|
||||
selectionStart = Pos(selectionStart.line, 0);
|
||||
selectionEnd = Pos(selectionEnd.line, lineLength(cm, selectionEnd.line));
|
||||
selectionStart = new Pos(selectionStart.line, 0);
|
||||
selectionEnd = new Pos(selectionEnd.line, lineLength(cm, selectionEnd.line));
|
||||
}
|
||||
cm.setSelection(selectionStart, selectionEnd);
|
||||
}
|
||||
@@ -3195,7 +3177,7 @@
|
||||
head = cursorMax(head, end);
|
||||
head = offsetCursor(head, 0, -1);
|
||||
if (head.ch == -1 && head.line != cm.firstLine()) {
|
||||
head = Pos(head.line - 1, lineLength(cm, head.line - 1));
|
||||
head = new Pos(head.line - 1, lineLength(cm, head.line - 1));
|
||||
}
|
||||
}
|
||||
return [anchor, head];
|
||||
@@ -3211,7 +3193,6 @@
|
||||
vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char';
|
||||
var cmSel = makeCmSelection(cm, sel, mode);
|
||||
cm.setSelections(cmSel.ranges, cmSel.primary);
|
||||
updateFakeCursor(cm);
|
||||
}
|
||||
function makeCmSelection(cm, sel, mode, exclusive) {
|
||||
var head = copyCursor(sel.head);
|
||||
@@ -3244,16 +3225,18 @@
|
||||
};
|
||||
} else if (mode == 'block') {
|
||||
var top = Math.min(anchor.line, head.line),
|
||||
left = Math.min(anchor.ch, head.ch),
|
||||
fromCh = anchor.ch,
|
||||
bottom = Math.max(anchor.line, head.line),
|
||||
right = Math.max(anchor.ch, head.ch) + 1;
|
||||
toCh = head.ch;
|
||||
if (fromCh < toCh) { toCh += 1 }
|
||||
else { fromCh += 1 };
|
||||
var height = bottom - top + 1;
|
||||
var primary = head.line == top ? 0 : height - 1;
|
||||
var ranges = [];
|
||||
for (var i = 0; i < height; i++) {
|
||||
ranges.push({
|
||||
anchor: Pos(top + i, left),
|
||||
head: Pos(top + i, right)
|
||||
anchor: new Pos(top + i, fromCh),
|
||||
head: new Pos(top + i, toCh)
|
||||
});
|
||||
}
|
||||
return {
|
||||
@@ -3287,7 +3270,6 @@
|
||||
vim.visualLine = false;
|
||||
vim.visualBlock = false;
|
||||
if (!vim.insertMode) CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"});
|
||||
clearFakeCursor(vim);
|
||||
}
|
||||
|
||||
// Remove any trailing newlines from the selection. For
|
||||
@@ -3375,7 +3357,7 @@
|
||||
if (!start) { start = wordStart; }
|
||||
}
|
||||
}
|
||||
return { start: Pos(cur.line, start), end: Pos(cur.line, end) };
|
||||
return { start: new Pos(cur.line, start), end: new Pos(cur.line, end) };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3549,7 +3531,7 @@
|
||||
}
|
||||
}
|
||||
if (state.nextCh || state.curMoveThrough) {
|
||||
return Pos(line, state.index);
|
||||
return new Pos(line, state.index);
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
@@ -3661,7 +3643,7 @@
|
||||
break;
|
||||
}
|
||||
words.push(word);
|
||||
cur = Pos(word.line, forward ? (word.to - 1) : word.from);
|
||||
cur = new Pos(word.line, forward ? (word.to - 1) : word.from);
|
||||
}
|
||||
var shortCircuit = words.length != repeat;
|
||||
var firstWord = words[0];
|
||||
@@ -3672,25 +3654,25 @@
|
||||
// We did not start in the middle of a word. Discard the extra word at the end.
|
||||
lastWord = words.pop();
|
||||
}
|
||||
return Pos(lastWord.line, lastWord.from);
|
||||
return new Pos(lastWord.line, lastWord.from);
|
||||
} else if (forward && wordEnd) {
|
||||
return Pos(lastWord.line, lastWord.to - 1);
|
||||
return new Pos(lastWord.line, lastWord.to - 1);
|
||||
} else if (!forward && wordEnd) {
|
||||
// ge
|
||||
if (!shortCircuit && (firstWord.to != curStart.ch || firstWord.line != curStart.line)) {
|
||||
// We did not start in the middle of a word. Discard the extra word at the end.
|
||||
lastWord = words.pop();
|
||||
}
|
||||
return Pos(lastWord.line, lastWord.to);
|
||||
return new Pos(lastWord.line, lastWord.to);
|
||||
} else {
|
||||
// b
|
||||
return Pos(lastWord.line, lastWord.from);
|
||||
return new Pos(lastWord.line, lastWord.from);
|
||||
}
|
||||
}
|
||||
|
||||
function moveToEol(cm, head, motionArgs, vim, keepHPos) {
|
||||
var cur = head;
|
||||
var retval= Pos(cur.line + motionArgs.repeat - 1, Infinity);
|
||||
var retval= new Pos(cur.line + motionArgs.repeat - 1, Infinity);
|
||||
var end=cm.clipPos(retval);
|
||||
end.ch--;
|
||||
if (!keepHPos) {
|
||||
@@ -3712,14 +3694,14 @@
|
||||
}
|
||||
start = idx;
|
||||
}
|
||||
return Pos(cm.getCursor().line, idx);
|
||||
return new Pos(cm.getCursor().line, idx);
|
||||
}
|
||||
|
||||
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));
|
||||
return clipCursorToContent(cm, new Pos(line, repeat - 1));
|
||||
}
|
||||
|
||||
function updateMark(cm, vim, markName, pos) {
|
||||
@@ -3971,7 +3953,7 @@
|
||||
repeat--;
|
||||
}
|
||||
|
||||
return Pos(curr_index.ln, curr_index.pos);
|
||||
return new Pos(curr_index.ln, curr_index.pos);
|
||||
}
|
||||
|
||||
// TODO: perhaps this finagling of start and end positions belongs
|
||||
@@ -3994,8 +3976,8 @@
|
||||
// cursor is on a matching open bracket.
|
||||
var offset = curChar === openSym ? 1 : 0;
|
||||
|
||||
start = cm.scanForBracket(Pos(cur.line, cur.ch + offset), -1, undefined, {'bracketRegex': bracketRegexp});
|
||||
end = cm.scanForBracket(Pos(cur.line, cur.ch + offset), 1, undefined, {'bracketRegex': bracketRegexp});
|
||||
start = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), -1, undefined, {'bracketRegex': bracketRegexp});
|
||||
end = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), 1, undefined, {'bracketRegex': bracketRegexp});
|
||||
|
||||
if (!start || !end) {
|
||||
return { start: cur, end: cur };
|
||||
@@ -4076,8 +4058,8 @@
|
||||
}
|
||||
|
||||
return {
|
||||
start: Pos(cur.line, start),
|
||||
end: Pos(cur.line, end)
|
||||
start: new Pos(cur.line, start),
|
||||
end: new Pos(cur.line, end)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4297,7 +4279,7 @@
|
||||
ignoreCase = (/^[^A-Z]*$/).test(regexPart);
|
||||
}
|
||||
var regexp = new RegExp(regexPart,
|
||||
(ignoreCase || forceIgnoreCase) ? 'i' : undefined);
|
||||
(ignoreCase || forceIgnoreCase) ? 'im' : 'm');
|
||||
return regexp;
|
||||
}
|
||||
|
||||
@@ -4327,7 +4309,7 @@
|
||||
}
|
||||
|
||||
function showConfirm(cm, template) {
|
||||
var pre = dom('pre', {$color: 'red'}, template);
|
||||
var pre = dom('pre', {$color: 'red', class: 'cm-vim-message'}, template);
|
||||
if (cm.openNotification) {
|
||||
cm.openNotification(pre, {bottom: true, duration: 5000});
|
||||
} else {
|
||||
@@ -4345,7 +4327,6 @@
|
||||
}
|
||||
|
||||
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, {
|
||||
@@ -4354,6 +4335,9 @@
|
||||
});
|
||||
}
|
||||
else {
|
||||
var shortText = '';
|
||||
if (typeof options.prefix != "string" && options.prefix) shortText += options.prefix.textContent;
|
||||
if (options.desc) shortText += " " + options.desc;
|
||||
options.onClose(prompt(shortText, ''));
|
||||
}
|
||||
}
|
||||
@@ -4428,6 +4412,7 @@
|
||||
function highlightSearchMatches(cm, query) {
|
||||
clearTimeout(highlightTimeout);
|
||||
highlightTimeout = setTimeout(function() {
|
||||
if (!cm.state.vim) return;
|
||||
var searchState = getSearchState(cm);
|
||||
var overlay = searchState.getOverlay();
|
||||
if (!overlay || query != overlay.query) {
|
||||
@@ -4453,12 +4438,19 @@
|
||||
var cursor = cm.getSearchCursor(query, pos);
|
||||
for (var i = 0; i < repeat; i++) {
|
||||
var found = cursor.find(prev);
|
||||
if (i == 0 && found && cursorEqual(cursor.from(), pos)) { found = cursor.find(prev); }
|
||||
if (i == 0 && found && cursorEqual(cursor.from(), pos)) {
|
||||
var lastEndPos = prev ? cursor.from() : cursor.to();
|
||||
found = cursor.find(prev);
|
||||
if (found && !found[0] && cursorEqual(cursor.from(), lastEndPos)) {
|
||||
if (cm.getLine(lastEndPos.line).length == lastEndPos.ch)
|
||||
found = cursor.find(prev);
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
// SearchCursor may have returned null because it hit EOF, wrap
|
||||
// around and try again.
|
||||
cursor = cm.getSearchCursor(query,
|
||||
(prev) ? Pos(cm.lastLine()) : Pos(cm.firstLine(), 0) );
|
||||
(prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0) );
|
||||
if (!cursor.find(prev)) {
|
||||
return;
|
||||
}
|
||||
@@ -4494,7 +4486,7 @@
|
||||
// SearchCursor may have returned null because it hit EOF, wrap
|
||||
// around and try again.
|
||||
cursor = cm.getSearchCursor(query,
|
||||
(prev) ? Pos(cm.lastLine()) : Pos(cm.firstLine(), 0) );
|
||||
(prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0) );
|
||||
if (!cursor.find(prev)) {
|
||||
return;
|
||||
}
|
||||
@@ -4550,7 +4542,7 @@
|
||||
|
||||
function getMarkPos(cm, vim, markName) {
|
||||
if (markName == '\'' || markName == '`') {
|
||||
return vimGlobalState.jumpList.find(cm, -1) || Pos(0, 0);
|
||||
return vimGlobalState.jumpList.find(cm, -1) || new Pos(0, 0);
|
||||
} else if (markName == '.') {
|
||||
return getLastEditPos(cm);
|
||||
}
|
||||
@@ -4615,7 +4607,7 @@
|
||||
if (command.type == 'exToKey') {
|
||||
// Handle Ex to Key mapping.
|
||||
for (var i = 0; i < command.toKeys.length; i++) {
|
||||
CodeMirror.Vim.handleKey(cm, command.toKeys[i], 'mapping');
|
||||
vimApi.handleKey(cm, command.toKeys[i], 'mapping');
|
||||
}
|
||||
return;
|
||||
} else if (command.type == 'exToEx') {
|
||||
@@ -4790,7 +4782,7 @@
|
||||
var commandName = lhs.substring(1);
|
||||
if (this.commandMap_[commandName] && this.commandMap_[commandName].user) {
|
||||
delete this.commandMap_[commandName];
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// Key to Ex or key to key mapping
|
||||
@@ -4799,11 +4791,10 @@
|
||||
if (keys == defaultKeymap[i].keys
|
||||
&& defaultKeymap[i].context === ctx) {
|
||||
defaultKeymap.splice(i, 1);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw Error('No such mapping.');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4830,13 +4821,11 @@
|
||||
vmap: function(cm, params) { this.map(cm, params, 'visual'); },
|
||||
unmap: function(cm, params, ctx) {
|
||||
var mapArgs = params.args;
|
||||
if (!mapArgs || mapArgs.length < 1) {
|
||||
if (!mapArgs || mapArgs.length < 1 || !exCommandDispatcher.unmap(mapArgs[0], ctx)) {
|
||||
if (cm) {
|
||||
showConfirm(cm, 'No such mapping: ' + params.input);
|
||||
}
|
||||
return;
|
||||
}
|
||||
exCommandDispatcher.unmap(mapArgs[0], ctx);
|
||||
},
|
||||
move: function(cm, params) {
|
||||
commandDispatcher.processCommand(cm, cm.state.vim, {
|
||||
@@ -4964,8 +4953,8 @@
|
||||
var lineStart = params.line || cm.firstLine();
|
||||
var lineEnd = params.lineEnd || params.line || cm.lastLine();
|
||||
if (lineStart == lineEnd) { return; }
|
||||
var curStart = Pos(lineStart, 0);
|
||||
var curEnd = Pos(lineEnd, lineLength(cm, lineEnd));
|
||||
var curStart = new Pos(lineStart, 0);
|
||||
var curEnd = new Pos(lineEnd, lineLength(cm, lineEnd));
|
||||
var text = cm.getRange(curStart, curEnd).split('\n');
|
||||
var numberRegex = pattern ? pattern :
|
||||
(number == 'decimal') ? /(-?)([\d]+)/ :
|
||||
@@ -5106,12 +5095,6 @@
|
||||
regexPart = new RegExp(regexPart).source; //normalize not escaped characters
|
||||
}
|
||||
replacePart = tokens[1];
|
||||
// If the pattern ends with $ (line boundary assertion), change $ to \n.
|
||||
// Caveat: this workaround cannot match on the last line of the document.
|
||||
if (/(^|[^\\])(\\\\)*\$$/.test(regexPart)) {
|
||||
regexPart = regexPart.slice(0, -1) + '\\n';
|
||||
replacePart = (replacePart || '') + '\n';
|
||||
}
|
||||
if (replacePart !== undefined) {
|
||||
if (getOption('pcre')) {
|
||||
replacePart = unescapeRegexReplace(replacePart.replace(/([^\\])&/g,"$1$$&"));
|
||||
@@ -5177,7 +5160,7 @@
|
||||
lineStart = lineEnd;
|
||||
lineEnd = lineStart + count - 1;
|
||||
}
|
||||
var startPos = clipCursorToContent(cm, Pos(lineStart, 0));
|
||||
var startPos = clipCursorToContent(cm, new Pos(lineStart, 0));
|
||||
var cursor = cm.getSearchCursor(query, startPos);
|
||||
doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback);
|
||||
},
|
||||
@@ -5301,10 +5284,18 @@
|
||||
lineEnd += modifiedLineNumber - unmodifiedLineNumber;
|
||||
joined = modifiedLineNumber < unmodifiedLineNumber;
|
||||
}
|
||||
function findNextValidMatch() {
|
||||
var lastMatchTo = lastPos && copyCursor(searchCursor.to());
|
||||
var match = searchCursor.findNext();
|
||||
if (match && !match[0] && lastMatchTo && cursorEqual(searchCursor.from(), lastMatchTo)) {
|
||||
match = searchCursor.findNext();
|
||||
}
|
||||
return match;
|
||||
}
|
||||
function next() {
|
||||
// The below only loops to skip over multiple occurrences on the same
|
||||
// line when 'global' is not true.
|
||||
while(searchCursor.findNext() &&
|
||||
while(findNextValidMatch() &&
|
||||
isInRange(searchCursor.from(), lineStart, lineEnd)) {
|
||||
if (!global && searchCursor.from().line == modifiedLineNumber && !joined) {
|
||||
continue;
|
||||
@@ -5469,7 +5460,7 @@
|
||||
match = (/<\w+-.+?>|<\w+>|./).exec(text);
|
||||
key = match[0];
|
||||
text = text.substring(match.index + key.length);
|
||||
CodeMirror.Vim.handleKey(cm, key, 'macro');
|
||||
vimApi.handleKey(cm, key, 'macro');
|
||||
if (vim.insertMode) {
|
||||
var changes = register.insertModeChanges[imc++].changes;
|
||||
vimGlobalState.macroModeState.lastInsertModeChanges.changes =
|
||||
@@ -5564,36 +5555,6 @@
|
||||
} else if (!cm.curOp.isVimOp) {
|
||||
handleExternalSelection(cm, vim);
|
||||
}
|
||||
if (vim.visualMode) {
|
||||
updateFakeCursor(cm);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Keeps track of a fake cursor to support visual mode cursor behavior.
|
||||
*/
|
||||
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 (from.ch == cm.getLine(from.line).length) {
|
||||
var widget = dom('span', { 'class': className }, '\u00a0');
|
||||
vim.fakeCursorBookmark = cm.setBookmark(from, {widget: widget});
|
||||
} else {
|
||||
vim.fakeCursor = cm.markText(from, to, {className: className});
|
||||
}
|
||||
}
|
||||
function clearFakeCursor(vim) {
|
||||
if (vim.fakeCursor) {
|
||||
vim.fakeCursor.clear();
|
||||
vim.fakeCursor = null;
|
||||
}
|
||||
if (vim.fakeCursorBookmark) {
|
||||
vim.fakeCursorBookmark.clear();
|
||||
vim.fakeCursorBookmark = null;
|
||||
}
|
||||
}
|
||||
function handleExternalSelection(cm, vim) {
|
||||
var anchor = cm.getCursor('anchor');
|
||||
@@ -5735,12 +5696,12 @@
|
||||
if (change instanceof InsertModeKey) {
|
||||
CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler);
|
||||
} else if (typeof change == "string") {
|
||||
var cur = cm.getCursor();
|
||||
cm.replaceRange(change, cur, cur);
|
||||
cm.replaceSelection(change);
|
||||
} else {
|
||||
var start = cm.getCursor();
|
||||
var end = offsetCursor(start, 0, change[0].length);
|
||||
cm.replaceRange(change[0], start, end);
|
||||
cm.setCursor(end);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
6
plugins/codemirror/mode/css/css.js
vendored
6
plugins/codemirror/mode/css/css.js
vendored
@@ -443,13 +443,15 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
||||
"monochrome", "min-monochrome", "max-monochrome", "resolution",
|
||||
"min-resolution", "max-resolution", "scan", "grid", "orientation",
|
||||
"device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio",
|
||||
"pointer", "any-pointer", "hover", "any-hover", "prefers-color-scheme"
|
||||
"pointer", "any-pointer", "hover", "any-hover", "prefers-color-scheme",
|
||||
"dynamic-range", "video-dynamic-range"
|
||||
], mediaFeatures = keySet(mediaFeatures_);
|
||||
|
||||
var mediaValueKeywords_ = [
|
||||
"landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover",
|
||||
"interlace", "progressive",
|
||||
"dark", "light"
|
||||
"dark", "light",
|
||||
"standard", "high"
|
||||
], mediaValueKeywords = keySet(mediaValueKeywords_);
|
||||
|
||||
var propertyKeywords_ = [
|
||||
|
||||
8
plugins/codemirror/mode/gas/gas.js
vendored
8
plugins/codemirror/mode/gas/gas.js
vendored
@@ -144,18 +144,26 @@ CodeMirror.defineMode("gas", function(_config, parserConfig) {
|
||||
function x86(_parserConfig) {
|
||||
lineCommentStartSymbol = "#";
|
||||
|
||||
registers.al = "variable";
|
||||
registers.ah = "variable";
|
||||
registers.ax = "variable";
|
||||
registers.eax = "variable-2";
|
||||
registers.rax = "variable-3";
|
||||
|
||||
registers.bl = "variable";
|
||||
registers.bh = "variable";
|
||||
registers.bx = "variable";
|
||||
registers.ebx = "variable-2";
|
||||
registers.rbx = "variable-3";
|
||||
|
||||
registers.cl = "variable";
|
||||
registers.ch = "variable";
|
||||
registers.cx = "variable";
|
||||
registers.ecx = "variable-2";
|
||||
registers.rcx = "variable-3";
|
||||
|
||||
registers.dl = "variable";
|
||||
registers.dh = "variable";
|
||||
registers.dx = "variable";
|
||||
registers.edx = "variable-2";
|
||||
registers.rdx = "variable-3";
|
||||
|
||||
4
plugins/codemirror/mode/nsis/nsis.js
vendored
4
plugins/codemirror/mode/nsis/nsis.js
vendored
@@ -24,14 +24,14 @@ CodeMirror.defineSimpleMode("nsis",{
|
||||
{ regex: /`(?:[^\\`]|\\.)*`?/, token: "string" },
|
||||
|
||||
// Compile Time Commands
|
||||
{regex: /^\s*(?:\!(include|addincludedir|addplugindir|appendfile|cd|delfile|echo|error|execute|packhdr|pragma|finalize|getdllversion|gettlbversion|system|tempfile|warning|verbose|define|undef|insertmacro|macro|macroend|makensis|searchparse|searchreplace))\b/, token: "keyword"},
|
||||
{regex: /^\s*(?:\!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|error|execute|finalize|getdllversion|gettlbversion|include|insertmacro|macro|macroend|makensis|packhdr|pragma|searchparse|searchreplace|system|tempfile|undef|uninstfinalize|verbose|warning))\b/, token: "keyword"},
|
||||
|
||||
// Conditional Compilation
|
||||
{regex: /^\s*(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/, token: "keyword", indent: true},
|
||||
{regex: /^\s*(?:\!(else|endif|macroend))\b/, token: "keyword", dedent: true},
|
||||
|
||||
// Runtime Commands
|
||||
{regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, token: "keyword"},
|
||||
{regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetTempFileName|GetWinVer|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, token: "keyword"},
|
||||
{regex: /^\s*(?:Function|PageEx|Section(?:Group)?)\b/, token: "keyword", indent: true},
|
||||
{regex: /^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/, token: "keyword", dedent: true},
|
||||
|
||||
|
||||
6
plugins/codemirror/mode/php/php.js
vendored
6
plugins/codemirror/mode/php/php.js
vendored
File diff suppressed because one or more lines are too long
10
plugins/codemirror/mode/soy/soy.js
vendored
10
plugins/codemirror/mode/soy/soy.js
vendored
@@ -140,10 +140,10 @@
|
||||
state.context = new Context(state.context, "list-literal", state.variables);
|
||||
state.lookupVariables = false;
|
||||
return null;
|
||||
} else if (stream.match(/map\b/)) {
|
||||
} else if (stream.match(/\bmap(?=\()/)) {
|
||||
state.soyState.push("map-literal");
|
||||
return "keyword";
|
||||
} else if (stream.match(/record\b/)) {
|
||||
} else if (stream.match(/\brecord(?=\()/)) {
|
||||
state.soyState.push("record-literal");
|
||||
return "keyword";
|
||||
} else if (stream.match(/([\w]+)(?=\()/)) {
|
||||
@@ -454,11 +454,11 @@
|
||||
state.indent -= 2 * config.indentUnit;
|
||||
return null;
|
||||
}
|
||||
if (stream.match(/\w+(?=\s+as)/)) {
|
||||
if (stream.match(/\w+(?=\s+as\b)/)) {
|
||||
return "variable";
|
||||
}
|
||||
if (match = stream.match(/\w+/)) {
|
||||
return /(from|as)/.test(match[0]) ? "keyword" : "def";
|
||||
return /\b(from|as)\b/.test(match[0]) ? "keyword" : "def";
|
||||
}
|
||||
if (match = stream.match(/^["']/)) {
|
||||
state.soyState.push("string");
|
||||
@@ -605,7 +605,7 @@
|
||||
state.indent += 2 * config.indentUnit;
|
||||
state.soyState.push("tag");
|
||||
return "keyword";
|
||||
} else if (!state.context && stream.match(/\bimport\b/)) {
|
||||
} else if (!state.context && stream.sol() && stream.match(/import\b/)) {
|
||||
state.soyState.push("import");
|
||||
state.indent += 2 * config.indentUnit;
|
||||
return "keyword";
|
||||
|
||||
4
plugins/codemirror/mode/sql/sql.js
vendored
4
plugins/codemirror/mode/sql/sql.js
vendored
@@ -332,7 +332,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
|
||||
CodeMirror.defineMIME("text/x-mariadb", {
|
||||
name: "sql",
|
||||
client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),
|
||||
keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
|
||||
keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group group_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
|
||||
builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),
|
||||
atoms: set("false true null unknown"),
|
||||
operatorChars: /^[*+\-%<>!=&|^]/,
|
||||
@@ -452,7 +452,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
|
||||
CodeMirror.defineMIME("text/x-sparksql", {
|
||||
name: "sql",
|
||||
keywords: set("add after all alter analyze and anti archive array as asc at between bucket buckets by cache cascade case cast change clear cluster clustered codegen collection column columns comment commit compact compactions compute concatenate cost create cross cube current current_date current_timestamp database databases data dbproperties defined delete delimited deny desc describe dfs directories distinct distribute drop else end escaped except exchange exists explain export extended external false fields fileformat first following for format formatted from full function functions global grant group grouping having if ignore import in index indexes inner inpath inputformat insert intersect interval into is items join keys last lateral lazy left like limit lines list load local location lock locks logical macro map minus msck natural no not null nulls of on optimize option options or order out outer outputformat over overwrite partition partitioned partitions percent preceding principals purge range recordreader recordwriter recover reduce refresh regexp rename repair replace reset restrict revoke right rlike role roles rollback rollup row rows schema schemas select semi separated serde serdeproperties set sets show skewed sort sorted start statistics stored stratify struct table tables tablesample tblproperties temp temporary terminated then to touch transaction transactions transform true truncate unarchive unbounded uncache union unlock unset use using values view when where window with"),
|
||||
builtin: set("tinyint smallint int bigint boolean float double string binary timestamp decimal array map struct uniontype delimited serde sequencefile textfile rcfile inputformat outputformat"),
|
||||
builtin: set("abs acos acosh add_months aggregate and any approx_count_distinct approx_percentile array array_contains array_distinct array_except array_intersect array_join array_max array_min array_position array_remove array_repeat array_sort array_union arrays_overlap arrays_zip ascii asin asinh assert_true atan atan2 atanh avg base64 between bigint bin binary bit_and bit_count bit_get bit_length bit_or bit_xor bool_and bool_or boolean bround btrim cardinality case cast cbrt ceil ceiling char char_length character_length chr coalesce collect_list collect_set concat concat_ws conv corr cos cosh cot count count_if count_min_sketch covar_pop covar_samp crc32 cume_dist current_catalog current_database current_date current_timestamp current_timezone current_user date date_add date_format date_from_unix_date date_part date_sub date_trunc datediff day dayofmonth dayofweek dayofyear decimal decode degrees delimited dense_rank div double e element_at elt encode every exists exp explode explode_outer expm1 extract factorial filter find_in_set first first_value flatten float floor forall format_number format_string from_csv from_json from_unixtime from_utc_timestamp get_json_object getbit greatest grouping grouping_id hash hex hour hypot if ifnull in initcap inline inline_outer input_file_block_length input_file_block_start input_file_name inputformat instr int isnan isnotnull isnull java_method json_array_length json_object_keys json_tuple kurtosis lag last last_day last_value lcase lead least left length levenshtein like ln locate log log10 log1p log2 lower lpad ltrim make_date make_dt_interval make_interval make_timestamp make_ym_interval map map_concat map_entries map_filter map_from_arrays map_from_entries map_keys map_values map_zip_with max max_by md5 mean min min_by minute mod monotonically_increasing_id month months_between named_struct nanvl negative next_day not now nth_value ntile nullif nvl nvl2 octet_length or outputformat overlay parse_url percent_rank percentile percentile_approx pi pmod posexplode posexplode_outer position positive pow power printf quarter radians raise_error rand randn random rank rcfile reflect regexp regexp_extract regexp_extract_all regexp_like regexp_replace repeat replace reverse right rint rlike round row_number rpad rtrim schema_of_csv schema_of_json second sentences sequence sequencefile serde session_window sha sha1 sha2 shiftleft shiftright shiftrightunsigned shuffle sign signum sin sinh size skewness slice smallint some sort_array soundex space spark_partition_id split sqrt stack std stddev stddev_pop stddev_samp str_to_map string struct substr substring substring_index sum tan tanh textfile timestamp timestamp_micros timestamp_millis timestamp_seconds tinyint to_csv to_date to_json to_timestamp to_unix_timestamp to_utc_timestamp transform transform_keys transform_values translate trim trunc try_add try_divide typeof ucase unbase64 unhex uniontype unix_date unix_micros unix_millis unix_seconds unix_timestamp upper uuid var_pop var_samp variance version weekday weekofyear when width_bucket window xpath xpath_boolean xpath_double xpath_float xpath_int xpath_long xpath_number xpath_short xpath_string xxhash64 year zip_with"),
|
||||
atoms: set("false true null"),
|
||||
operatorChars: /^[*\/+\-%<>!=~&|^]/,
|
||||
dateSQL: set("date time timestamp"),
|
||||
|
||||
4
plugins/codemirror/mode/stylus/stylus.js
vendored
4
plugins/codemirror/mode/stylus/stylus.js
vendored
File diff suppressed because one or more lines are too long
18
plugins/codemirror/mode/xml/xml.js
vendored
18
plugins/codemirror/mode/xml/xml.js
vendored
@@ -187,6 +187,10 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
||||
};
|
||||
}
|
||||
|
||||
function lower(tagName) {
|
||||
return tagName && tagName.toLowerCase();
|
||||
}
|
||||
|
||||
function Context(state, tagName, startOfLine) {
|
||||
this.prev = state.context;
|
||||
this.tagName = tagName || "";
|
||||
@@ -205,8 +209,8 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
||||
return;
|
||||
}
|
||||
parentTagName = state.context.tagName;
|
||||
if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||
|
||||
!config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
|
||||
if (!config.contextGrabbers.hasOwnProperty(lower(parentTagName)) ||
|
||||
!config.contextGrabbers[lower(parentTagName)].hasOwnProperty(lower(nextTagName))) {
|
||||
return;
|
||||
}
|
||||
popContext(state);
|
||||
@@ -240,7 +244,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
||||
if (type == "word") {
|
||||
var tagName = stream.current();
|
||||
if (state.context && state.context.tagName != tagName &&
|
||||
config.implicitlyClosed.hasOwnProperty(state.context.tagName))
|
||||
config.implicitlyClosed.hasOwnProperty(lower(state.context.tagName)))
|
||||
popContext(state);
|
||||
if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {
|
||||
setStyle = "tag";
|
||||
@@ -279,7 +283,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
||||
var tagName = state.tagName, tagStart = state.tagStart;
|
||||
state.tagName = state.tagStart = null;
|
||||
if (type == "selfcloseTag" ||
|
||||
config.autoSelfClosers.hasOwnProperty(tagName)) {
|
||||
config.autoSelfClosers.hasOwnProperty(lower(tagName))) {
|
||||
maybePopContext(state, tagName);
|
||||
} else {
|
||||
maybePopContext(state, tagName);
|
||||
@@ -359,7 +363,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
||||
if (context.tagName == tagAfter[2]) {
|
||||
context = context.prev;
|
||||
break;
|
||||
} else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) {
|
||||
} else if (config.implicitlyClosed.hasOwnProperty(lower(context.tagName))) {
|
||||
context = context.prev;
|
||||
} else {
|
||||
break;
|
||||
@@ -367,8 +371,8 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
||||
}
|
||||
} else if (tagAfter) { // Opening tag spotted
|
||||
while (context) {
|
||||
var grabbers = config.contextGrabbers[context.tagName];
|
||||
if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
|
||||
var grabbers = config.contextGrabbers[lower(context.tagName)];
|
||||
if (grabbers && grabbers.hasOwnProperty(lower(tagAfter[2])))
|
||||
context = context.prev;
|
||||
else
|
||||
break;
|
||||
|
||||
3
plugins/codemirror/theme/solarized.css
vendored
3
plugins/codemirror/theme/solarized.css
vendored
@@ -35,12 +35,10 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png
|
||||
.cm-s-solarized.cm-s-dark {
|
||||
color: #839496;
|
||||
background-color: #002b36;
|
||||
text-shadow: #002b36 0 1px;
|
||||
}
|
||||
.cm-s-solarized.cm-s-light {
|
||||
background-color: #fdf6e3;
|
||||
color: #657b83;
|
||||
text-shadow: #eee8d5 0 1px;
|
||||
}
|
||||
|
||||
.cm-s-solarized .CodeMirror-widget {
|
||||
@@ -126,7 +124,6 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png
|
||||
|
||||
.cm-s-solarized.cm-s-dark .CodeMirror-linenumber {
|
||||
color: #586e75;
|
||||
text-shadow: #021014 0 -1px;
|
||||
}
|
||||
|
||||
/* Light */
|
||||
|
||||
Reference in New Issue
Block a user