                       line (.getText textArea startPosition (- (.getLength (.getDocument textArea)) startPosition 1))
                       ;response-vals (nrepl/message (:client @repl) {:op "eval" :code line})
                       #_session-sender #_(nrepl/client-session @reply.eval-modes.nrepl/current-connection :session @reply.eval-modes.nrepl/current-session)]
+                  (reset! repl-input-index 0)
                   (.setText textArea "")
                   (eval-and-print line true)           
                   ;; Add to a console history

      (.addKeyListener textArea 
        (proxy [java.awt.event.KeyAdapter] []          
          (keyPressed [#^java.awt.event.KeyEvent e]
            (when (= (.getKeyCode e) java.awt.event.KeyEvent/VK_ENTER)
              (.append textArea "\n")
              ;; This shouldn't be here:

(defn a-paste [e] (.paste (get-editor)))

(def repl-output (atom []))
(def repl-input (atom []))
(def repl-input-index (atom 0));; 0 is most recent, then go backwards, this is used with (- (count @repl-input) index)

(defn update-repl-output
  "Update the REPL output window."
  []
  #_(println "count repl-output" (count @repl-output))
  #_(doseq [line @repl-output]
     (println line))
  (text! (:text-area @repl-output-window)
         (with-out-str
           (doseq [line @repl-output]
