From 37a174b092f2c3362a2ede9b0839724e444f0c5e Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 12 Oct 2021 16:05:21 +0300 Subject: [PATCH] CodeMirror 5.63.3 --- package-lock.json | 14 ++++----- package.json | 2 +- vendor/codemirror/README.md | 3 +- .../codemirror/addon/search/searchcursor.js | 31 ++++++++++++------- vendor/codemirror/keymap/vim.js | 27 ++++++++++------ vendor/codemirror/lib/codemirror.js | 6 ++-- 6 files changed, 50 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 01033cf5..d7d0cc31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.5.22", "license": "GPL-3.0-only", "dependencies": { - "codemirror": "5.63.1", + "codemirror": "5.63.3", "db-to-cloud": "^0.6.0", "jsonlint": "^1.6.3", "less-bundle": "github:openstyles/less-bundle#v0.1.0", @@ -2365,9 +2365,9 @@ } }, "node_modules/codemirror": { - "version": "5.63.1", - "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.63.1.tgz", - "integrity": "sha512-baivaNZreZOGh1/tYyTvCupC9NeWk7qlZeGUDi4nFKj/J0JU8FYKZND4QqLw70P7HOttlCt4JJAOj9GoIhHEkA==" + "version": "5.63.3", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.63.3.tgz", + "integrity": "sha512-1C+LELr+5grgJYqwZKqxrcbPsHFHapVaVAloBsFBASbpLnQqLw1U8yXJ3gT5D+rhxIiSpo+kTqN+hQ+9ialIXw==" }, "node_modules/collection-visit": { "version": "1.0.0", @@ -13938,9 +13938,9 @@ } }, "codemirror": { - "version": "5.63.1", - "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.63.1.tgz", - "integrity": "sha512-baivaNZreZOGh1/tYyTvCupC9NeWk7qlZeGUDi4nFKj/J0JU8FYKZND4QqLw70P7HOttlCt4JJAOj9GoIhHEkA==" + "version": "5.63.3", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.63.3.tgz", + "integrity": "sha512-1C+LELr+5grgJYqwZKqxrcbPsHFHapVaVAloBsFBASbpLnQqLw1U8yXJ3gT5D+rhxIiSpo+kTqN+hQ+9ialIXw==" }, "collection-visit": { "version": "1.0.0", diff --git a/package.json b/package.json index 8c5016db..4bfc0bc7 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "codemirror": "WARNING! Always use an exact version and test it for a while before releasing" }, "dependencies": { - "codemirror": "5.63.1", + "codemirror": "5.63.3", "db-to-cloud": "^0.6.0", "jsonlint": "^1.6.3", "less-bundle": "github:openstyles/less-bundle#v0.1.0", diff --git a/vendor/codemirror/README.md b/vendor/codemirror/README.md index e1f3820d..92a8be61 100644 --- a/vendor/codemirror/README.md +++ b/vendor/codemirror/README.md @@ -1,4 +1,4 @@ -## codemirror v5.63.1 +## codemirror v5.63.3 Following files are copied from npm (node_modules): @@ -27,7 +27,6 @@ Following files are copied from npm (node_modules): * keymap\emacs.js * keymap\sublime.js * keymap\vim.js -* lib\#codemirror.js# * lib\codemirror.css * lib\codemirror.js * mode\css diff --git a/vendor/codemirror/addon/search/searchcursor.js b/vendor/codemirror/addon/search/searchcursor.js index d5869578..230017b7 100644 --- a/vendor/codemirror/addon/search/searchcursor.js +++ b/vendor/codemirror/addon/search/searchcursor.js @@ -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 diff --git a/vendor/codemirror/keymap/vim.js b/vendor/codemirror/keymap/vim.js index ee699549..289d8d15 100644 --- a/vendor/codemirror/keymap/vim.js +++ b/vendor/codemirror/keymap/vim.js @@ -4305,7 +4305,7 @@ ignoreCase = (/^[^A-Z]*$/).test(regexPart); } var regexp = new RegExp(regexPart, - (ignoreCase || forceIgnoreCase) ? 'i' : undefined); + (ignoreCase || forceIgnoreCase) ? 'im' : 'm'); return regexp; } @@ -4461,7 +4461,14 @@ 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. @@ -5114,12 +5121,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$$&")); @@ -5309,10 +5310,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; diff --git a/vendor/codemirror/lib/codemirror.js b/vendor/codemirror/lib/codemirror.js index d2e5bcc5..2f626b70 100644 --- a/vendor/codemirror/lib/codemirror.js +++ b/vendor/codemirror/lib/codemirror.js @@ -4501,7 +4501,7 @@ function onScrollWheel(cm, e) { var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y; var pixelsPerUnit = wheelPixelsPerUnit; - if (event.deltaMode === 0) { + if (e.deltaMode === 0) { dx = e.deltaX; dy = e.deltaY; pixelsPerUnit = 1; @@ -8235,7 +8235,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 @@ -9832,7 +9832,7 @@ addLegacyProps(CodeMirror); - CodeMirror.version = "5.63.1"; + CodeMirror.version = "5.63.3"; return CodeMirror;