Skip to content

Commit

Permalink
bump to codemirror 5.56.10
Browse files Browse the repository at this point in the history
  • Loading branch information
w8tcha committed Dec 15, 2022
1 parent 88483d2 commit e5cc3cd
Show file tree
Hide file tree
Showing 24 changed files with 110 additions and 65 deletions.
2 changes: 1 addition & 1 deletion codemirror/css/codemirror.min.css

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions codemirror/js/addon/fold/foldgutter.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
cm.off("fold", onFold);
cm.off("unfold", onFold);
cm.off("swapDoc", onChange);
cm.off("optionChange", optionChange);
}
if (val) {
cm.state.foldGutter = new State(parseOptions(val));
Expand All @@ -31,6 +32,7 @@
cm.on("fold", onFold);
cm.on("unfold", onFold);
cm.on("swapDoc", onChange);
cm.on("optionChange", optionChange);
}
});

Expand Down Expand Up @@ -120,6 +122,10 @@
else cm.foldCode(Pos(line, 0), opts);
}

function optionChange(cm, option) {
if (option == "mode") onChange(cm)
}

function onChange(cm) {
var state = cm.state.foldGutter;
if (!state) return;
Expand Down
1 change: 1 addition & 0 deletions codemirror/js/addon/hint/show-hint.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

max-height: 20em;
overflow-y: auto;
box-sizing: border-box;
}

.CodeMirror-hint {
Expand Down
20 changes: 7 additions & 13 deletions codemirror/js/addon/hint/show-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,20 +286,14 @@
setTimeout(function() { startScroll = cm.getScrollInfo(); });

var overlapY = box.bottom - winH;
if (overlapY > 0) {
var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top);
if (curTop - height > 0) { // Fits above cursor
hints.style.top = (top = pos.top - height - offsetTop) + "px";
if (overlapY > 0) { // Does not fit below
var height = box.bottom - box.top, spaceAbove = box.top - (pos.bottom - pos.top) - 2
if (winH - box.top < spaceAbove) { // More room at the top
if (height > spaceAbove) hints.style.height = (height = spaceAbove) + "px";
hints.style.top = ((top = pos.top - height) + offsetTop) + "px";
below = false;
} else if (height > winH) {
hints.style.height = (winH - 5) + "px";
hints.style.top = (top = pos.bottom - box.top - offsetTop) + "px";
var cursor = cm.getCursor();
if (data.from.ch != cursor.ch) {
pos = cm.cursorCoords(cursor);
hints.style.left = (left = pos.left - offsetLeft) + "px";
box = hints.getBoundingClientRect();
}
} else {
hints.style.height = (winH - box.top - 2) + "px";
}
}
var overlapX = box.right - winW;
Expand Down
12 changes: 6 additions & 6 deletions codemirror/js/addon/hint/sql-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@

function isArray(val) { return Object.prototype.toString.call(val) == "[object Array]" }

function getModeConf(editor) {
return editor.getModeAt(editor.getCursor()).config || CodeMirror.resolveMode("text/x-sql")
}

function getKeywords(editor) {
var mode = editor.doc.modeOption;
if (mode === "sql") mode = "text/x-sql";
return CodeMirror.resolveMode(mode).keywords;
return getModeConf(editor).keywords || []
}

function getIdentifierQuote(editor) {
var mode = editor.doc.modeOption;
if (mode === "sql") mode = "text/x-sql";
return CodeMirror.resolveMode(mode).identifierQuote || "`";
return getModeConf(editor).identifierQuote || "`";
}

function getText(item) {
Expand Down
2 changes: 1 addition & 1 deletion codemirror/js/addon/merge/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@
var gapElts = [lockWrap];
if (dv.mv.options.revertButtons !== false) {
dv.copyButtons = elt("div", null, "CodeMirror-merge-copybuttons-" + dv.type);
function copyButtons(e) {
var copyButtons = function(e) {
var node = e.target || e.srcElement;
if (!node.chunk) return;
if (node.className == "CodeMirror-merge-copy-reverse") {
Expand Down
2 changes: 1 addition & 1 deletion codemirror/js/beautify.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion codemirror/js/codemirror.addon.merge.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions codemirror/js/codemirror.addons.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion codemirror/js/codemirror.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion codemirror/js/codemirror.mode.bbcodemixed.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion codemirror/js/codemirror.mode.htmlmixed.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion codemirror/js/codemirror.mode.javascript.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion codemirror/js/codemirror.mode.php.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion codemirror/js/codemirror.mode.sql.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion codemirror/js/mode/javascript/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "async" ||
(type == "variable" &&
(value == "static" || value == "get" || value == "set" || (isTS && isModifier(value))) &&
cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false))) {
cx.stream.match(/^\s+#?[\w$\xa1-\uffff]/, false))) {
cx.marked = "keyword";
return cont(classBody);
}
Expand Down
69 changes: 58 additions & 11 deletions codemirror/js/mode/jinja2/jinja2.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@

CodeMirror.defineMode("jinja2", function() {
var keywords = ["and", "as", "block", "endblock", "by", "cycle", "debug", "else", "elif",
"extends", "filter", "endfilter", "firstof", "for",
"extends", "filter", "endfilter", "firstof", "do", "for",
"endfor", "if", "endif", "ifchanged", "endifchanged",
"ifequal", "endifequal", "ifnotequal",
"ifequal", "endifequal", "ifnotequal", "set", "raw", "endraw",
"endifnotequal", "in", "include", "load", "not", "now", "or",
"parsed", "regroup", "reversed", "spaceless",
"endspaceless", "ssi", "templatetag", "openblock",
"closeblock", "openvariable", "closevariable",
"parsed", "regroup", "reversed", "spaceless", "call", "endcall", "macro",
"endmacro", "endspaceless", "ssi", "templatetag", "openblock",
"closeblock", "openvariable", "closevariable", "without", "context",
"openbrace", "closebrace", "opencomment",
"closecomment", "widthratio", "url", "with", "endwith",
"get_current_language", "trans", "endtrans", "noop", "blocktrans",
"endblocktrans", "get_available_languages",
"get_current_language_bidi", "plural"],
"get_current_language_bidi", "pluralize", "autoescape", "endautoescape"],
operator = /^[+\-*&%=<>!?|~^]/,
sign = /^[:\[\(\{]/,
atom = ["true", "false"],
Expand Down Expand Up @@ -78,7 +78,24 @@
state.instring = ch;
stream.next();
return "string";
} else if(stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}")) {
}
else if (state.inbraces > 0 && ch ==")") {
stream.next()
state.inbraces--;
}
else if (ch == "(") {
stream.next()
state.inbraces++;
}
else if (state.inbrackets > 0 && ch =="]") {
stream.next()
state.inbrackets--;
}
else if (ch == "[") {
stream.next()
state.inbrackets++;
}
else if (!state.lineTag && (stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}"))) {
state.intag = false;
return "tag";
} else if(stream.match(operator)) {
Expand All @@ -87,6 +104,10 @@
} else if(stream.match(sign)) {
state.sign = true;
} else {
if (stream.column() == 1 && state.lineTag && stream.match(keywords)) {
//allow nospace after tag before the keyword
return "keyword";
}
if(stream.eat(" ") || stream.sol()) {
if(stream.match(keywords)) {
return "keyword";
Expand Down Expand Up @@ -120,25 +141,51 @@
} else if (ch = stream.eat(/\{|%/)) {
//Cache close tag
state.intag = ch;
state.inbraces = 0;
state.inbrackets = 0;
if(ch == "{") {
state.intag = "}";
}
stream.eat("-");
return "tag";
}
//Line statements
} else if (stream.eat('#')) {
if (stream.peek() == '#') {
stream.skipToEnd();
return "comment"
}
else if (!stream.eol()) {
state.intag = true;
state.lineTag = true;
state.inbraces = 0;
state.inbrackets = 0;
return "tag";
}
}
stream.next();
};

return {
startState: function () {
return {tokenize: tokenBase};
return {
tokenize: tokenBase,
inbrackets:0,
inbraces:0
};
},
token: function (stream, state) {
return state.tokenize(stream, state);
token: function(stream, state) {
var style = state.tokenize(stream, state);
if (stream.eol() && state.lineTag && !state.instring && state.inbraces == 0 && state.inbrackets == 0) {
//Close line statement at the EOL
state.intag = false
state.lineTag = false
}
return style;
},
blockCommentStart: "{#",
blockCommentEnd: "#}"
blockCommentEnd: "#}",
lineComment: "##",
};
});

Expand Down
2 changes: 1 addition & 1 deletion codemirror/js/mode/nsis/nsis.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ CodeMirror.defineSimpleMode("nsis",{
{regex: /\b(?:admin|all|amd64-unicode|auto|both|bottom|bzip2|components|current|custom|directory|false|force|hide|highest|ifdiff|ifnewer|instfiles|lastused|leave|left|license|listonly|lzma|nevershow|none|normal|notset|off|on|right|show|silent|silentlog|textonly|top|true|try|un\.components|un\.custom|un\.directory|un\.instfiles|un\.license|uninstConfirm|user|Win10|Win7|Win8|WinVista|x-86-(ansi|unicode)|zlib)\b/i, token: "builtin"},

// LogicLib.nsh
{regex: /\$\{(?:And(?:If(?:Not)?|Unless)|Break|Case(?:Else)?|Continue|Default|Do(?:Until|While)?|Else(?:If(?:Not)?|Unless)?|End(?:If|Select|Switch)|Exit(?:Do|For|While)|For(?:Each)?|If(?:Cmd|Not(?:Then)?|Then)?|Loop(?:Until|While)?|Or(?:If(?:Not)?|Unless)|Select|Switch|Unless|While)\}/i, token: "variable-2", indent: true},
{regex: /\$\{(?:And(?:If(?:Not)?|Unless)|Break|Case(?:2|3|4|5|Else)?|Continue|Default|Do(?:Until|While)?|Else(?:If(?:Not)?|Unless)?|End(?:If|Select|Switch)|Exit(?:Do|For|While)|For(?:Each)?|If(?:Cmd|Not(?:Then)?|Then)?|Loop(?:Until|While)?|Or(?:If(?:Not)?|Unless)|Select|Switch|Unless|While)\}/i, token: "variable-2", indent: true},

// FileFunc.nsh
{regex: /\$\{(?:BannerTrimPath|DirState|DriveSpace|Get(BaseName|Drives|ExeName|ExePath|FileAttributes|FileExt|FileName|FileVersion|Options|OptionsS|Parameters|Parent|Root|Size|Time)|Locate|RefreshShellIcons)\}/i, token: "variable-2", dedent: true},
Expand Down
3 changes: 0 additions & 3 deletions codemirror/js/mode/pegjs/pegjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ CodeMirror.defineMode("pegjs", function (config) {
};
},
token: function (stream, state) {
if (stream)

//check for state changes
if (!state.inString && !state.inComment && ((stream.peek() == '"') || (stream.peek() == "'"))) {
state.stringType = stream.peek();
Expand All @@ -43,7 +41,6 @@ CodeMirror.defineMode("pegjs", function (config) {
state.inComment = true;
}

//return state
if (state.inString) {
while (state.inString && !stream.eol()) {
if (stream.peek() === state.stringType) {
Expand Down
2 changes: 1 addition & 1 deletion codemirror/js/mode/python/python.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"sorted", "staticmethod", "str", "sum", "super", "tuple",
"type", "vars", "zip", "__import__", "NotImplemented",
"Ellipsis", "__debug__"];
CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins));
CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins).concat(["exec", "print"]));

function top(state) {
return state.scopes[state.scopes.length - 1];
Expand Down
23 changes: 12 additions & 11 deletions codemirror/js/mode/sparql/sparql.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ CodeMirror.defineMode("sparql", function(config) {
"true", "false", "with",
"data", "copy", "to", "move", "add", "create", "drop", "clear", "load", "into"]);
var operatorChars = /[*+\-<>=&|\^\/!\?]/;
var PN_CHARS = "[A-Za-z_\\-0-9]";
var PREFIX_START = new RegExp("[A-Za-z]");
var PREFIX_REMAINDER = new RegExp("((" + PN_CHARS + "|\\.)*(" + PN_CHARS + "))?:");

function tokenBase(stream, state) {
var ch = stream.next();
Expand Down Expand Up @@ -71,20 +74,18 @@ CodeMirror.defineMode("sparql", function(config) {
stream.eatWhile(/[a-z\d\-]/i);
return "meta";
}
else {
stream.eatWhile(/[_\w\d]/);
if (stream.eat(":")) {
else if (PREFIX_START.test(ch) && stream.match(PREFIX_REMAINDER)) {
eatPnLocal(stream);
return "atom";
}
var word = stream.current();
if (ops.test(word))
return "builtin";
else if (keywords.test(word))
return "keyword";
else
return "variable";
}
stream.eatWhile(/[_\w\d]/);
var word = stream.current();
if (ops.test(word))
return "builtin";
else if (keywords.test(word))
return "keyword";
else
return "variable";
}

function eatPnLocal(stream) {
Expand Down
3 changes: 2 additions & 1 deletion codemirror/js/mode/sql/sql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions codemirror/js/mode/swift/swift.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,12 @@

function tokenComment(stream, state) {
var ch
while (true) {
stream.match(/^[^/*]+/, true)
ch = stream.next()
if (!ch) break
while (ch = stream.next()) {
if (ch === "/" && stream.eat("*")) {
state.tokenize.push(tokenComment)
} else if (ch === "*" && stream.eat("/")) {
state.tokenize.pop()
break
}
}
return "comment"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"CodeMirror"
],
"devDependencies": {
"codemirror": "^5.65.7",
"codemirror": "^5.65.10",
"grunt": "~1.5.3",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-cssmin": "*",
Expand Down

0 comments on commit e5cc3cd

Please sign in to comment.