]> gitweb.factorcode.org Git - factor.git/commitdiff
ui.tools.listener.completion: when completing history, only show unique completions.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sat, 17 Sep 2011 16:53:59 +0000 (09:53 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 17 Sep 2011 16:53:59 +0000 (09:53 -0700)
basis/ui/tools/listener/completion/completion.factor

index 37f09f5c14d0023bee21970513c646590b5032d0..6c4562abb110a56d1c817dec549de6c3d7cfe277 100644 (file)
@@ -20,6 +20,9 @@ SLOT: history
     [ dup string>> { { CHAR: \n CHAR: \s } } substitute ] { } map>assoc
     <reversed> ;
 
+: history-completions ( short interactor -- seq )
+    history-list over empty? [ nip ] [ members completions ] if ;
+
 TUPLE: word-completion manifest ;
 C: <word-completion> word-completion
 
@@ -35,7 +38,7 @@ GENERIC: completion-quot ( interactor completion-mode -- quot )
 M: word-completion completion-quot [ words-matching ] (completion-quot) ;
 M: vocab-completion completion-quot [ vocabs-matching ] (completion-quot) ;
 M: char-completion completion-quot [ chars-matching ] (completion-quot) ;
-M: history-completion completion-quot drop '[ _ history-list completions ] ;
+M: history-completion completion-quot drop '[ _ history-completions ] ;
 
 GENERIC: completion-element ( completion-mode -- element )