readline-listener: implement vocab-word-completions.

factor-shell
John Benediktsson 2018-01-24 17:11:44 -08:00
parent 7f37709c04
commit 2cb673ccfc
1 changed files with 4 additions and 0 deletions

View File

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