   [:div.card-output
    [:div.card-data
     (into [:pre.line]
-          (for [line output]
+          (for [line (str/split output #"\n")]
             [:code.line line]))]
    [:hr.border]])
 

   [cljs.core.async.macros :refer [go go-loop]]))

(def default-state
  {:ns      nil
   :input   ""
   :cursor  0
   :history (sorted-map)})

    (close! to-repl)))

(defn reset-repl! [state]
  (when-let [{:keys [from-repl to-repl]} (:repl @state)]
    (close! from-repl)
    (close! to-repl))

  (let [{:keys [to-repl from-repl]} (repl-thread/repl-thread)
        to-eval                     (chan)]
    (swap! state #(-> %
                      (merge default-state)
                      (assoc :repl {:to-repl   to-eval
                                    :from-repl from-repl})))
    (repl-event-loop state from-repl)
    (repl-eval-loop to-eval to-repl from-repl)))

(defn eval-str! [expression]
  (let [{:keys [to-repl]} (:repl @state)
        expression        (some-> expression str/trim)]
    (when (and (some? to-repl) (some? expression))
      (put! to-repl expression))))

