diff --git a/lib/ace/document.js b/lib/ace/document.js index 10a36eb2..0214b38b 100644 --- a/lib/ace/document.js +++ b/lib/ace/document.js @@ -311,11 +311,12 @@ 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 - while (lines.length > 0xF000) { - var end = this._insertLines(row, lines.slice(0, 0xF000)); - lines = lines.slice(0xF000); + // Apply doesn't work for big arrays due to max call stack detection. + // Chrome 64 bit requires threshold smaller than 32k, using a safe value of 1k. + // To circumvent that we have to break huge inserts into smaller chunks here. + while (lines.length > 1000) { + var end = this._insertLines(row, lines.slice(0, 1000)); + lines = lines.slice(1000); row = end.row; }