                            @max-undos
                            (conj @undo-list @app-db)))))
 
-(defn- undos?
-  [v]
-  (> (count v) 1))
+(defn undos?
+  []
+  (>= (count @undo-list) 1))
 
-(defn- redos?
-  [v]
-  (> (count v) 0))
+(defn redos?
+  []
+  (> (count @redo-list) 0))
 
 
 ;; -- subscriptions  -----------------------------------------------------------------------------

  (reset! max-undos n))

;;
(def ^:private undo-list (atom []))   ;; a list of history states
(def ^:private redo-list (atom []))   ;; a list of future states, caused by undoing


(defn clear-history!

  (fn handler
    ; "return true if anything is stored in the undo list, otherwise false"
    [_ _]
    (reaction (undos?))))

(subs/register
  :redos?
  (fn handler
    ; "return true if anything is stored in the redo list, otherwise false"
    [_ _]
    (reaction (redos?))))


;; -- event handlers  ----------------------------------------------------------------------------
