Skip to content
Snippets Groups Projects
Commit a6c2e01f authored by Marijn Haverbeke's avatar Marijn Haverbeke
Browse files

[xml mode] Leave old style intact when adding error style

Fixes a problem with matchtags getting confused.

Closes #1841
parent 39499fdd
No related branches found
No related tags found
No related merge requests found
......@@ -76,7 +76,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
tagName = "";
var c;
while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
if (!tagName) return "error";
if (!tagName) return "tag error";
type = isClose ? "closeTag" : "openTag";
state.tokenize = inTag;
return "tag";
......@@ -109,7 +109,8 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
type = "equals";
return null;
} else if (ch == "<") {
return "error";
stream.match(/^\/?\w*\/?>/);
return "tag error";
} else if (/[\'\"]/.test(ch)) {
state.tokenize = inAttribute(ch);
state.stringStartCol = stream.column();
......@@ -298,7 +299,9 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
}
}
state.startOfLine = false;
return setStyle || style;
if (setStyle)
style = setStyle == "error" ? style + " error" : setStyle;
return style;
},
indent: function(state, textAfter, fullLine) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment