]> gitweb.factorcode.org Git - factor.git/commitdiff
readline-listener: implement vocab-word-completions.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 25 Jan 2018 01:11:44 +0000 (17:11 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 25 Jan 2018 01:11:44 +0000 (17:11 -0800)
extra/readline-listener/readline-listener.factor

index d783e582b5eb4db2d96fd89ba2b1d2d40a70b677..3917bf7eea65a1060919a9d4d748606d45d068bf 100644 (file)
@@ -32,6 +32,9 @@ M: readline-reader prompt.
 : prefixed-vocabs ( prefix -- vocabs )
     all-disk-vocabs-recursive filter-vocabs [ name>> ] map! prefixed ;
 
+: prefixed-vocab-words ( prefix vocab-name -- words )
+    vocab-words [ name>> ] map! prefixed ;
+
 : prefixed-colors ( prefix -- colors )
     named-colors prefixed ;
 
@@ -44,6 +47,7 @@ M: readline-reader prompt.
             { [ dup complete-vocab? ] [ drop prefixed-vocabs ] }
             { [ dup complete-char? ] [ drop prefixed-chars ] }
             { [ dup complete-color? ] [ drop prefixed-colors ] }
+            { [ dup complete-vocab-words? ] [ harvest second prefixed-vocab-words ] }
             [ drop prefixed-words ]
         } cond dup completions tset
     ] if* ;