 loadFromClient = (name) ->
   name = $.totalStorage(LAST_CODE) unless name?
   unless name?
-    setMode "IcedCoffeeScript" unless compiler?
+    setMode "CoffeeScript" unless compiler?
     return
   stored = fileCookie(name)
   if stored?

  save Long file name.txt\\
"""

sourceArea = CodeMirror.fromTextArea $("#sourceArea")[0],
  tabSize: 2
  indentUnit: 2
  lineNumbers: true
  extraKeys:
    Tab: "indentMore"
    "Shift-Tab": "indentLess"

  onChange: (inst, e) ->
    sourceChange inst, e

  onCursorActivity: ->
    sourceArea.setLineClass hlLine, null, null
    hlLine = sourceArea.setLineClass sourceArea.getCursor().line, null, "activeline"

hlLine = sourceArea.setLineClass 1, null, "activeline"
commandArea = CodeMirror.fromTextArea $("#commandArea")[0],
  tabSize: 2
  indentUnit: 2
  keyMap: "commandLine"
  onKeyEvent: (inst, e) ->
    commandAreaKeyEvent inst, e

$(sourceArea.getInputField()).keyup (e) ->
  switch CodeMirror.keyNames[e.keyCode]
    when "Esc"
      commandArea.focus()

$("#commandWrap .CodeMirror").mouseenter (e) ->
  commandArea.focus()

$("#sourceWrap .CodeMirror").mouseenter (e) ->
  sourceArea.focus()

$("#centerBar").draggable
  axis: "x"

  eval (compiler.preExecute? code) ? code

history = new History
sourceChange = (e) ->
  sourceCompiled = false
  sourceChanged = true
  history.add e
