From ffd54d4d20323ae4dff0520981bf26cf8867d70b Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sat, 17 Sep 2011 09:53:59 -0700 Subject: [PATCH] ui.tools.listener.completion: when completing history, only show unique completions. --- basis/ui/tools/listener/completion/completion.factor | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/basis/ui/tools/listener/completion/completion.factor b/basis/ui/tools/listener/completion/completion.factor index 37f09f5c14..6c4562abb1 100644 --- a/basis/ui/tools/listener/completion/completion.factor +++ b/basis/ui/tools/listener/completion/completion.factor @@ -20,6 +20,9 @@ SLOT: history [ dup string>> { { CHAR: \n CHAR: \s } } substitute ] { } map>assoc ; +: history-completions ( short interactor -- seq ) + history-list over empty? [ nip ] [ members completions ] if ; + TUPLE: word-completion manifest ; C: 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 )