   (if (= 13 (.-keyCode e))
     (do
       (.preventDefault e)
-      (swap! state dissoc :edit-mode)
+      (swap! state dissoc :edit)
       ;; Dirty as fudge, but what can you do with Reagent?
       (.focus (.getElementById js/document id)))
     nil))

      39 (f current-row (min cols (inc current-col)))
      40 (f (min rows (inc current-row)) current-col)
      9 (f current-row (min cols (inc current-col)))
      13 (enable-edit-mode! state current-row current-col)
      nil)))

(defn handle-key-down
  [e headers data state id]
  (if (:edit-mode @state)
    (handle-editing-mode-key-down e state id)
    (handle-selection-mode-key-down e headers data state)))


  [state row col]
  (swap! state assoc :selected [row col]))

(defn enable-edit!
  [data state]
  (let [row-data (nth data (first (:selected @state)))]
    (swap! state assoc :edit {:initial row-data
                              :updated row-data})))

;;
;; Keyboard event handlers
