         (+ (.-scrollTop list) (.-clientHeight list))) (set! (.-scrollTop list)
                                                             (- (+ (.-offsetTop elem) (.-offsetHeight elem) 15) (.-clientHeight list)))
      :else nil)))
+
+(defn fill-lis [{:keys [lis size search selected key transform] :as this} results]
+  (let [cnt (count results)
+        cur (mod selected (if (> cnt size)
+                            size
+                            cnt))
+        transform (if transform
+                    transform
+                    #(do %3))]
+    (if (= cnt 0)
+      (dom/add-class (:content this) :empty)
+      (dom/remove-class (:content this) :empty))
+    (doseq [[i li res] (map vector (range) lis results)
+            :when res]
+      (dom/html li (transform (aget res 1) (aget res 4) (if-not (empty? search)
+
+                                                          (js/wrapMatch (aget res 1) (aget res 4))
+                                                          (aget res 1))
+                              (aget res 0)))
+      (dom/css li {:display "block"})
+      (if (= i cur)
+        (dom/add-class li :selected)
+        (dom/remove-class li :selected)))
+    (doseq [li (drop cnt lis)]
+      (dom/css li {:display "none"}))))
+
+(declare sidebar-command indexed-results)
 
 (behavior ::move-selection
           :triggers #{:move-selection}

               (dom/stop-propagation e)
               (object/raise this :set-selection! x)
               (object/raise this :select! x)))

(defn fill-lis [{:keys [lis size search selected key transform] :as this} results]
  (let [cnt (count results)
        cur (mod selected (if (> cnt size)
                            size
                            cnt))
        transform (if transform
                    transform
                    #(do %3))]
    (if (= cnt 0)
      (dom/add-class (:content this) :empty)
      (dom/remove-class (:content this) :empty))
    (doseq [[i li res] (map vector (range) lis results)
            :when res]
      (dom/html li (transform (aget res 1) (aget res 4) (if-not (empty? search)

                                                          (js/wrapMatch (aget res 1) (aget res 4))
                                                          (aget res 1))
                              (aget res 0)))
      (dom/css li {:display "block"})
      (if (= i cur)
        (dom/add-class li :selected)
        (dom/remove-class li :selected)))
    (doseq [li (drop cnt lis)]
      (dom/css li {:display "none"}))))

(object/object* ::filter-list
                :tags #{:filter-list}

(behavior ::select-command
          :triggers #{:select}
          :reaction (fn [this sel]
                      (when-let [cmd (cmd/by-id sel)]
                        (if (:options cmd)
                          (do
                            (object/merge! sidebar-command {:active cmd})
