Skip to content

Commit 856727c

Browse files
author
Christian Mueller
committed
bugfixes
1 parent 2429709 commit 856727c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/intellitext/core.cljs

+7-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@
1212
(def cells (map #(dom/getElement (str "cell" %)) [0 1 2]))
1313

1414
(defn make-suggestion []
15-
(let [input (last (string/split (.-value input-field) #" "))
16-
suggestions (iterate #(mca/step chain %) input)]
15+
(let [input (string/lower-case
16+
(last (string/split (.-value input-field) #" ")))
17+
follow-ups (keys (chain input))
18+
stream (if (< (count follow-ups) 3)
19+
follow-ups
20+
(repeatedly #(mca/step chain input)))
21+
suggestions (distinct stream)]
1722
(doseq [[cell word] (map list cells suggestions)]
1823
(set! (.-innerHTML cell) word))))
1924

0 commit comments

Comments
 (0)