-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathblock-026.fth
32 lines (19 loc) · 954 Bytes
/
block-026.fth
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
( Editor main loop )
( ANSI colors ... COMPILE DEFINE INTERPRET COMMENT )
vhere const ed-colors 40 vc, 203 vc, 226 vc, 255 vc,
ed-col@(state--color)-if1- ed-colors + c@then;
ed-col!(color state--)1- ed-colors + c! ;
t1(--)green cols 1+ for '-' emit next cr ;
t2(--)green '|' emit ;
footer(--)white ->foot blk ." -Block %d- "
bl dirty?ifdrop '*'thenemit
col 1+ row 1+ ." (%d,%d) " .mode rc>pos c@ ." (%d)"
cmd-buf ." (cmd: %S)" clr-eol ;
ed-emit(ch--)dup 5 <ifdup ed-col@ fgthen32 max emit ;
ed-type(a--)white >a cols 1- for @a+ ed-emit next adrop ;
show (--)cur-off 1 1 ->rc t1 rows for t2 i 0 >pos ed-type t2 cr next t1 shown ;
?show(--)show?ifshowthenfooter ;
ed-init(--)0 dup >row/col normal-mode! clean cur-block ;
ed-loop(--)begin?show ->cur vkey cur-off ed-key quit?until->cmd cur-on ;
ed(--)ed-init rl cls ed-loop ;
edit(blk--)>blk ed ;