update CodeMirror, stylelint, deps

This commit is contained in:
tophf 2022-01-20 17:43:06 +03:00
parent 4c696fefbc
commit 98da86f816
14 changed files with 516 additions and 4105 deletions

View File

@ -65,6 +65,8 @@
}, },
async stylelint(opts) { async stylelint(opts) {
// Removing an unused API that spits a warning in Chrome console due to stylelint's isBuffer
delete self.SharedArrayBuffer;
require(['/vendor/stylelint-bundle/stylelint-bundle.min']); /* global stylelint */ require(['/vendor/stylelint-bundle/stylelint-bundle.min']); /* global stylelint */
try { try {
let res; let res;

View File

@ -203,16 +203,13 @@ linterMan.DEFAULTS = {
rules: Object.assign({}, DEFAULTS.stylelint.rules, config && config.rules), rules: Object.assign({}, DEFAULTS.stylelint.rules, config && config.rules),
}), }),
async lint(code, config, mode) { async lint(code, config, mode) {
const isLess = mode === 'text/x-less'; const raw = await worker.stylelint({code, config});
const isStylus = mode === 'stylus';
const syntax = isLess ? 'less' : isStylus ? 'sugarss' : 'css';
const raw = await worker.stylelint({code, config, syntax});
if (!raw) { if (!raw) {
return []; return [];
} }
// Hiding the errors about "//" comments as we're preprocessing only when saving/applying // Hiding the errors about "//" comments as we're preprocessing only when saving/applying
// and we can't just pre-remove the comments since "//" may be inside a string token // and we can't just pre-remove the comments since "//" may be inside a string token
const slashCommentAllowed = isLess || isStylus; const slashCommentAllowed = mode === 'text/x-less' || mode === 'stylus';
const res = []; const res = [];
for (const w of raw.warnings) { for (const w of raw.warnings) {
const msg = w.text.match(/^(?:Unexpected\s+)?(.*?)\s*\([^()]+\)$|$/)[1] || w.text; const msg = w.text.match(/^(?:Unexpected\s+)?(.*?)\s*\([^()]+\)$|$/)[1] || w.text;

4103
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,12 +10,12 @@
}, },
"dependencies": { "dependencies": {
"@eight04/draggable-list": "^0.3.0", "@eight04/draggable-list": "^0.3.0",
"codemirror": "5.63.3", "codemirror": "5.65.1",
"db-to-cloud": "^0.7.0", "db-to-cloud": "^0.7.0",
"jsonlint": "^1.6.3", "jsonlint": "^1.6.3",
"less-bundle": "github:openstyles/less-bundle#v0.1.0", "less-bundle": "github:openstyles/less-bundle#v0.1.0",
"lz-string-unsafe": "^1.4.4-fork-1", "lz-string-unsafe": "^1.4.4-fork-1",
"stylelint-bundle": "^13.8.0", "stylelint-bundle": "^14.2.0",
"stylus-lang-bundle": "github:openstyles/stylus-lang-bundle#v0.54.7", "stylus-lang-bundle": "github:openstyles/stylus-lang-bundle#v0.54.7",
"usercss-meta": "^0.12.0", "usercss-meta": "^0.12.0",
"webext-launch-web-auth-flow": "^0.1.1" "webext-launch-web-auth-flow": "^0.1.1"

View File

@ -1,4 +1,4 @@
## codemirror v5.63.3 ## codemirror v5.65.1
Files copied from NPM (node_modules): Files copied from NPM (node_modules):
* addon/comment/comment.js * addon/comment/comment.js

View File

@ -11,13 +11,14 @@
})(function(CodeMirror) { })(function(CodeMirror) {
"use strict"; "use strict";
CodeMirror.registerHelper("fold", "brace", function(cm, start) { function bracketFolding(pairs) {
return function(cm, start) {
var line = start.line, lineText = cm.getLine(line); var line = start.line, lineText = cm.getLine(line);
var tokenType;
function findOpening(openCh) { function findOpening(pair) {
var tokenType;
for (var at = start.ch, pass = 0;;) { for (var at = start.ch, pass = 0;;) {
var found = at <= 0 ? -1 : lineText.lastIndexOf(openCh, at - 1); var found = at <= 0 ? -1 : lineText.lastIndexOf(pair[0], at - 1);
if (found == -1) { if (found == -1) {
if (pass == 1) break; if (pass == 1) break;
pass = 1; pass = 1;
@ -26,41 +27,51 @@ CodeMirror.registerHelper("fold", "brace", function(cm, start) {
} }
if (pass == 1 && found < start.ch) break; if (pass == 1 && found < start.ch) break;
tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)); tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1));
if (!/^(comment|string)/.test(tokenType)) return found + 1; if (!/^(comment|string)/.test(tokenType)) return {ch: found + 1, tokenType: tokenType, pair: pair};
at = found - 1; at = found - 1;
} }
} }
var startBrace = findOpening("{"), startBracket = findOpening("[") function findRange(found) {
var startToken, endToken, startCh var count = 1, lastLine = cm.lastLine(), end, startCh = found.ch, endCh
if (startBrace != null && (startBracket == null || startBracket > startBrace)) {
startCh = startBrace; startToken = "{"; endToken = "}"
} else if (startBracket != null) {
startCh = startBracket; startToken = "["; endToken = "]"
} else {
return
}
var count = 1, lastLine = cm.lastLine(), end, endCh;
outer: for (var i = line; i <= lastLine; ++i) { outer: for (var i = line; i <= lastLine; ++i) {
var text = cm.getLine(i), pos = i == line ? startCh : 0; var text = cm.getLine(i), pos = i == line ? startCh : 0;
for (;;) { for (;;) {
var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos); var nextOpen = text.indexOf(found.pair[0], pos), nextClose = text.indexOf(found.pair[1], pos);
if (nextOpen < 0) nextOpen = text.length; if (nextOpen < 0) nextOpen = text.length;
if (nextClose < 0) nextClose = text.length; if (nextClose < 0) nextClose = text.length;
pos = Math.min(nextOpen, nextClose); pos = Math.min(nextOpen, nextClose);
if (pos == text.length) break; if (pos == text.length) break;
if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == tokenType) { if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == found.tokenType) {
if (pos == nextOpen) ++count; if (pos == nextOpen) ++count;
else if (!--count) { end = i; endCh = pos; break outer; } else if (!--count) { end = i; endCh = pos; break outer; }
} }
++pos; ++pos;
} }
} }
if (end == null || line == end) return;
if (end == null || line == end) return null
return {from: CodeMirror.Pos(line, startCh), return {from: CodeMirror.Pos(line, startCh),
to: CodeMirror.Pos(end, endCh)}; to: CodeMirror.Pos(end, endCh)};
}); }
var found = []
for (var i = 0; i < pairs.length; i++) {
var open = findOpening(pairs[i])
if (open) found.push(open)
}
found.sort(function(a, b) { return a.ch - b.ch })
for (var i = 0; i < found.length; i++) {
var range = findRange(found[i])
if (range) return range
}
return null
}
}
CodeMirror.registerHelper("fold", "brace", bracketFolding([["{", "}"], ["[", "]"]]));
CodeMirror.registerHelper("fold", "brace-paren", bracketFolding([["{", "}"], ["[", "]"], ["(", ")"]]));
CodeMirror.registerHelper("fold", "import", function(cm, start) { CodeMirror.registerHelper("fold", "import", function(cm, start) {
function hasImport(line) { function hasImport(line) {

View File

@ -44,6 +44,27 @@
})(function(CodeMirror) { })(function(CodeMirror) {
'use strict'; '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 = [ var defaultKeymap = [
// Key to key mapping. This goes first to make it possible to override // Key to key mapping. This goes first to make it possible to override
// existing mappings. // existing mappings.
@ -51,6 +72,8 @@
{ keys: '<Right>', type: 'keyToKey', toKeys: 'l' }, { keys: '<Right>', type: 'keyToKey', toKeys: 'l' },
{ keys: '<Up>', type: 'keyToKey', toKeys: 'k' }, { keys: '<Up>', type: 'keyToKey', toKeys: 'k' },
{ keys: '<Down>', type: 'keyToKey', toKeys: 'j' }, { keys: '<Down>', type: 'keyToKey', toKeys: 'j' },
{ keys: 'g<Up>', type: 'keyToKey', toKeys: 'gk' },
{ keys: 'g<Down>', type: 'keyToKey', toKeys: 'gj' },
{ keys: '<Space>', type: 'keyToKey', toKeys: 'l' }, { keys: '<Space>', type: 'keyToKey', toKeys: 'l' },
{ keys: '<BS>', type: 'keyToKey', toKeys: 'h', context: 'normal'}, { keys: '<BS>', type: 'keyToKey', toKeys: 'h', context: 'normal'},
{ keys: '<Del>', type: 'keyToKey', toKeys: 'x', context: 'normal'}, { keys: '<Del>', type: 'keyToKey', toKeys: 'x', context: 'normal'},
@ -73,6 +96,7 @@
{ keys: '<PageUp>', type: 'keyToKey', toKeys: '<C-b>' }, { keys: '<PageUp>', type: 'keyToKey', toKeys: '<C-b>' },
{ keys: '<PageDown>', type: 'keyToKey', toKeys: '<C-f>' }, { keys: '<PageDown>', type: 'keyToKey', toKeys: '<C-f>' },
{ keys: '<CR>', type: 'keyToKey', toKeys: 'j^', context: 'normal' }, { keys: '<CR>', type: 'keyToKey', toKeys: 'j^', context: 'normal' },
{ keys: '<Ins>', type: 'keyToKey', toKeys: 'i', context: 'normal'},
{ keys: '<Ins>', type: 'action', action: 'toggleOverwrite', context: 'insert' }, { keys: '<Ins>', type: 'action', action: 'toggleOverwrite', context: 'insert' },
// Motions // Motions
{ keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true }}, { keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true }},
@ -102,6 +126,9 @@
{ keys: '<C-u>', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: false, explicitRepeat: true }}, { keys: '<C-u>', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: false, explicitRepeat: true }},
{ keys: 'gg', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: false, explicitRepeat: true, linewise: true, toJumplist: true }}, { keys: 'gg', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: false, explicitRepeat: true, linewise: true, toJumplist: true }},
{ keys: 'G', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: true, explicitRepeat: true, linewise: true, toJumplist: true }}, { keys: 'G', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: true, explicitRepeat: true, linewise: true, toJumplist: true }},
{keys: "g$", type: "motion", motion: "moveToEndOfDisplayLine"},
{keys: "g^", type: "motion", motion: "moveToStartOfDisplayLine"},
{keys: "g0", type: "motion", motion: "moveToStartOfDisplayLine"},
{ keys: '0', type: 'motion', motion: 'moveToStartOfLine' }, { keys: '0', type: 'motion', motion: 'moveToStartOfLine' },
{ keys: '^', type: 'motion', motion: 'moveToFirstNonWhiteSpaceCharacter' }, { keys: '^', type: 'motion', motion: 'moveToFirstNonWhiteSpaceCharacter' },
{ keys: '+', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true }}, { keys: '+', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true }},
@ -154,6 +181,7 @@
{ keys: 'C', type: 'operator', operator: 'change', operatorArgs: { linewise: true }, context: 'visual'}, { 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: 'operatorMotion', operator: 'changeCase', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorArgs: { shouldMoveCursor: true }, context: 'normal'},
{ keys: '~', type: 'operator', operator: 'changeCase', context: 'visual'}, { 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' }, { keys: '<C-w>', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' },
//ignore C-w in normal mode //ignore C-w in normal mode
{ keys: '<C-w>', type: 'idle', context: 'normal' }, { keys: '<C-w>', type: 'idle', context: 'normal' },
@ -248,8 +276,6 @@
{ name: 'global', shortName: 'g' } { name: 'global', shortName: 'g' }
]; ];
var Pos = CodeMirror.Pos;
var Vim = function() { var Vim = function() {
function enterVimMode(cm) { function enterVimMode(cm) {
cm.setOption('disableInput', true); cm.setOption('disableInput', true);
@ -265,15 +291,13 @@
cm.off('cursorActivity', onCursorActivity); cm.off('cursorActivity', onCursorActivity);
CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm)); CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm));
cm.state.vim = null; cm.state.vim = null;
if (highlightTimeout) clearTimeout(highlightTimeout);
} }
function detachVimMap(cm, next) { function detachVimMap(cm, next) {
if (this == CodeMirror.keyMap.vim) { if (this == CodeMirror.keyMap.vim) {
cm.options.$customCursor = null;
CodeMirror.rmClass(cm.getWrapperElement(), "cm-fat-cursor"); 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) if (!next || next.attach != attachVimMap)
@ -281,57 +305,15 @@
} }
function attachVimMap(cm, prev) { function attachVimMap(cm, prev) {
if (this == CodeMirror.keyMap.vim) { if (this == CodeMirror.keyMap.vim) {
if (cm.curOp) cm.curOp.selectionChanged = true;
cm.options.$customCursor = transformCursor;
CodeMirror.addClass(cm.getWrapperElement(), "cm-fat-cursor"); 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) if (!prev || prev.attach != attachVimMap)
enterVimMode(cm); 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. // Deprecated, simply setting the keymap works again.
CodeMirror.defineOption('vimMode', false, function(cm, val, prev) { CodeMirror.defineOption('vimMode', false, function(cm, val, prev) {
if (val && cm.getOption("keyMap") != "vim") if (val && cm.getOption("keyMap") != "vim")
@ -347,7 +329,7 @@
if (!vimKey) { if (!vimKey) {
return false; return false;
} }
var cmd = CodeMirror.Vim.findKey(cm, vimKey); var cmd = vimApi.findKey(cm, vimKey);
if (typeof cmd == 'function') { if (typeof cmd == 'function') {
CodeMirror.signal(cm, 'vim-keypress', vimKey); CodeMirror.signal(cm, 'vim-keypress', vimKey);
} }
@ -691,8 +673,6 @@
// executed in between. // executed in between.
lastMotion: null, lastMotion: null,
marks: {}, marks: {},
// Mark for rendering fake cursor for visual mode.
fakeCursor: null,
insertMode: false, insertMode: false,
// Repeat count for changes made in insert mode, triggered by key // Repeat count for changes made in insert mode, triggered by key
// sequences like 3,i. Only exists when insertMode is true. // sequences like 3,i. Only exists when insertMode is true.
@ -764,7 +744,7 @@
exCommandDispatcher.map(lhs, rhs, ctx); exCommandDispatcher.map(lhs, rhs, ctx);
}, },
unmap: function(lhs, ctx) { unmap: function(lhs, ctx) {
exCommandDispatcher.unmap(lhs, ctx); return exCommandDispatcher.unmap(lhs, ctx);
}, },
// Non-recursive map function. // Non-recursive map function.
// NOTE: This will not create mappings to key maps that aren't present // NOTE: This will not create mappings to key maps that aren't present
@ -904,7 +884,7 @@
match = (/<\w+-.+?>|<\w+>|./).exec(keys); match = (/<\w+-.+?>|<\w+>|./).exec(keys);
key = match[0]; key = match[0];
keys = keys.substring(match.index + key.length); keys = keys.substring(match.index + key.length);
CodeMirror.Vim.handleKey(cm, key, 'mapping'); vimApi.handleKey(cm, key, 'mapping');
} }
} }
@ -992,7 +972,7 @@
// clear VIM state in case it's in a bad state. // clear VIM state in case it's in a bad state.
cm.state.vim = undefined; cm.state.vim = undefined;
maybeInitVimState(cm); maybeInitVimState(cm);
if (!CodeMirror.Vim.suppressErrorLogging) { if (!vimApi.suppressErrorLogging) {
console['log'](e); console['log'](e);
} }
throw e; throw e;
@ -1647,17 +1627,17 @@
var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch); var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch);
if (lastSel.visualLine) { if (lastSel.visualLine) {
// Linewise Visual mode: The same number of lines. // 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) { } else if (lastSel.visualBlock) {
// Blockwise Visual mode: The same number of lines and columns. // 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) { } else if (lastSel.head.line == lastSel.anchor.line) {
// Normal Visual mode within one line: The same number of characters. // 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 { } else {
// Normal Visual mode with several lines: The same number of lines, in the // 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. // 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.visualMode = true;
vim.visualLine = lastSel.visualLine; vim.visualLine = lastSel.visualLine;
@ -1697,7 +1677,7 @@
ranges[i].head.ch = lineLength(cm, ranges[i].head.line); ranges[i].head.ch = lineLength(cm, ranges[i].head.line);
} }
} else if (mode == '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 { } else {
@ -1759,22 +1739,22 @@
var motions = { var motions = {
moveToTopLine: function(cm, _head, motionArgs) { moveToTopLine: function(cm, _head, motionArgs) {
var line = getUserVisibleLines(cm).top + motionArgs.repeat -1; 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) { moveToMiddleLine: function(cm) {
var range = getUserVisibleLines(cm); var range = getUserVisibleLines(cm);
var line = Math.floor((range.top + range.bottom) * 0.5); 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) { moveToBottomLine: function(cm, _head, motionArgs) {
var line = getUserVisibleLines(cm).bottom - motionArgs.repeat +1; 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) { expandToLine: function(_cm, head, motionArgs) {
// Expands forward to end of line, and then to next line if repeat is // Expands forward to end of line, and then to next line if repeat is
// >1. Does not handle backward motion! // >1. Does not handle backward motion!
var cur = head; 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) { findNext: function(cm, _head, motionArgs) {
var state = getSearchState(cm); var state = getSearchState(cm);
@ -1831,7 +1811,7 @@
// For whatever reason, when we use the "to" as returned by searchcursor.js directly, // 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 // the resulting selection is extended by 1 char. Let's shrink it so that only the
// match is selected. // 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 (vim.visualMode) {
// If we were in visualLine or visualBlock mode, get out of it. // If we were in visualLine or visualBlock mode, get out of it.
@ -1880,8 +1860,8 @@
if (vim.visualBlock && motionArgs.sameLine) { if (vim.visualBlock && motionArgs.sameLine) {
var sel = vim.sel; var sel = vim.sel;
return [ return [
clipCursorToContent(cm, Pos(sel.anchor.line, sel.head.ch)), clipCursorToContent(cm, new Pos(sel.anchor.line, sel.head.ch)),
clipCursorToContent(cm, Pos(sel.head.line, sel.anchor.ch)) clipCursorToContent(cm, new Pos(sel.head.line, sel.anchor.ch))
]; ];
} else { } else {
return ([vim.sel.head, vim.sel.anchor]); return ([vim.sel.head, vim.sel.anchor]);
@ -1921,7 +1901,7 @@
// Vim places the cursor on the first non-whitespace character of // 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 // the line if there is one, else it places the cursor at the end
// of the line, regardless of whether a mark was found. // 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; return best;
}, },
@ -1929,7 +1909,7 @@
var cur = head; var cur = head;
var repeat = motionArgs.repeat; var repeat = motionArgs.repeat;
var ch = motionArgs.forward ? cur.ch + repeat : cur.ch - 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) { moveByLines: function(cm, head, motionArgs, vim) {
var cur = head; var cur = head;
@ -1971,8 +1951,8 @@
endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line)); endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line));
vim.lastHPos = endCh; vim.lastHPos = endCh;
} }
vim.lastHSPos = cm.charCoords(Pos(line, endCh),'div').left; vim.lastHSPos = cm.charCoords(new Pos(line, endCh),'div').left;
return Pos(line, endCh); return new Pos(line, endCh);
}, },
moveByDisplayLines: function(cm, head, motionArgs, vim) { moveByDisplayLines: function(cm, head, motionArgs, vim) {
var cur = head; var cur = head;
@ -1994,7 +1974,7 @@
var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos }; var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos };
var res = cm.coordsChar(goalCoords, 'div'); var res = cm.coordsChar(goalCoords, 'div');
} else { } else {
var resCoords = cm.charCoords(Pos(cm.firstLine(), 0), 'div'); var resCoords = cm.charCoords(new Pos(cm.firstLine(), 0), 'div');
resCoords.left = vim.lastHSPos; resCoords.left = vim.lastHSPos;
res = cm.coordsChar(resCoords, 'div'); res = cm.coordsChar(resCoords, 'div');
} }
@ -2074,7 +2054,7 @@
// Go to the start of the line where the text begins, or the end for // Go to the start of the line where the text begins, or the end for
// whitespace-only lines // whitespace-only lines
var cursor = head; var cursor = head;
return Pos(cursor.line, return new Pos(cursor.line,
findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line))); findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line)));
}, },
moveToMatchedSymbol: function(cm, head) { moveToMatchedSymbol: function(cm, head) {
@ -2086,7 +2066,7 @@
for (; ch < lineText.length; ch++) { for (; ch < lineText.length; ch++) {
symbol = lineText.charAt(ch); symbol = lineText.charAt(ch);
if (symbol && isMatchableSymbol(symbol)) { 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") { if (style !== "string" && style !== "comment") {
break; break;
} }
@ -2095,23 +2075,33 @@
if (ch < lineText.length) { if (ch < lineText.length) {
// Only include angle brackets in analysis if they are being matched. // Only include angle brackets in analysis if they are being matched.
var re = (ch === '<' || ch === '>') ? /[(){}[\]<>]/ : /[(){}[\]]/; 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; return matched.to;
} else { } else {
return cursor; return cursor;
} }
}, },
moveToStartOfLine: function(_cm, head) { moveToStartOfLine: function(_cm, head) {
return Pos(head.line, 0); return new Pos(head.line, 0);
}, },
moveToLineOrEdgeOfDocument: function(cm, _head, motionArgs) { moveToLineOrEdgeOfDocument: function(cm, _head, motionArgs) {
var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine(); var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine();
if (motionArgs.repeatIsExplicit) { if (motionArgs.repeatIsExplicit) {
lineNum = motionArgs.repeat - cm.getOption('firstLineNumber'); lineNum = motionArgs.repeat - cm.getOption('firstLineNumber');
} }
return Pos(lineNum, return new Pos(lineNum,
findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum))); findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum)));
}, },
moveToStartOfDisplayLine: function(cm) {
cm.execCommand("goLineLeft");
return cm.getCursor();
},
moveToEndOfDisplayLine: function(cm) {
cm.execCommand("goLineRight");
var head = cm.getCursor();
if (head.sticky == "before") head.ch--;
return head;
},
textObjectManipulation: function(cm, head, motionArgs, vim) { textObjectManipulation: function(cm, head, motionArgs, vim) {
// TODO: lots of possible exceptions that can be thrown here. Try da( // TODO: lots of possible exceptions that can be thrown here. Try da(
// outside of a () block. // outside of a () block.
@ -2272,7 +2262,7 @@
if (anchor.line == cm.firstLine()) { if (anchor.line == cm.firstLine()) {
anchor.ch = 0; anchor.ch = 0;
} else { } 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); text = cm.getRange(anchor, head);
@ -2285,7 +2275,7 @@
text = cm.getSelection(); text = cm.getSelection();
var replacement = fillArray('', ranges.length); var replacement = fillArray('', ranges.length);
cm.replaceSelections(replacement); cm.replaceSelections(replacement);
finalHead = ranges[0].anchor; finalHead = cursorMin(ranges[0].head, ranges[0].anchor);
} }
vimGlobalState.registerController.pushText( vimGlobalState.registerController.pushText(
args.registerName, 'delete', text, args.registerName, 'delete', text,
@ -2419,7 +2409,7 @@
}, },
scrollToCursor: function(cm, actionArgs) { scrollToCursor: function(cm, actionArgs) {
var lineNum = cm.getCursor().line; 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 height = cm.getScrollInfo().clientHeight;
var y = charCoords.top; var y = charCoords.top;
var lineHeight = charCoords.bottom - y; var lineHeight = charCoords.bottom - y;
@ -2471,9 +2461,9 @@
var head = actionArgs.head || cm.getCursor('head'); var head = actionArgs.head || cm.getCursor('head');
var height = cm.listSelections().length; var height = cm.listSelections().length;
if (insertAt == 'eol') { if (insertAt == 'eol') {
head = Pos(head.line, lineLength(cm, head.line)); head = new Pos(head.line, lineLength(cm, head.line));
} else if (insertAt == 'bol') { } else if (insertAt == 'bol') {
head = Pos(head.line, 0); head = new Pos(head.line, 0);
} else if (insertAt == 'charAfter') { } else if (insertAt == 'charAfter') {
head = offsetCursor(head, 0, 1); head = offsetCursor(head, 0, 1);
} else if (insertAt == 'firstNonBlank') { } else if (insertAt == 'firstNonBlank') {
@ -2485,10 +2475,10 @@
if (sel.head.line < sel.anchor.line) { if (sel.head.line < sel.anchor.line) {
head = sel.head; head = sel.head;
} else { } else {
head = Pos(sel.anchor.line, 0); head = new Pos(sel.anchor.line, 0);
} }
} else { } else {
head = Pos( head = new Pos(
Math.min(sel.head.line, sel.anchor.line), Math.min(sel.head.line, sel.anchor.line),
Math.min(sel.head.ch, sel.anchor.ch)); Math.min(sel.head.ch, sel.anchor.ch));
height = Math.abs(sel.head.line - sel.anchor.line) + 1; height = Math.abs(sel.head.line - sel.anchor.line) + 1;
@ -2500,12 +2490,12 @@
if (sel.head.line >= sel.anchor.line) { if (sel.head.line >= sel.anchor.line) {
head = offsetCursor(sel.head, 0, 1); head = offsetCursor(sel.head, 0, 1);
} else { } else {
head = Pos(sel.anchor.line, 0); head = new Pos(sel.anchor.line, 0);
} }
} else { } else {
head = Pos( head = new Pos(
Math.min(sel.head.line, sel.anchor.line), 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; height = Math.abs(sel.head.line - sel.anchor.line) + 1;
} }
} else if (insertAt == 'inplace') { } else if (insertAt == 'inplace') {
@ -2549,7 +2539,7 @@
vim.visualLine = !!actionArgs.linewise; vim.visualLine = !!actionArgs.linewise;
vim.visualBlock = !!actionArgs.blockwise; vim.visualBlock = !!actionArgs.blockwise;
head = clipCursorToContent( head = clipCursorToContent(
cm, Pos(anchor.line, anchor.ch + repeat - 1)); cm, new Pos(anchor.line, anchor.ch + repeat - 1));
vim.sel = { vim.sel = {
anchor: anchor, anchor: anchor,
head: head head: head
@ -2612,13 +2602,13 @@
// Repeat is the number of lines to join. Minimum 2 lines. // Repeat is the number of lines to join. Minimum 2 lines.
var repeat = Math.max(actionArgs.repeat, 2); var repeat = Math.max(actionArgs.repeat, 2);
curStart = cm.getCursor(); curStart = cm.getCursor();
curEnd = clipCursorToContent(cm, Pos(curStart.line + repeat - 1, curEnd = clipCursorToContent(cm, new Pos(curStart.line + repeat - 1,
Infinity)); Infinity));
} }
var finalCh = 0; var finalCh = 0;
for (var i = curStart.line; i < curEnd.line; i++) { for (var i = curStart.line; i < curEnd.line; i++) {
finalCh = lineLength(cm, curStart.line); finalCh = lineLength(cm, curStart.line);
var tmp = Pos(curStart.line + 1, var tmp = new Pos(curStart.line + 1,
lineLength(cm, curStart.line + 1)); lineLength(cm, curStart.line + 1));
var text = cm.getRange(curStart, tmp); var text = cm.getRange(curStart, tmp);
text = actionArgs.keepSpaces text = actionArgs.keepSpaces
@ -2626,7 +2616,7 @@
: text.replace(/\n\s*/g, ' '); : text.replace(/\n\s*/g, ' ');
cm.replaceRange(text, curStart, tmp); cm.replaceRange(text, curStart, tmp);
} }
var curFinalPos = Pos(curStart.line, finalCh); var curFinalPos = new Pos(curStart.line, finalCh);
if (vim.visualMode) { if (vim.visualMode) {
exitVisualMode(cm, false); exitVisualMode(cm, false);
} }
@ -2637,7 +2627,7 @@
var insertAt = copyCursor(cm.getCursor()); var insertAt = copyCursor(cm.getCursor());
if (insertAt.line === cm.firstLine() && !actionArgs.after) { if (insertAt.line === cm.firstLine() && !actionArgs.after) {
// Special case for inserting newline before start of document. // 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); cm.setCursor(cm.firstLine(), 0);
} else { } else {
insertAt.line = (actionArgs.after) ? insertAt.line : insertAt.line = (actionArgs.after) ? insertAt.line :
@ -2738,7 +2728,7 @@
// first delete the selected text // first delete the selected text
cm.replaceSelections(emptyStrings); cm.replaceSelections(emptyStrings);
// Set new selections as per the block length of the yanked text // 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); cm.setCursor(selectionStart);
selectBlock(cm, selectionEnd); selectBlock(cm, selectionEnd);
cm.replaceSelections(text); cm.replaceSelections(text);
@ -2765,7 +2755,7 @@
for (var i = 0; i < text.length; i++) { for (var i = 0; i < text.length; i++) {
var line = cur.line+i; var line = cur.line+i;
if (line > cm.lastLine()) { if (line > cm.lastLine()) {
cm.replaceRange('\n', Pos(line, 0)); cm.replaceRange('\n', new Pos(line, 0));
} }
var lastCh = lineLength(cm, line); var lastCh = lineLength(cm, line);
if (lastCh < cur.ch) { if (lastCh < cur.ch) {
@ -2773,18 +2763,18 @@
} }
} }
cm.setCursor(cur); 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); cm.replaceSelections(text);
curPosFinal = cur; curPosFinal = cur;
} else { } else {
cm.replaceRange(text, cur); cm.replaceRange(text, cur);
// Now fine tune the cursor to where we want it. // Now fine tune the cursor to where we want it.
if (linewise && actionArgs.after) { if (linewise && actionArgs.after) {
curPosFinal = Pos( curPosFinal = new Pos(
cur.line + 1, cur.line + 1,
findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1))); findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1)));
} else if (linewise && !actionArgs.after) { } else if (linewise && !actionArgs.after) {
curPosFinal = Pos( curPosFinal = new Pos(
cur.line, cur.line,
findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line))); findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line)));
} else if (!linewise && actionArgs.after) { } else if (!linewise && actionArgs.after) {
@ -2832,7 +2822,7 @@
if (replaceTo > line.length) { if (replaceTo > line.length) {
replaceTo=line.length; replaceTo=line.length;
} }
curEnd = Pos(curStart.line, replaceTo); curEnd = new Pos(curStart.line, replaceTo);
} }
if (replaceWith=='\n') { if (replaceWith=='\n') {
if (!vim.visualMode) cm.replaceRange('', curStart, curEnd); if (!vim.visualMode) cm.replaceRange('', curStart, curEnd);
@ -2888,13 +2878,13 @@
} else { } else {
numberStr = baseStr + zeroPadding + numberStr; numberStr = baseStr + zeroPadding + numberStr;
} }
var from = Pos(cur.line, start); var from = new Pos(cur.line, start);
var to = Pos(cur.line, end); var to = new Pos(cur.line, end);
cm.replaceRange(numberStr, from, to); cm.replaceRange(numberStr, from, to);
} else { } else {
return; 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) { repeatLastEdit: function(cm, actionArgs, vim) {
var lastEditInputState = vim.lastEditInputState; var lastEditInputState = vim.lastEditInputState;
@ -2931,7 +2921,7 @@
var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() ); var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() );
var maxCh = lineLength(cm, line) - 1 + !!includeLineBreak; var maxCh = lineLength(cm, line) - 1 + !!includeLineBreak;
var ch = Math.min(Math.max(0, cur.ch), maxCh); var ch = Math.min(Math.max(0, cur.ch), maxCh);
return Pos(line, ch); return new Pos(line, ch);
} }
function copyArgs(args) { function copyArgs(args) {
var ret = {}; var ret = {};
@ -2947,7 +2937,7 @@
offsetCh = offsetLine.ch; offsetCh = offsetLine.ch;
offsetLine = offsetLine.line; 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) { function commandMatches(keys, keyMap, context, inputState) {
// Partial matches are not applied. They inform the key handler // Partial matches are not applied. They inform the key handler
@ -3007,7 +2997,7 @@
}; };
} }
function copyCursor(cur) { function copyCursor(cur) {
return Pos(cur.line, cur.ch); return new Pos(cur.line, cur.ch);
} }
function cursorEqual(cur1, cur2) { function cursorEqual(cur1, cur2) {
return cur1.ch == cur2.ch && cur1.line == cur2.line; return cur1.ch == cur2.ch && cur1.line == cur2.line;
@ -3054,7 +3044,7 @@
function extendLineToColumn(cm, lineNum, column) { function extendLineToColumn(cm, lineNum, column) {
var endCh = lineLength(cm, lineNum); var endCh = lineLength(cm, lineNum);
var spaces = new Array(column-endCh+1).join(' '); var spaces = new Array(column-endCh+1).join(' ');
cm.setCursor(Pos(lineNum, endCh)); cm.setCursor(new Pos(lineNum, endCh));
cm.replaceRange(spaces, cm.getCursor()); cm.replaceRange(spaces, cm.getCursor());
} }
// This functions selects a rectangular block // This functions selects a rectangular block
@ -3135,13 +3125,13 @@
if (block) { if (block) {
var width = block.width; var width = block.width;
var height = block.height; var height = block.height;
selectionEnd = Pos(selectionStart.line + height, selectionStart.ch + width); selectionEnd = new Pos(selectionStart.line + height, selectionStart.ch + width);
var selections = []; var selections = [];
// selectBlock creates a 'proper' rectangular block. // selectBlock creates a 'proper' rectangular block.
// We do not want that in all cases, so we manually set selections. // We do not want that in all cases, so we manually set selections.
for (var i = selectionStart.line; i < selectionEnd.line; i++) { for (var i = selectionStart.line; i < selectionEnd.line; i++) {
var anchor = Pos(i, selectionStart.ch); var anchor = new Pos(i, selectionStart.ch);
var head = Pos(i, selectionEnd.ch); var head = new Pos(i, selectionEnd.ch);
var range = {anchor: anchor, head: head}; var range = {anchor: anchor, head: head};
selections.push(range); selections.push(range);
} }
@ -3153,8 +3143,8 @@
var ch = end.ch - start.ch; var ch = end.ch - start.ch;
selectionEnd = {line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch}; selectionEnd = {line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch};
if (lastSelection.visualLine) { if (lastSelection.visualLine) {
selectionStart = Pos(selectionStart.line, 0); selectionStart = new Pos(selectionStart.line, 0);
selectionEnd = Pos(selectionEnd.line, lineLength(cm, selectionEnd.line)); selectionEnd = new Pos(selectionEnd.line, lineLength(cm, selectionEnd.line));
} }
cm.setSelection(selectionStart, selectionEnd); cm.setSelection(selectionStart, selectionEnd);
} }
@ -3203,7 +3193,7 @@
head = cursorMax(head, end); head = cursorMax(head, end);
head = offsetCursor(head, 0, -1); head = offsetCursor(head, 0, -1);
if (head.ch == -1 && head.line != cm.firstLine()) { 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]; return [anchor, head];
@ -3219,7 +3209,6 @@
vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char'; vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char';
var cmSel = makeCmSelection(cm, sel, mode); var cmSel = makeCmSelection(cm, sel, mode);
cm.setSelections(cmSel.ranges, cmSel.primary); cm.setSelections(cmSel.ranges, cmSel.primary);
updateFakeCursor(cm);
} }
function makeCmSelection(cm, sel, mode, exclusive) { function makeCmSelection(cm, sel, mode, exclusive) {
var head = copyCursor(sel.head); var head = copyCursor(sel.head);
@ -3252,16 +3241,18 @@
}; };
} else if (mode == 'block') { } else if (mode == 'block') {
var top = Math.min(anchor.line, head.line), 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), 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 height = bottom - top + 1;
var primary = head.line == top ? 0 : height - 1; var primary = head.line == top ? 0 : height - 1;
var ranges = []; var ranges = [];
for (var i = 0; i < height; i++) { for (var i = 0; i < height; i++) {
ranges.push({ ranges.push({
anchor: Pos(top + i, left), anchor: new Pos(top + i, fromCh),
head: Pos(top + i, right) head: new Pos(top + i, toCh)
}); });
} }
return { return {
@ -3295,7 +3286,6 @@
vim.visualLine = false; vim.visualLine = false;
vim.visualBlock = false; vim.visualBlock = false;
if (!vim.insertMode) CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); if (!vim.insertMode) CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"});
clearFakeCursor(vim);
} }
// Remove any trailing newlines from the selection. For // Remove any trailing newlines from the selection. For
@ -3383,7 +3373,7 @@
if (!start) { start = wordStart; } 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) };
} }
/** /**
@ -3557,7 +3547,7 @@
} }
} }
if (state.nextCh || state.curMoveThrough) { if (state.nextCh || state.curMoveThrough) {
return Pos(line, state.index); return new Pos(line, state.index);
} }
return cur; return cur;
} }
@ -3669,7 +3659,7 @@
break; break;
} }
words.push(word); 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 shortCircuit = words.length != repeat;
var firstWord = words[0]; var firstWord = words[0];
@ -3680,25 +3670,25 @@
// We did not start in the middle of a word. Discard the extra word at the end. // We did not start in the middle of a word. Discard the extra word at the end.
lastWord = words.pop(); lastWord = words.pop();
} }
return Pos(lastWord.line, lastWord.from); return new Pos(lastWord.line, lastWord.from);
} else if (forward && wordEnd) { } else if (forward && wordEnd) {
return Pos(lastWord.line, lastWord.to - 1); return new Pos(lastWord.line, lastWord.to - 1);
} else if (!forward && wordEnd) { } else if (!forward && wordEnd) {
// ge // ge
if (!shortCircuit && (firstWord.to != curStart.ch || firstWord.line != curStart.line)) { 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. // We did not start in the middle of a word. Discard the extra word at the end.
lastWord = words.pop(); lastWord = words.pop();
} }
return Pos(lastWord.line, lastWord.to); return new Pos(lastWord.line, lastWord.to);
} else { } else {
// b // b
return Pos(lastWord.line, lastWord.from); return new Pos(lastWord.line, lastWord.from);
} }
} }
function moveToEol(cm, head, motionArgs, vim, keepHPos) { function moveToEol(cm, head, motionArgs, vim, keepHPos) {
var cur = head; 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); var end=cm.clipPos(retval);
end.ch--; end.ch--;
if (!keepHPos) { if (!keepHPos) {
@ -3720,14 +3710,14 @@
} }
start = idx; start = idx;
} }
return Pos(cm.getCursor().line, idx); return new Pos(cm.getCursor().line, idx);
} }
function moveToColumn(cm, repeat) { function moveToColumn(cm, repeat) {
// repeat is always >= 1, so repeat - 1 always corresponds // repeat is always >= 1, so repeat - 1 always corresponds
// to the column we want to go to. // to the column we want to go to.
var line = cm.getCursor().line; 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) { function updateMark(cm, vim, markName, pos) {
@ -3979,7 +3969,7 @@
repeat--; 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 // TODO: perhaps this finagling of start and end positions belongs
@ -4002,8 +3992,8 @@
// cursor is on a matching open bracket. // cursor is on a matching open bracket.
var offset = curChar === openSym ? 1 : 0; var offset = curChar === openSym ? 1 : 0;
start = 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(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) { if (!start || !end) {
return { start: cur, end: cur }; return { start: cur, end: cur };
@ -4084,8 +4074,8 @@
} }
return { return {
start: Pos(cur.line, start), start: new Pos(cur.line, start),
end: Pos(cur.line, end) end: new Pos(cur.line, end)
}; };
} }
@ -4335,7 +4325,7 @@
} }
function showConfirm(cm, template) { 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) { if (cm.openNotification) {
cm.openNotification(pre, {bottom: true, duration: 5000}); cm.openNotification(pre, {bottom: true, duration: 5000});
} else { } else {
@ -4353,7 +4343,6 @@
} }
function showPrompt(cm, options) { function showPrompt(cm, options) {
var shortText = (options.prefix || '') + ' ' + (options.desc || '');
var template = makePrompt(options.prefix, options.desc); var template = makePrompt(options.prefix, options.desc);
if (cm.openDialog) { if (cm.openDialog) {
cm.openDialog(template, options.onClose, { cm.openDialog(template, options.onClose, {
@ -4362,6 +4351,9 @@
}); });
} }
else { else {
var shortText = '';
if (typeof options.prefix != "string" && options.prefix) shortText += options.prefix.textContent;
if (options.desc) shortText += " " + options.desc;
options.onClose(prompt(shortText, '')); options.onClose(prompt(shortText, ''));
} }
} }
@ -4436,6 +4428,7 @@
function highlightSearchMatches(cm, query) { function highlightSearchMatches(cm, query) {
clearTimeout(highlightTimeout); clearTimeout(highlightTimeout);
highlightTimeout = setTimeout(function() { highlightTimeout = setTimeout(function() {
if (!cm.state.vim) return;
var searchState = getSearchState(cm); var searchState = getSearchState(cm);
var overlay = searchState.getOverlay(); var overlay = searchState.getOverlay();
if (!overlay || query != overlay.query) { if (!overlay || query != overlay.query) {
@ -4473,7 +4466,7 @@
// SearchCursor may have returned null because it hit EOF, wrap // SearchCursor may have returned null because it hit EOF, wrap
// around and try again. // around and try again.
cursor = cm.getSearchCursor(query, 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)) { if (!cursor.find(prev)) {
return; return;
} }
@ -4509,7 +4502,7 @@
// SearchCursor may have returned null because it hit EOF, wrap // SearchCursor may have returned null because it hit EOF, wrap
// around and try again. // around and try again.
cursor = cm.getSearchCursor(query, 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)) { if (!cursor.find(prev)) {
return; return;
} }
@ -4565,7 +4558,7 @@
function getMarkPos(cm, vim, markName) { function getMarkPos(cm, vim, markName) {
if (markName == '\'' || 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 == '.') { } else if (markName == '.') {
return getLastEditPos(cm); return getLastEditPos(cm);
} }
@ -4630,7 +4623,7 @@
if (command.type == 'exToKey') { if (command.type == 'exToKey') {
// Handle Ex to Key mapping. // Handle Ex to Key mapping.
for (var i = 0; i < command.toKeys.length; i++) { 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; return;
} else if (command.type == 'exToEx') { } else if (command.type == 'exToEx') {
@ -4805,7 +4798,7 @@
var commandName = lhs.substring(1); var commandName = lhs.substring(1);
if (this.commandMap_[commandName] && this.commandMap_[commandName].user) { if (this.commandMap_[commandName] && this.commandMap_[commandName].user) {
delete this.commandMap_[commandName]; delete this.commandMap_[commandName];
return; return true;
} }
} else { } else {
// Key to Ex or key to key mapping // Key to Ex or key to key mapping
@ -4814,11 +4807,10 @@
if (keys == defaultKeymap[i].keys if (keys == defaultKeymap[i].keys
&& defaultKeymap[i].context === ctx) { && defaultKeymap[i].context === ctx) {
defaultKeymap.splice(i, 1); defaultKeymap.splice(i, 1);
return; return true;
} }
} }
} }
throw Error('No such mapping.');
} }
}; };
@ -4845,13 +4837,11 @@
vmap: function(cm, params) { this.map(cm, params, 'visual'); }, vmap: function(cm, params) { this.map(cm, params, 'visual'); },
unmap: function(cm, params, ctx) { unmap: function(cm, params, ctx) {
var mapArgs = params.args; var mapArgs = params.args;
if (!mapArgs || mapArgs.length < 1) { if (!mapArgs || mapArgs.length < 1 || !exCommandDispatcher.unmap(mapArgs[0], ctx)) {
if (cm) { if (cm) {
showConfirm(cm, 'No such mapping: ' + params.input); showConfirm(cm, 'No such mapping: ' + params.input);
} }
return;
} }
exCommandDispatcher.unmap(mapArgs[0], ctx);
}, },
move: function(cm, params) { move: function(cm, params) {
commandDispatcher.processCommand(cm, cm.state.vim, { commandDispatcher.processCommand(cm, cm.state.vim, {
@ -4979,8 +4969,8 @@
var lineStart = params.line || cm.firstLine(); var lineStart = params.line || cm.firstLine();
var lineEnd = params.lineEnd || params.line || cm.lastLine(); var lineEnd = params.lineEnd || params.line || cm.lastLine();
if (lineStart == lineEnd) { return; } if (lineStart == lineEnd) { return; }
var curStart = Pos(lineStart, 0); var curStart = new Pos(lineStart, 0);
var curEnd = Pos(lineEnd, lineLength(cm, lineEnd)); var curEnd = new Pos(lineEnd, lineLength(cm, lineEnd));
var text = cm.getRange(curStart, curEnd).split('\n'); var text = cm.getRange(curStart, curEnd).split('\n');
var numberRegex = pattern ? pattern : var numberRegex = pattern ? pattern :
(number == 'decimal') ? /(-?)([\d]+)/ : (number == 'decimal') ? /(-?)([\d]+)/ :
@ -5186,7 +5176,7 @@
lineStart = lineEnd; lineStart = lineEnd;
lineEnd = lineStart + count - 1; 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); var cursor = cm.getSearchCursor(query, startPos);
doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback); doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback);
}, },
@ -5486,7 +5476,7 @@
match = (/<\w+-.+?>|<\w+>|./).exec(text); match = (/<\w+-.+?>|<\w+>|./).exec(text);
key = match[0]; key = match[0];
text = text.substring(match.index + key.length); text = text.substring(match.index + key.length);
CodeMirror.Vim.handleKey(cm, key, 'macro'); vimApi.handleKey(cm, key, 'macro');
if (vim.insertMode) { if (vim.insertMode) {
var changes = register.insertModeChanges[imc++].changes; var changes = register.insertModeChanges[imc++].changes;
vimGlobalState.macroModeState.lastInsertModeChanges.changes = vimGlobalState.macroModeState.lastInsertModeChanges.changes =
@ -5581,36 +5571,6 @@
} else if (!cm.curOp.isVimOp) { } else if (!cm.curOp.isVimOp) {
handleExternalSelection(cm, vim); 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) { function handleExternalSelection(cm, vim) {
var anchor = cm.getCursor('anchor'); var anchor = cm.getCursor('anchor');
@ -5752,12 +5712,12 @@
if (change instanceof InsertModeKey) { if (change instanceof InsertModeKey) {
CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler); CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler);
} else if (typeof change == "string") { } else if (typeof change == "string") {
var cur = cm.getCursor(); cm.replaceSelection(change);
cm.replaceRange(change, cur, cur);
} else { } else {
var start = cm.getCursor(); var start = cm.getCursor();
var end = offsetCursor(start, 0, change[0].length); var end = offsetCursor(start, 0, change[0].length);
cm.replaceRange(change[0], start, end); cm.replaceRange(change[0], start, end);
cm.setCursor(end);
} }
} }
} }

View File

@ -60,19 +60,13 @@
.cm-fat-cursor div.CodeMirror-cursors { .cm-fat-cursor div.CodeMirror-cursors {
z-index: 1; z-index: 1;
} }
.cm-fat-cursor-mark { .cm-fat-cursor .CodeMirror-line::selection,
background-color: rgba(20, 255, 20, 0.5); .cm-fat-cursor .CodeMirror-line > span::selection,
-webkit-animation: blink 1.06s steps(1) infinite; .cm-fat-cursor .CodeMirror-line > span > span::selection { background: transparent; }
-moz-animation: blink 1.06s steps(1) infinite; .cm-fat-cursor .CodeMirror-line::-moz-selection,
animation: blink 1.06s steps(1) infinite; .cm-fat-cursor .CodeMirror-line > span::-moz-selection,
} .cm-fat-cursor .CodeMirror-line > span > span::-moz-selection { background: transparent; }
.cm-animate-fat-cursor { .cm-fat-cursor { caret-color: transparent; }
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;
}
@-moz-keyframes blink { @-moz-keyframes blink {
0% {} 0% {}
50% { background-color: transparent; } 50% { background-color: transparent; }
@ -170,6 +164,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
height: 100%; height: 100%;
outline: none; /* Prevent dragging from highlighting the element */ outline: none; /* Prevent dragging from highlighting the element */
position: relative; position: relative;
z-index: 0;
} }
.CodeMirror-sizer { .CodeMirror-sizer {
position: relative; position: relative;

View File

@ -2351,6 +2351,7 @@
function mapFromLineView(lineView, line, lineN) { function mapFromLineView(lineView, line, lineN) {
if (lineView.line == line) if (lineView.line == line)
{ return {map: lineView.measure.map, cache: lineView.measure.cache} } { return {map: lineView.measure.map, cache: lineView.measure.cache} }
if (lineView.rest) {
for (var i = 0; i < lineView.rest.length; i++) for (var i = 0; i < lineView.rest.length; i++)
{ if (lineView.rest[i] == line) { if (lineView.rest[i] == line)
{ return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } } { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
@ -2358,6 +2359,7 @@
{ if (lineNo(lineView.rest[i$1]) > lineN) { if (lineNo(lineView.rest[i$1]) > lineN)
{ return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } } { 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 // Render a line into the hidden node display.externalMeasured. Used
// when measurement is needed for a line that's not in the viewport. // when measurement is needed for a line that's not in the viewport.
@ -2583,9 +2585,11 @@
} }
function widgetTopHeight(lineObj) { function widgetTopHeight(lineObj) {
var ref = visualLine(lineObj);
var widgets = ref.widgets;
var height = 0; var height = 0;
if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) if (widgets) { for (var i = 0; i < widgets.length; ++i) { if (widgets[i].above)
{ height += widgetHeight(lineObj.widgets[i]); } } } { height += widgetHeight(widgets[i]); } } }
return height return height
} }
@ -3150,13 +3154,19 @@
var curFragment = result.cursors = document.createDocumentFragment(); var curFragment = result.cursors = document.createDocumentFragment();
var selFragment = result.selection = 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++) { for (var i = 0; i < doc.sel.ranges.length; i++) {
if (!primary && i == doc.sel.primIndex) { continue } if (!primary && i == doc.sel.primIndex) { continue }
var range = doc.sel.ranges[i]; var range = doc.sel.ranges[i];
if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue } if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }
var collapsed = range.empty(); var collapsed = range.empty();
if (collapsed || cm.options.showCursorWhenSelecting) if (customCursor) {
{ drawSelectionCursor(cm, range.head, curFragment); } var head = customCursor(cm, range);
if (head) { drawSelectionCursor(cm, head, curFragment); }
} else if (collapsed || cm.options.showCursorWhenSelecting) {
drawSelectionCursor(cm, range.head, curFragment);
}
if (!collapsed) if (!collapsed)
{ drawSelectionRange(cm, range, selFragment); } { drawSelectionRange(cm, range, selFragment); }
} }
@ -3174,9 +3184,8 @@
if (/\bcm-fat-cursor\b/.test(cm.getWrapperElement().className)) { if (/\bcm-fat-cursor\b/.test(cm.getWrapperElement().className)) {
var charPos = charCoords(cm, head, "div", null, null); var charPos = charCoords(cm, head, "div", null, null);
if (charPos.right - charPos.left > 0) { var width = charPos.right - charPos.left;
cursor.style.width = (charPos.right - charPos.left) + "px"; cursor.style.width = (width > 0 ? width : cm.defaultCharWidth()) + "px";
}
} }
if (pos.other) { if (pos.other) {
@ -3649,6 +3658,7 @@
this.vert.firstChild.style.height = this.vert.firstChild.style.height =
Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px"; Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
} else { } else {
this.vert.scrollTop = 0;
this.vert.style.display = ""; this.vert.style.display = "";
this.vert.firstChild.style.height = "0"; this.vert.firstChild.style.height = "0";
} }
@ -9832,7 +9842,7 @@
addLegacyProps(CodeMirror); addLegacyProps(CodeMirror);
CodeMirror.version = "5.63.3"; CodeMirror.version = "5.65.1";
return CodeMirror; return CodeMirror;

View File

@ -443,13 +443,15 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"monochrome", "min-monochrome", "max-monochrome", "resolution", "monochrome", "min-monochrome", "max-monochrome", "resolution",
"min-resolution", "max-resolution", "scan", "grid", "orientation", "min-resolution", "max-resolution", "scan", "grid", "orientation",
"device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio", "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_); ], mediaFeatures = keySet(mediaFeatures_);
var mediaValueKeywords_ = [ var mediaValueKeywords_ = [
"landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover", "landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover",
"interlace", "progressive", "interlace", "progressive",
"dark", "light" "dark", "light",
"standard", "high"
], mediaValueKeywords = keySet(mediaValueKeywords_); ], mediaValueKeywords = keySet(mediaValueKeywords_);
var propertyKeywords_ = [ var propertyKeywords_ = [
@ -635,7 +637,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch", "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
"cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote", "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
"col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse", "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse",
"compact", "condensed", "contain", "content", "contents", "compact", "condensed", "conic-gradient", "contain", "content", "contents",
"content-box", "context-menu", "continuous", "contrast", "copy", "counter", "counters", "cover", "crop", "content-box", "context-menu", "continuous", "contrast", "copy", "counter", "counters", "cover", "crop",
"cross", "crosshair", "cubic-bezier", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal", "cross", "crosshair", "cubic-bezier", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal",
"decimal-leading-zero", "default", "default-button", "dense", "destination-atop", "decimal-leading-zero", "default", "default-button", "dense", "destination-atop",
@ -685,8 +687,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d",
"progress", "push-button", "radial-gradient", "radio", "read-only", "progress", "push-button", "radial-gradient", "radio", "read-only",
"read-write", "read-write-plaintext-only", "rectangle", "region", "read-write", "read-write-plaintext-only", "rectangle", "region",
"relative", "repeat", "repeating-linear-gradient", "relative", "repeat", "repeating-linear-gradient", "repeating-radial-gradient",
"repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse", "repeating-conic-gradient", "repeat-x", "repeat-y", "reset", "reverse",
"rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY", "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
"rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running", "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running",
"s-resize", "sans-serif", "saturate", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen", "s-resize", "sans-serif", "saturate", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen",

View File

@ -330,6 +330,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
cx.state.context = new Context(cx.state.context, cx.state.localVars, true) cx.state.context = new Context(cx.state.context, cx.state.localVars, true)
cx.state.localVars = null cx.state.localVars = null
} }
pushcontext.lex = pushblockcontext.lex = true
function popcontext() { function popcontext() {
cx.state.localVars = cx.state.context.vars cx.state.localVars = cx.state.context.vars
cx.state.context = cx.state.context.prev cx.state.context = cx.state.context.prev

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
## stylelint-bundle v13.8.0 ## stylelint-bundle v14.2.0
Files downloaded from URL: Files downloaded from URL:
* LICENSE: https://github.com/stylelint/stylelint/raw/13.8.0/LICENSE * LICENSE: https://github.com/stylelint/stylelint/raw/14.2.0/LICENSE
Files copied from NPM (node_modules): Files copied from NPM (node_modules):

File diff suppressed because one or more lines are too long