Skip to content

Commit

Permalink
Upgraded to 5.46.0
Browse files Browse the repository at this point in the history
  • Loading branch information
w8tcha committed Apr 25, 2019
1 parent 155f4a1 commit 15e7bf7
Show file tree
Hide file tree
Showing 14 changed files with 1,737 additions and 1,636 deletions.
6 changes: 5 additions & 1 deletion codemirror/js/addon/edit/closebrackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
})(function(CodeMirror) {
var defaults = {
pairs: "()[]{}''\"\"",
closeBefore: ")]}'\":;>",
triples: "",
explode: "[]{}"
};
Expand Down Expand Up @@ -109,6 +110,9 @@
var pairs = getOption(conf, "pairs");
var pos = pairs.indexOf(ch);
if (pos == -1) return CodeMirror.Pass;

var closeBefore = getOption(conf,"closeBefore");

var triples = getOption(conf, "triples");

var identical = pairs.charAt(pos + 1) == ch;
Expand Down Expand Up @@ -136,7 +140,7 @@
var prev = cur.ch == 0 ? " " : cm.getRange(Pos(cur.line, cur.ch - 1), cur)
if (!CodeMirror.isWordChar(next) && prev != ch && !CodeMirror.isWordChar(prev)) curType = "both";
else return CodeMirror.Pass;
} else if (opening) {
} else if (opening && (next.length === 0 || /\s/.test(next) || closeBefore.indexOf(next) > -1)) {
curType = "both";
} else {
return CodeMirror.Pass;
Expand Down
8 changes: 8 additions & 0 deletions codemirror/js/addon/edit/closetag.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* An array of tag names that should, when opened, cause a
* blank line to be added inside the tag, and the blank line and
* closing line to be indented.
* `emptyTags` (default is none)
* An array of XML tag names that should be autoclosed with '/>'.
*
* See demos/closetag.html for a usage example.
*/
Expand Down Expand Up @@ -76,6 +78,12 @@
closingTagExists(cm, tagName, pos, state, true))
return CodeMirror.Pass;

var emptyTags = typeof opt == "object" && opt.emptyTags;
if (emptyTags && indexOf(emptyTags, tagName) > -1) {
replacements[i] = { text: "/>", newPos: CodeMirror.Pos(pos.line, pos.ch + 2) };
continue;
}

var indent = indentTags && indexOf(indentTags, lowerTagName) > -1;
replacements[i] = {indent: indent,
text: ">" + (indent ? "\n\n" : "") + "</" + tagName + ">",
Expand Down
2 changes: 1 addition & 1 deletion codemirror/js/addon/edit/continuelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

// If we're not in Markdown mode, fall back to normal newlineAndIndent
var eolState = cm.getStateAfter(pos.line);
var inner = cm.getMode().innerMode(eolState);
var inner = CodeMirror.innerMode(cm.getMode(), eolState);
if (inner.mode.name !== "markdown") {
cm.execCommand("newlineAndIndent");
return;
Expand Down
2 changes: 1 addition & 1 deletion codemirror/js/addon/edit/matchbrackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
var ch = line.charAt(pos);
if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {
var match = matching[ch];
if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
if (match && (match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};
else stack.pop();
}
Expand Down
41 changes: 23 additions & 18 deletions codemirror/js/addon/hint/sql-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,24 +275,29 @@
if (search.charAt(0) == "." || search.charAt(0) == identifierQuote) {
start = nameCompletion(cur, token, result, editor);
} else {
addMatches(result, search, defaultTable, function(w) {return {text:w, className: "CodeMirror-hint-table CodeMirror-hint-default-table"};});
addMatches(
result,
search,
tables,
function(w) {
if (typeof w === 'object') {
w.className = "CodeMirror-hint-table";
} else {
w = {text: w, className: "CodeMirror-hint-table"};
}

return w;
}
);
if (!disableKeywords)
addMatches(result, search, keywords, function(w) {return {text: w.toUpperCase(), className: "CodeMirror-hint-keyword"};});
}
var objectOrClass = function(w, className) {
if (typeof w === "object") {
w.className = className;
} else {
w = { text: w, className: className };
}
return w;
};
addMatches(result, search, defaultTable, function(w) {
return objectOrClass(w, "CodeMirror-hint-table CodeMirror-hint-default-table");
});
addMatches(
result,
search,
tables, function(w) {
return objectOrClass(w, "CodeMirror-hint-table");
}
);
if (!disableKeywords)
addMatches(result, search, keywords, function(w) {
return objectOrClass(w.toUpperCase(), "CodeMirror-hint-keyword");
});
}

return {list: result, from: Pos(cur.line, start), to: Pos(cur.line, end)};
});
Expand Down
20 changes: 15 additions & 5 deletions codemirror/js/addon/hint/xml-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@

var Pos = CodeMirror.Pos;

function matches(hint, typed, matchInMiddle) {
if (matchInMiddle) return hint.indexOf(typed) >= 0;
else return hint.lastIndexOf(typed, 0) == 0;
}

function getHints(cm, options) {
var tags = options && options.schemaInfo;
var quote = (options && options.quoteChar) || '"';
var matchInMiddle = options && options.matchInMiddle;
if (!tags) return;
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
if (token.end > cur.ch) {
Expand Down Expand Up @@ -45,14 +51,14 @@
var cx = inner.state.context, curTag = cx && tags[cx.tagName];
var childList = cx ? curTag && curTag.children : tags["!top"];
if (childList && tagType != "close") {
for (var i = 0; i < childList.length; ++i) if (!prefix || childList[i].lastIndexOf(prefix, 0) == 0)
for (var i = 0; i < childList.length; ++i) if (!prefix || matches(childList[i], prefix, matchInMiddle))
result.push("<" + childList[i]);
} else if (tagType != "close") {
for (var name in tags)
if (tags.hasOwnProperty(name) && name != "!top" && name != "!attrs" && (!prefix || name.lastIndexOf(prefix, 0) == 0))
if (tags.hasOwnProperty(name) && name != "!top" && name != "!attrs" && (!prefix || matches(name, prefix, matchInMiddle)))
result.push("<" + name);
}
if (cx && (!prefix || tagType == "close" && cx.tagName.lastIndexOf(prefix, 0) == 0))
if (cx && (!prefix || tagType == "close" && matches(cx.tagName, prefix, matchInMiddle)))
result.push("</" + cx.tagName + ">");
} else {
// Attribute completion
Expand Down Expand Up @@ -86,16 +92,20 @@
quote = token.string.charAt(len - 1);
prefix = token.string.substr(n, len - 2);
}
if (n) { // an opening quote
var line = cm.getLine(cur.line);
if (line.length > token.end && line.charAt(token.end) == quote) token.end++; // include a closing quote
}
replaceToken = true;
}
for (var i = 0; i < atValues.length; ++i) if (!prefix || atValues[i].lastIndexOf(prefix, 0) == 0)
for (var i = 0; i < atValues.length; ++i) if (!prefix || matches(atValues[i], prefix, matchInMiddle))
result.push(quote + atValues[i] + quote);
} else { // An attribute name
if (token.type == "attribute") {
prefix = token.string;
replaceToken = true;
}
for (var attr in attrs) if (attrs.hasOwnProperty(attr) && (!prefix || attr.lastIndexOf(prefix, 0) == 0))
for (var attr in attrs) if (attrs.hasOwnProperty(attr) && (!prefix || matches(attr, prefix, matchInMiddle)))
result.push(attr);
}
}
Expand Down
2 changes: 1 addition & 1 deletion codemirror/js/addon/search/matchesonscrollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
if (match.from.line >= this.gap.to) break;
if (match.to.line >= this.gap.from) this.matches.splice(i--, 1);
}
var cursor = this.cm.getSearchCursor(this.query, CodeMirror.Pos(this.gap.from, 0), this.caseFold);
var cursor = this.cm.getSearchCursor(this.query, CodeMirror.Pos(this.gap.from, 0), {caseFold: this.caseFold, multiline: this.options.multiline});
var maxMatches = this.options && this.options.maxMatches || MAX_MATCHES;
while (cursor.findNext()) {
var match = {from: cursor.from(), to: cursor.to()};
Expand Down
4 changes: 2 additions & 2 deletions codemirror/js/codemirror.addons.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 15e7bf7

Please sign in to comment.