       @ghci.stderr.pause()
       @errorBuffer = []
       @responseBuffer = []
-      @ghci.stdin.write ":{#{EOL}"
-      lines.forEach (line) =>
-        @ghci.stdin.write line + EOL
+      @ghci.stdin.write ":{#{EOL}#{lines.join(EOL)}#{EOL}:}#{EOL}"
       @emitter.emit 'input', lines.join('\n') + '\n'
-      @ghci.stdin.write ":}#{EOL}"
       @ghci.stdout.resume()
       @ghci.stderr.resume()
       return true
     else
-      @ghci.stdin.write lines.join(EOL)
-      @emitter.emit 'response', "> \"#{lines.join('\\n')}\"#{EOL}"
+      @ghci.stdin.write lines.join('\n')
+      @emitter.emit 'input', "\"#{lines.join('\\n')}\"\n"
       return true
 
   historyBack: (current) ->

      @process.on 'exit', (code) =>
        @ghci = null
        if code isnt 0
          @emitter.emit 'error', @errorBuffer.join(EOL) + EOL
        @emitter.emit 'exit', code
        @disposables.dispose()


      @[i](opts[i])

    handleError = (error) =>
      @emitter.emit 'response', "GHCI crashed\n#{error}"
      console.error error
      @ghci = null
      @emitter.emit 'exit', -1
