Merge pull request #774 from ajaxorg/ui/search2

ability to insert more than 100000 lines
This commit is contained in:
Fabian Jakobs 2012-05-30 08:44:12 -07:00
commit f89417e03c
3 changed files with 13 additions and 6 deletions

@ -1 +1 @@
Subproject commit 8bd16ba2eda6a1b0c6791f37d0803296ae37840f
Subproject commit d93670b47d776987b38bb2c31777c4e488338fac

View file

@ -326,6 +326,13 @@ var Document = function(text) {
if (lines.length == 0)
return {row: row, column: 0};
// apply doesn't work for big arrays (smallest threshold is on safari 0xFFFF)
// to circumvent that we have to break huge inserts into smaller chunks here
if (lines.length > 0xFFFF) {
var end = this.insertLines(row, lines.slice(0xFFFF));
lines = lines.slice(0, 0xFFFF);
}
var args = [row, 0];
args.push.apply(args, lines);
this.$lines.splice.apply(this.$lines, args);
@ -337,7 +344,7 @@ var Document = function(text) {
lines: lines
};
this._emit("change", { data: delta });
return range.end;
return end || range.end;
};
/**

View file

@ -47,13 +47,13 @@ var C9SearchHighlightRules = function() {
// regexps are ordered -> the first match is used
this.$rules = {
"start" : [
{
token : ["constant.numeric", "text", "text"],
regex : "(^\\s+[0-9]+)(:\\s*)(.+)"
},
{
token : ["string", "text"], // single line
regex : "(.+)(:$)"
},
{
token : ["constant.numeric", "text"],
regex : "(^\\s*[0-9]+)(:\\s*)"
}
]
};