This commit is contained in:
Dana Meli 2018-10-26 22:20:30 -07:00
parent 087366983a
commit 63f40ee1de
6 changed files with 9418 additions and 9370 deletions

View File

@ -7,8 +7,8 @@
"author": "Stylus Team",
"devDependencies": {
"archiver": "^3.0.0",
"codemirror": "^5.40.2",
"eslint": "^5.6.1",
"codemirror": "^5.41.0",
"eslint": "^5.8.0",
"fs-extra": "^7.0.0",
"jsonlint": "^1.6.3",
"less": "^3.8.1",
@ -17,7 +17,7 @@
"semver-bundle": "^0.1.1",
"stylelint-bundle": "^8.0.0",
"stylus-lang-bundle": "^0.54.5",
"updates": "^4.5.2"
"updates": "^5.1.2"
},
"scripts": {
"lint": "eslint **/*.js --cache || exit 0",

View File

@ -1,3 +1,3 @@
## CodeMirror v5.40.2
## CodeMirror v5.41.0
Only files & folders that exist in the `vendor/codemirror` folder are copied from the `node_modules/codemirror` folder. Except all theme files are copied, in case new themes have been added.

View File

@ -54,7 +54,7 @@ CodeMirror.registerHelper("fold", "brace", function(cm, start) {
++pos;
}
}
if (end == null || line == end && endCh == startCh) return;
if (end == null || line == end) return;
return {from: CodeMirror.Pos(line, startCh),
to: CodeMirror.Pos(end, endCh)};
});

View File

@ -3,7 +3,7 @@
/**
* Supported keybindings:
* Too many to list. Refer to defaultKeyMap below.
* Too many to list. Refer to defaultKeymap below.
*
* Supported Ex commands:
* Refer to defaultExCommandMap below.
@ -207,6 +207,7 @@
// Ex command
{ keys: ':', type: 'ex' }
];
var defaultKeymapLength = defaultKeymap.length;
/**
* Ex commands
@ -742,6 +743,78 @@
unmap: function(lhs, ctx) {
exCommandDispatcher.unmap(lhs, ctx);
},
// Non-recursive map function.
// NOTE: This will not create mappings to key maps that aren't present
// in the default key map. See TODO at bottom of function.
noremap: function(lhs, rhs, ctx) {
function toCtxArray(ctx) {
return ctx ? [ctx] : ['normal', 'insert', 'visual'];
}
var ctxsToMap = toCtxArray(ctx);
// Look through all actual defaults to find a map candidate.
var actualLength = defaultKeymap.length, origLength = defaultKeymapLength;
for (var i = actualLength - origLength;
i < actualLength && ctxsToMap.length;
i++) {
var mapping = defaultKeymap[i];
// Omit mappings that operate in the wrong context(s) and those of invalid type.
if (mapping.keys == rhs &&
(!ctx || !mapping.context || mapping.context === ctx) &&
mapping.type.substr(0, 2) !== 'ex' &&
mapping.type.substr(0, 3) !== 'key') {
// Make a shallow copy of the original keymap entry.
var newMapping = {};
for (var key in mapping) {
newMapping[key] = mapping[key];
}
// Modify it point to the new mapping with the proper context.
newMapping.keys = lhs;
if (ctx && !newMapping.context) {
newMapping.context = ctx;
}
// Add it to the keymap with a higher priority than the original.
this._mapCommand(newMapping);
// Record the mapped contexts as complete.
var mappedCtxs = toCtxArray(mapping.context);
ctxsToMap = ctxsToMap.filter(function(el) { return mappedCtxs.indexOf(el) === -1; });
}
}
// TODO: Create non-recursive keyToKey mappings for the unmapped contexts once those exist.
},
// Remove all user-defined mappings for the provided context.
mapclear: function(ctx) {
// Partition the existing keymap into user-defined and true defaults.
var actualLength = defaultKeymap.length,
origLength = defaultKeymapLength;
var userKeymap = defaultKeymap.slice(0, actualLength - origLength);
defaultKeymap = defaultKeymap.slice(actualLength - origLength);
if (ctx) {
// If a specific context is being cleared, we need to keep mappings
// from all other contexts.
for (var i = userKeymap.length - 1; i >= 0; i--) {
var mapping = userKeymap[i];
if (ctx !== mapping.context) {
if (mapping.context) {
this._mapCommand(mapping);
} else {
// `mapping` applies to all contexts so create keymap copies
// for each context except the one being cleared.
var contexts = ['normal', 'insert', 'visual'];
for (var j in contexts) {
if (contexts[j] !== ctx) {
var newMapping = {};
for (var key in mapping) {
newMapping[key] = mapping[key];
}
newMapping.context = contexts[j];
this._mapCommand(newMapping);
}
}
}
}
}
}
},
// TODO: Expose setOption and getOption as instance methods. Need to decide how to namespace
// them, or somehow make them work with the existing CodeMirror setOption/getOption API.
setOption: setOption,
@ -5040,32 +5113,7 @@
var insertModeChangeRegister = vimGlobalState.registerController.getRegister('.');
var isPlaying = macroModeState.isPlaying;
var lastChange = macroModeState.lastInsertModeChanges;
// In case of visual block, the insertModeChanges are not saved as a
// single word, so we convert them to a single word
// so as to update the ". register as expected in real vim.
var text = [];
if (!isPlaying) {
var selLength = lastChange.inVisualBlock && vim.lastSelection ?
vim.lastSelection.visualBlock.height : 1;
var changes = lastChange.changes;
var text = [];
var i = 0;
// In case of multiple selections in blockwise visual,
// the inserted text, for example: 'f<Backspace>oo', is stored as
// 'f', 'f', InsertModeKey 'o', 'o', 'o', 'o'. (if you have a block with 2 lines).
// We push the contents of the changes array as per the following:
// 1. In case of InsertModeKey, just increment by 1.
// 2. In case of a character, jump by selLength (2 in the example).
while (i < changes.length) {
// This loop will convert 'ff<bs>oooo' to 'f<bs>oo'.
text.push(changes[i]);
if (changes[i] instanceof InsertModeKey) {
i++;
} else {
i+= selLength;
}
}
lastChange.changes = text;
cm.off('change', onChange);
CodeMirror.off(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown);
}
@ -5196,17 +5244,24 @@
if (!macroModeState.isPlaying) {
while(changeObj) {
lastChange.expectCursorActivityForChange = true;
if (changeObj.origin == '+input' || changeObj.origin == 'paste'
if (lastChange.ignoreCount > 1) {
lastChange.ignoreCount--;
} else if (changeObj.origin == '+input' || changeObj.origin == 'paste'
|| changeObj.origin === undefined /* only in testing */) {
var selectionCount = cm.listSelections().length;
if (selectionCount > 1)
lastChange.ignoreCount = selectionCount;
var text = changeObj.text.join('\n');
if (lastChange.maybeReset) {
lastChange.changes = [];
lastChange.maybeReset = false;
}
if (cm.state.overwrite && !/\n/.test(text)) {
if (text) {
if (cm.state.overwrite && !/\n/.test(text)) {
lastChange.changes.push([text]);
} else {
} else {
lastChange.changes.push(text);
}
}
}
// Change objects may be chained with next.

File diff suppressed because it is too large Load Diff

View File

@ -501,7 +501,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"margin-bottom", "margin-left", "margin-right", "margin-top",
"marks", "marquee-direction", "marquee-loop",
"marquee-play-count", "marquee-speed", "marquee-style", "max-height",
"max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index",
"max-width", "min-height", "min-width", "mix-blend-mode", "move-to", "nav-down", "nav-index",
"nav-left", "nav-right", "nav-up", "object-fit", "object-position",
"opacity", "order", "orphans", "outline",
"outline-color", "outline-offset", "outline-style", "outline-width",