| |
|
| \ short: u8 means utf-8 encoded address |
\ short: u8 means utf-8 encoded address |
| |
|
| : u8len ( u -- n ) |
: u8len ( u8 -- n ) |
| dup $80 u< IF drop 1 EXIT THEN \ special case ASCII |
dup $80 u< IF drop 1 EXIT THEN \ special case ASCII |
| $800 2 >r |
$800 2 >r |
| BEGIN 2dup u>= WHILE 5 lshift r> 1+ >r REPEAT |
BEGIN 2dup u>= WHILE 5 lshift r> 1+ >r REPEAT |
| THEN |
THEN |
| prefix-found @ IF bl (u8ins) THEN 0 ; |
prefix-found @ IF bl (u8ins) THEN 0 ; |
| |
|
| ' u8forw ctrl F bindkey |
: utf-8-io ( -- ) |
| ' u8back ctrl B bindkey |
['] u8forw ctrl F bindkey |
| ' ?u8del ctrl H bindkey |
['] u8back ctrl B bindkey |
| ' u8eof ctrl D bindkey |
['] ?u8del ctrl H bindkey |
| ' <u8del> ctrl X bindkey |
['] u8eof ctrl D bindkey |
| ' u8clear-tib ctrl K bindkey |
['] <u8del> ctrl X bindkey |
| ' u8first-pos ctrl A bindkey |
['] u8clear-tib ctrl K bindkey |
| ' u8end-pos ctrl E bindkey |
['] u8first-pos ctrl A bindkey |
| ' (u8enter) #lf bindkey |
['] u8end-pos ctrl E bindkey |
| ' (u8enter) #cr bindkey |
['] (u8enter) #lf bindkey |
| ' u8tab-expand #tab bindkey |
['] (u8enter) #cr bindkey |
| ' (u8ins) IS insert-char |
['] u8tab-expand #tab bindkey |
| ' save-cursor IS everyline |
['] (u8ins) IS insert-char |
| ' u8key IS key |
['] save-cursor IS everyline |
| ' u8emit IS emit |
['] u8key IS key |
| |
['] u8emit IS emit ; |
| |
|