Merge pull request #774 from ajaxorg/ui/search2
ability to insert more than 100000 lines
This commit is contained in:
commit
f89417e03c
3 changed files with 13 additions and 6 deletions
2
doc/wiki
2
doc/wiki
|
|
@ -1 +1 @@
|
||||||
Subproject commit 8bd16ba2eda6a1b0c6791f37d0803296ae37840f
|
Subproject commit d93670b47d776987b38bb2c31777c4e488338fac
|
||||||
|
|
@ -326,6 +326,13 @@ var Document = function(text) {
|
||||||
if (lines.length == 0)
|
if (lines.length == 0)
|
||||||
return {row: row, column: 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];
|
var args = [row, 0];
|
||||||
args.push.apply(args, lines);
|
args.push.apply(args, lines);
|
||||||
this.$lines.splice.apply(this.$lines, args);
|
this.$lines.splice.apply(this.$lines, args);
|
||||||
|
|
@ -337,7 +344,7 @@ var Document = function(text) {
|
||||||
lines: lines
|
lines: lines
|
||||||
};
|
};
|
||||||
this._emit("change", { data: delta });
|
this._emit("change", { data: delta });
|
||||||
return range.end;
|
return end || range.end;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,12 @@ var C9SearchHighlightRules = function() {
|
||||||
this.$rules = {
|
this.$rules = {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : ["string", "text"], // single line
|
token : ["constant.numeric", "text", "text"],
|
||||||
regex : "(.+)(:$)"
|
regex : "(^\\s+[0-9]+)(:\\s*)(.+)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
token : ["constant.numeric", "text"],
|
token : ["string", "text"], // single line
|
||||||
regex : "(^\\s*[0-9]+)(:\\s*)"
|
regex : "(.+)(:$)"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue