-
-
Save lsparrish/3913565 to your computer and use it in GitHub Desktop.
yet another approach
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 variable: prefix:CHAR | |
create prefix:TABLE | |
256 allot | |
: getc:internal ( -c ) &getc 2 + @ do ; | |
[ dup @prefix:CHAR == | |
[ drop getc:internal | |
"prefix:TABLE" find drop @d->xt + @ dup 0 <> | |
[ dip cr ] [ drop ] if 0 | |
] ifTrue | |
dup '| == | |
[ drop getc:internal dup putc space prefix:TABLE + &' do swap ! cr 0 ] ifTrue | |
] is remapKeys | |
: prefix:tab 09 !prefix:CHAR ; | |
: prefix:space 32 !prefix:CHAR ; | |
: (matching) ; | |
: bindTo: ( quote "character" - ) | |
getc "prefix:TABLE" find drop @d->xt + ! ; | |
[ cr | |
"? help text\n" puts | |
"d<word> documentation for word\n" puts | |
"s show stack contents\n" puts | |
"p<char> change trigger character to <char>\n" puts ] bindTo: ? | |
[ "display docs for: " puts | |
getToken find [ cr @d->doc 0; puts ] [ drop cr "no docs found!" puts ] if ] bindTo: | |
d | |
[ "display functions matching: " puts | |
getToken cr (matching) ] bindTo: m | |
[ getc:internal dup putc !prefix:CHAR ] bindTo: p | |
|wwords | |
|s.s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment