         last-ch (count (.getLine cm last-line))]
     (.setCursor cm last-line last-ch)))
 
+(defn modifying-prompt?
+  [inst key]
+  (let [pos (.getCursor inst)
+        lno (.-line pos)
+        cno (.-ch pos)
+        compare-position-fn (if (= 8 key) <= <)]
+    (and ((complement #{37 38 39 40}) key)
+         (zero? lno)
+         (compare-position-fn cno (common/beginning-of-source (.getValue inst))))))
+
 (defn editor
   [value-atom {:keys [on-change
                       on-eval

      (fn []
        @value-atom
        [:div])})))


                      :extraKeys #js {"Shift-Enter" "newlineAndIndent"}
                      :value (str (get-prompt) @value-atom)
                      :mode "clojure"}))]

          (dispatch [:add-console :cljs-console inst])
          (move-to-end inst)

