             :top 0
             :query ""
             :show-cards false
+            :query-filter true
             :debug (atom nil)
+            :debug-offset 0
             :debug-avail (atom [])
             :debug-selected (atom [])})))
 
 (defn debug [state f text]
-  (let [query (.toLowerCase (:query state))]
-    (swap! (:debug-avail state) conj text)
+  (let [query (.toLowerCase (:query state))
+        offset (->> (:debug-avail state)
+                    (deref)
+                    (filter #(.contains (.toLowerCase %) query))
+                    (count))]
+    (when (or (not (:query-filter state))
+            (.contains (.toLowerCase text) query))
+      (swap! (:debug-avail state) conj text))
+
     (when (and (not-empty query)
                (nil? (deref (:debug state)))
+               (= offset (:debug-offset state))
                (.contains (.toLowerCase text) query))
       (swap! (:debug-selected state) conj text)
       (reset! (:debug state) (.clone (f))))))

    ;; not typing
    (case (:key e)
      :c (update-in state [:show-cards] not)
      :j (update-in state [:top] #(+ 15 %))
      :k (update-in state [:top] #(- % 15))
      :l (update-in state [:left] #(+ 15 %))

            [quil.core :as q]
            [quil.middleware :as m]
            [set-solver.core :refer :all]
            [set-solver.util :refer [constrain enumerate]])
  (:import [java.nio ByteBuffer ByteOrder]
           [org.opencv.core Mat Size Rect Point CvType]
           [org.opencv.imgcodecs Imgcodecs]
