Created
December 2, 2009 03:28
-
-
Save lsparrish/246905 to your computer and use it in GitHub Desktop.
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
: :: ( -a ) here ] ; | |
: stub create 0 , 0 , 9 , ['] .word last @ d->class ! ; | |
: stubs for stub next ; | |
stub cursor | |
stub scan-for-esc | |
4 stubs up down left right | |
: default: ( "- ) | |
' drop which @ d->xt @ 2 + compile ; immediate | |
:: ( -c ) | |
default: key dup 27 =if dup ['] cursor ['] key :is then ; | |
is scan-for-esc | |
' scan-for-esc is key | |
: char key literal, ; immediate | |
:: default: key | |
dup s" h" @ =if left drop 32 then | |
dup s" j" @ =if down drop 32 then | |
dup s" k" @ =if up drop 32 then | |
dup s" l" @ =if right drop 32 then | |
dup 27 =if ['] scan-for-esc ['] key :is then ; | |
is cursor | |
:: ." left" ; is left | |
:: ." right" ; is right | |
:: ." up" ; is up | |
:: ." down" ; is down |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment