codemirror 5.63.1

This commit is contained in:
tophf 2021-10-01 17:48:04 +03:00
parent eaef854bcf
commit dc18320b60
7 changed files with 50 additions and 28 deletions

18
package-lock.json generated
View File

@ -1,15 +1,15 @@
{ {
"name": "Stylus", "name": "Stylus",
"version": "1.5.20", "version": "1.5.22",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "Stylus", "name": "Stylus",
"version": "1.5.20", "version": "1.5.22",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"dependencies": { "dependencies": {
"codemirror": "5.62.3", "codemirror": "5.63.1",
"db-to-cloud": "^0.6.0", "db-to-cloud": "^0.6.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",
@ -2365,9 +2365,9 @@
} }
}, },
"node_modules/codemirror": { "node_modules/codemirror": {
"version": "5.62.3", "version": "5.63.1",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.62.3.tgz", "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.63.1.tgz",
"integrity": "sha512-zZAyOfN8TU67ngqrxhOgtkSAGV9jSpN1snbl8elPtnh9Z5A11daR405+dhLzLnuXrwX0WCShWlybxPN3QC/9Pg==" "integrity": "sha512-baivaNZreZOGh1/tYyTvCupC9NeWk7qlZeGUDi4nFKj/J0JU8FYKZND4QqLw70P7HOttlCt4JJAOj9GoIhHEkA=="
}, },
"node_modules/collection-visit": { "node_modules/collection-visit": {
"version": "1.0.0", "version": "1.0.0",
@ -13938,9 +13938,9 @@
} }
}, },
"codemirror": { "codemirror": {
"version": "5.62.3", "version": "5.63.1",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.62.3.tgz", "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.63.1.tgz",
"integrity": "sha512-zZAyOfN8TU67ngqrxhOgtkSAGV9jSpN1snbl8elPtnh9Z5A11daR405+dhLzLnuXrwX0WCShWlybxPN3QC/9Pg==" "integrity": "sha512-baivaNZreZOGh1/tYyTvCupC9NeWk7qlZeGUDi4nFKj/J0JU8FYKZND4QqLw70P7HOttlCt4JJAOj9GoIhHEkA=="
}, },
"collection-visit": { "collection-visit": {
"version": "1.0.0", "version": "1.0.0",

View File

@ -9,7 +9,7 @@
"codemirror": "WARNING! Always use an exact version and test it for a while before releasing" "codemirror": "WARNING! Always use an exact version and test it for a while before releasing"
}, },
"dependencies": { "dependencies": {
"codemirror": "5.62.3", "codemirror": "5.63.1",
"db-to-cloud": "^0.6.0", "db-to-cloud": "^0.6.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",

View File

@ -1,4 +1,4 @@
## codemirror v5.62.3 ## codemirror v5.63.1
Following files are copied from npm (node_modules): Following files are copied from npm (node_modules):
@ -27,6 +27,7 @@ Following files are copied from npm (node_modules):
* keymap\emacs.js * keymap\emacs.js
* keymap\sublime.js * keymap\sublime.js
* keymap\vim.js * keymap\vim.js
* lib\#codemirror.js#
* lib\codemirror.css * lib\codemirror.css
* lib\codemirror.js * lib\codemirror.js
* mode\css * mode\css

View File

@ -330,9 +330,9 @@
cmds.previousLine = move(byLine, -1); cmds.previousLine = move(byLine, -1);
cmds.scrollDownCommand = move(byPage, 1); cmds.scrollDownCommand = move(byPage, -1);
cmds.scrollUpCommand = move(byPage, -1); cmds.scrollUpCommand = move(byPage, 1);
cmds.backwardParagraph = move(byParagraph, -1); cmds.backwardParagraph = move(byParagraph, -1);
@ -480,8 +480,8 @@
"Home": "goLineStart", "Home": "goLineStart",
"Alt-V": "scrollDownCommand", "Alt-V": "scrollDownCommand",
"Ctrl-V": "scrollUpCommand", "Ctrl-V": "scrollUpCommand",
"PageUp": "scrollUpCommand", "PageUp": "scrollDownCommand",
"PageDown": "scrollDownCommand", "PageDown": "scrollUpCommand",
"Ctrl-Up": "backwardParagraph", "Ctrl-Up": "backwardParagraph",
"Ctrl-Down": "forwardParagraph", "Ctrl-Down": "forwardParagraph",
"Alt-{": "backwardParagraph", "Alt-{": "backwardParagraph",

View File

@ -951,7 +951,12 @@
if (!keysMatcher) { clearInputState(cm); return false; } if (!keysMatcher) { clearInputState(cm); return false; }
var context = vim.visualMode ? 'visual' : var context = vim.visualMode ? 'visual' :
'normal'; '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; } if (match.type == 'none') { clearInputState(cm); return false; }
else if (match.type == 'partial') { return true; } else if (match.type == 'partial') { return true; }
@ -1311,6 +1316,9 @@
} }
inputState.operator = command.operator; inputState.operator = command.operator;
inputState.operatorArgs = copyArgs(command.operatorArgs); inputState.operatorArgs = copyArgs(command.operatorArgs);
if (command.keys.length > 1) {
inputState.operatorShortcut = command.keys;
}
if (command.exitVisualBlock) { if (command.exitVisualBlock) {
vim.visualBlock = false; vim.visualBlock = false;
updateCmSelection(cm); updateCmSelection(cm);

View File

@ -3174,7 +3174,9 @@
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);
cursor.style.width = Math.max(0, charPos.right - charPos.left) + "px"; if (charPos.right - charPos.left > 0) {
cursor.style.width = (charPos.right - charPos.left) + "px";
}
} }
if (pos.other) { if (pos.other) {
@ -3349,10 +3351,14 @@
function updateHeightsInViewport(cm) { function updateHeightsInViewport(cm) {
var display = cm.display; var display = cm.display;
var prevBottom = display.lineDiv.offsetTop; 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++) { for (var i = 0; i < display.view.length; i++) {
var cur = display.view[i], wrapping = cm.options.lineWrapping; var cur = display.view[i], wrapping = cm.options.lineWrapping;
var height = (void 0), width = 0; var height = (void 0), width = 0;
if (cur.hidden) { continue } if (cur.hidden) { continue }
oldHeight += cur.line.height;
if (ie && ie_version < 8) { if (ie && ie_version < 8) {
var bot = cur.node.offsetTop + cur.node.offsetHeight; var bot = cur.node.offsetTop + cur.node.offsetHeight;
height = bot - prevBottom; height = bot - prevBottom;
@ -3367,6 +3373,7 @@
} }
var diff = cur.line.height - height; var diff = cur.line.height - height;
if (diff > .005 || diff < -.005) { if (diff > .005 || diff < -.005) {
if (oldHeight < viewTop) { mustScroll -= diff; }
updateLineHeight(cur.line, height); updateLineHeight(cur.line, height);
updateWidgetHeight(cur.line); updateWidgetHeight(cur.line);
if (cur.rest) { for (var j = 0; j < cur.rest.length; j++) if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
@ -3381,6 +3388,7 @@
} }
} }
} }
if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; }
} }
// Read and store the height of line widgets associated with the // Read and store the height of line widgets associated with the
@ -4492,6 +4500,12 @@
function onScrollWheel(cm, e) { function onScrollWheel(cm, e) {
var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y; var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
var pixelsPerUnit = wheelPixelsPerUnit;
if (event.deltaMode === 0) {
dx = e.deltaX;
dy = e.deltaY;
pixelsPerUnit = 1;
}
var display = cm.display, scroll = display.scroller; var display = cm.display, scroll = display.scroller;
// Quit if there's nothing to scroll here // Quit if there's nothing to scroll here
@ -4520,10 +4534,10 @@
// estimated pixels/delta value, we just handle horizontal // estimated pixels/delta value, we just handle horizontal
// scrolling entirely here. It'll be slightly off from native, but // scrolling entirely here. It'll be slightly off from native, but
// better than glitching out. // better than glitching out.
if (dx && !gecko && !presto && wheelPixelsPerUnit != null) { if (dx && !gecko && !presto && pixelsPerUnit != null) {
if (dy && canScrollY) if (dy && canScrollY)
{ updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); } { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * pixelsPerUnit)); }
setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit)); setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * pixelsPerUnit));
// Only prevent default scrolling if vertical scrolling is // Only prevent default scrolling if vertical scrolling is
// actually possible. Otherwise, it causes vertical scroll // actually possible. Otherwise, it causes vertical scroll
// jitter on OSX trackpads when deltaX is small and deltaY // jitter on OSX trackpads when deltaX is small and deltaY
@ -4536,15 +4550,15 @@
// 'Project' the visible viewport to cover the area that is being // 'Project' the visible viewport to cover the area that is being
// scrolled into view (if we know enough to estimate it). // scrolled into view (if we know enough to estimate it).
if (dy && wheelPixelsPerUnit != null) { if (dy && pixelsPerUnit != null) {
var pixels = dy * wheelPixelsPerUnit; var pixels = dy * pixelsPerUnit;
var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight; var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
if (pixels < 0) { top = Math.max(0, top + pixels - 50); } if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
else { bot = Math.min(cm.doc.height, bot + pixels + 50); } else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
updateDisplaySimple(cm, {top: top, bottom: bot}); updateDisplaySimple(cm, {top: top, bottom: bot});
} }
if (wheelSamples < 20) { if (wheelSamples < 20 && e.deltaMode !== 0) {
if (display.wheelStartX == null) { if (display.wheelStartX == null) {
display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop; display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
display.wheelDX = dx; display.wheelDY = dy; display.wheelDX = dx; display.wheelDY = dy;
@ -8985,9 +8999,11 @@
ContentEditableInput.prototype.supportsTouch = function () { return true }; ContentEditableInput.prototype.supportsTouch = function () { return true };
ContentEditableInput.prototype.receivedFocus = function () { ContentEditableInput.prototype.receivedFocus = function () {
var this$1 = this;
var input = this; var input = this;
if (this.selectionInEditor()) if (this.selectionInEditor())
{ this.pollSelection(); } { setTimeout(function () { return this$1.pollSelection(); }, 20); }
else else
{ runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); } { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }
@ -9816,7 +9832,7 @@
addLegacyProps(CodeMirror); addLegacyProps(CodeMirror);
CodeMirror.version = "5.62.3"; CodeMirror.version = "5.63.1";
return CodeMirror; return CodeMirror;

View File

@ -35,12 +35,10 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png
.cm-s-solarized.cm-s-dark { .cm-s-solarized.cm-s-dark {
color: #839496; color: #839496;
background-color: #002b36; background-color: #002b36;
text-shadow: #002b36 0 1px;
} }
.cm-s-solarized.cm-s-light { .cm-s-solarized.cm-s-light {
background-color: #fdf6e3; background-color: #fdf6e3;
color: #657b83; color: #657b83;
text-shadow: #eee8d5 0 1px;
} }
.cm-s-solarized .CodeMirror-widget { .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 { .cm-s-solarized.cm-s-dark .CodeMirror-linenumber {
color: #586e75; color: #586e75;
text-shadow: #021014 0 -1px;
} }
/* Light */ /* Light */