Fix for issue #2374, maximum call stack exceeded in 64 bit chrome when pasting large chunks.
This commit is contained in:
parent
bed3a18d49
commit
b5064a4bb3
1 changed files with 6 additions and 5 deletions
|
|
@ -311,11 +311,12 @@ 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)
|
// Apply doesn't work for big arrays due to max call stack detection.
|
||||||
// to circumvent that we have to break huge inserts into smaller chunks here
|
// Chrome 64 bit requires threshold smaller than 32k, using a safe value of 1k.
|
||||||
while (lines.length > 0xF000) {
|
// To circumvent that we have to break huge inserts into smaller chunks here.
|
||||||
var end = this._insertLines(row, lines.slice(0, 0xF000));
|
while (lines.length > 1000) {
|
||||||
lines = lines.slice(0xF000);
|
var end = this._insertLines(row, lines.slice(0, 1000));
|
||||||
|
lines = lines.slice(1000);
|
||||||
row = end.row;
|
row = end.row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue