From f89ed9a31905dbd5d8571e49714438d2d424bcd7 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Mon, 10 Jan 2011 23:26:29 +0100 Subject: [PATCH] fix gh issue #30 https://github.com/ajaxorg/ace/issues/#issue/30 --- lib/ace/document.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/ace/document.js b/lib/ace/document.js index c58b70bb..6f526227 100644 --- a/lib/ace/document.js +++ b/lib/ace/document.js @@ -70,9 +70,15 @@ var Document = function(text, mode) { this.$undoManager = null; - this.$split = function(text) { - return text.split(/\r\n|\r|\n/); - }; + // check for IE split bug + if ("aaa".split(/a/).length == 0) + this.$split = function(text) { + return text.replace(/\r\n|\r/g, "\n").split("\n"); + } + else + this.$split = function(text) { + return text.split(/\r\n|\r|\n/); + }; this.setValue = function(text) { var args = [0, this.lines.length];