misc fixes

This commit is contained in:
nightwing 2013-11-24 16:16:36 +04:00
commit 4cb1e7b849
3 changed files with 20 additions and 18 deletions

View file

@ -952,8 +952,8 @@ var EditSession = function(text, mode) {
if (!$isPlaceholder) { if (!$isPlaceholder) {
this.$options.wrapMethod.set.call(this, this.$wrapMethod); this.$options.wrapMethod.set.call(this, this.$wrapMethod);
this.$setFolding(mode.foldingRules); this.$setFolding(mode.foldingRules);
this._emit("changeMode");
this.bgTokenizer.start(0); this.bgTokenizer.start(0);
this._emit("changeMode");
} }
}; };

View file

@ -63,23 +63,22 @@ var C9SearchHighlightRules = function() {
var regex = stack[1]; var regex = stack[1];
var str = values[3]; var str = values[3];
if (regex && str)
values = str.split(regex); // this doesn't work on ie8 but we don't care:)
else
values = [str];
for (var i = 0, l = values.length; i < l; i+=2) { var m;
if (values[i]) var last = 0;
tokens.push({ if (regex) {
type: types[2], regex.lastIndex = 0;
value: values[i] while (m = regex.exec(str)) {
}); var skipped = str.substring(last, m.index);
if (values[i+1]) last = regex.lastIndex;
tokens.push({ if (skipped)
type: types[3], tokens.push({type: types[2], value: skipped});
value: values[i + 1] if (m[0])
}); tokens.push({type: types[3], value: m[0]});
} }
}
if (last < str.length)
tokens.push({type: types[2], value: str.substr(last)});
return tokens; return tokens;
} }
}, },
@ -102,7 +101,7 @@ var C9SearchHighlightRules = function() {
search = "\\b" + search + "\\b"; search = "\\b" + search + "\\b";
var regex = safeCreateRegexp( var regex = safeCreateRegexp(
"(" + search + ")", "(" + search + ")",
/ sensitive/.test(options) ? "" : "i" / sensitive/.test(options) ? "g" : "ig"
); );
if (regex) { if (regex) {
stack[0] = state; stack[0] = state;

View file

@ -7875,7 +7875,7 @@ Lexer.prototype = {
this.skip(); this.skip();
while (this.peek() !== quote) { outer: while (this.peek() !== quote) {
while (this.peek() === "") { // End Of Line while (this.peek() === "") { // End Of Line
// If an EOL is not preceded by a backslash, show a warning // If an EOL is not preceded by a backslash, show a warning
@ -7927,6 +7927,9 @@ Lexer.prototype = {
quote: quote quote: quote
}; };
} }
if (this.peek() == quote)
break outer;
} }
allowNewLine = false; allowNewLine = false;