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) {
this.$options.wrapMethod.set.call(this, this.$wrapMethod);
this.$setFolding(mode.foldingRules);
this._emit("changeMode");
this.bgTokenizer.start(0);
this._emit("changeMode");
}
};

View file

@ -63,23 +63,22 @@ var C9SearchHighlightRules = function() {
var regex = stack[1];
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) {
if (values[i])
tokens.push({
type: types[2],
value: values[i]
});
if (values[i+1])
tokens.push({
type: types[3],
value: values[i + 1]
});
var m;
var last = 0;
if (regex) {
regex.lastIndex = 0;
while (m = regex.exec(str)) {
var skipped = str.substring(last, m.index);
last = regex.lastIndex;
if (skipped)
tokens.push({type: types[2], value: skipped});
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;
}
},
@ -102,7 +101,7 @@ var C9SearchHighlightRules = function() {
search = "\\b" + search + "\\b";
var regex = safeCreateRegexp(
"(" + search + ")",
/ sensitive/.test(options) ? "" : "i"
/ sensitive/.test(options) ? "g" : "ig"
);
if (regex) {
stack[0] = state;

View file

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