                          #_[[(:scroll-pane (get-editor)) "wrap, span 2, w 100%, h 75%"]
                            [(:scroll-pane @repl-input-window) "w 50%, h 25%"]
                            [(:scrollable @repl-output-window) "w 50%, h 25%"]])
-        f (frame :title "Brevis - UI" :width 1024 :height 768 #_:minimum-size #_[800 :by 600] :menubar menus)]
+        f (frame :title "Brevis" :width 1024 :height 768 #_:minimum-size #_[800 :by 600] 
+                 :menubar menus :on-close :nothing #_:exit)]
+    (listen f
+            #{:window-closed :window-closing}
+            a-exit)
     (listen (:project-tree @project-browser) #_(select f [:#project-tree]) :selection
             (fn [e]
               (if-let [dir (last (selection e))]

    (.setLocation f 0 0)      
    {:frame f
     :panel panel}))

(defn -main 
  "Start from command line."

      (spit selected
            (get-text-from-tab tab-idx)))))

(declare save-IDE-state)
(defn a-exit  [e]   
  (save-IDE-state)
  (System/exit 0))
(defn a-copy  [e] (.copy (:text-area (get-editor))))
(defn a-cut   [e] (.cut (:text-area (get-editor))))
(defn a-paste [e] (.paste (:text-area (get-editor))))
