| key? IF #tab (u8ins) 0 EXIT THEN |
key? IF #tab (u8ins) 0 EXIT THEN |
| u8kill-expand 2dup extract-word dup 0= IF nip EXIT THEN |
u8kill-expand 2dup extract-word dup 0= IF nip EXIT THEN |
| search-prefix tib-full? |
search-prefix tib-full? |
| IF 7 emit 2drop 0 0 prefix-found 2! |
IF 7 emit 2drop prefix-off |
| ELSE dup >r |
ELSE dup >r |
| 2>r >string r@ + 2r> 2swap insert |
2>r >string r@ + 2r> 2swap insert |
| r@ + rot r> + -rot |
r@ + rot r> + -rot |
| THEN |
THEN |
| prefix-found @ IF bl (u8ins) THEN 0 ; |
prefix-found @ IF bl (u8ins) ELSE .all .rest THEN 0 ; |
| |
|
| : utf-8-io ( -- ) |
: utf-8-io ( -- ) |
| ['] u8forw ctrl F bindkey |
['] u8forw ctrl F bindkey |
| ['] (u8enter) #cr bindkey |
['] (u8enter) #cr bindkey |
| ['] u8tab-expand #tab bindkey |
['] u8tab-expand #tab bindkey |
| ['] (u8ins) IS insert-char |
['] (u8ins) IS insert-char |
| |
['] kill-prefix IS everychar |
| ['] save-cursor IS everyline |
['] save-cursor IS everyline |
| ['] u8key IS key |
['] u8key IS key |
| ['] u8emit IS emit ; |
['] u8emit IS emit ; |