-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.fs
40 lines (32 loc) · 984 Bytes
/
test.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
\ test: input: a single string
\ output: linked list of lines, relative line number
include data.fs
include command-mode.fs
\ display the text
: display-text ( first-line% -- )
0 over ( line% counter line% )
begin
0<> while ( line% counter )
dup . ." '"
over line-text count type ." '" cr
1+ swap
line-next @ tuck
repeat ;
\ save terminal state
s" stty -g" r/o open-pipe throw slurp-fid 2constant terminal-state
\ allow ctrl-z and ctrl-z
s" stty intr undef; stty susp undef" system
\ TODO: send message to the command mode to initialize
\ a buffer containing the string "0123456789"
\ test editing functionality
\ TODO: send message to the command mode to execute the following:
\ s" 0123456789" insert-mode
cr ." Line offset: " . cr
." Text: " cr
\ TODO: send message to the command mode to display the text
\ of the current buffer
display-text
." ---END---"
\ restore terminal
s" stty " terminal-state s+ system
quit