   Editor::setTrimWhitespace = (trimWhitespace) ->
     @trimWhitespace = trimWhitespace
 
+  Editor::setValue_raw = (value) ->
+    if @trimWhitespace then value = value.trim()
+
+    newParse = coffee.parse value, wrapAtRoot: true
+
+    if value isnt @tree.stringify()
+      @addMicroUndoOperation 'CAPTURE_POINT'
+    @addMicroUndoOperation new SetValueOperation @tree, newParse
+
+    @tree = newParse; @gutterVersion = -1
+    @tree.start.insert @cursor
+    @redrawMain()
+
+    return success: true
+  
   Editor::setValue = (value) ->
-    #try
-      # Whitespace trimming hack to account
-      # for ACE editor extra line in some applications
-
-      @aceEditor.setValue value
-      @aceEditor.resize true
-
-      if @trimWhitespace then value = value.trim()
-
-      newParse = coffee.parse value, wrapAtRoot: true
-
-      if value isnt @tree.stringify()
-        @addMicroUndoOperation 'CAPTURE_POINT'
-      @addMicroUndoOperation new SetValueOperation @tree, newParse
-
-      @tree = newParse; @gutterVersion = -1
-      @tree.start.insert @cursor
-      @redrawMain()
-
-      return success: true
-
-    #catch e
-    #  return success: false, error: e
+    
+    oldScrollTop = @aceEditor.session.getScrollTop()
+
+    @aceEditor.setValue value, -1
+    @aceEditor.resize true
+    
+    @aceEditor.session.setScrollTop oldScrollTop
+    
+    @setValue_raw value
 
   Editor::getValue = -> if @currentlyUsingBlocks then @tree.stringify() else @aceEditor.getValue()
 

    @gutter = document.createElement 'div'
    @gutter.className = 'ice-gutter'

    @gutterVersion = -1

    @lineNumberTags = {}

            div.style.top = (line * lineHeight - aceScrollTop + @scrollOffsets.main.y) + 'px'
          ), fadeTime
      
      @lineNumberWrapper.style.display = 'none'
      
      # Kick off fade-out transition

