1 .( loading editor ) update
\r
3 .( ETh - for text editor help )
\r
7 Dstralloc const editfile
\r
8 var shiftx var shifty
\r
9 var curlocx var curlocy
\r
10 Dstr \listF\TXT_ET" tmphelpfile
\r
14 dynp shifty @ 50 * +
\r
18 : fclose ( close opened file )
\r
19 handletxt @ dup if dynde handletxt off else drop then ;
\r
21 : ETnewpage fclose 27100 dynal dup handletxt ! dynp
\r
22 FF swap 27100 cfill ;
\r
25 : fopen ( strhand -- )
\r
27 dup editfile Dstr2Dstr fsDloadnew dup push dynp ( addrinp R: handinp )
\r
28 27100 dynal dup handletxt ! dynp ( addrinp addrout R: handinp )
\r
31 i dyns do ( addrinp addrout )
\r
32 over c@ ( addrinp addrout c )
\r
35 50 tmp1 @ - + tmp1 off
\r
38 drop tmp1 @ tab ( addrinp addrout numspaces )
\r
39 tmp1 @ over + tmp1 ! + 0
\r
50 : dispchar ( x y -- )
\r
55 50 * + handletxt @ dynp + c@ emit ;
\r
57 : dispcur curlocx @ curlocy @ dispchar ;
\r
60 0 over shifty @ - 1+ at!
\r
61 50 * handletxt @ dynp + shiftx @ + 50 type ;
\r
65 0 0 at! 50 do space loop
\r
66 0 0 at! ." col:" curlocx @ .
\r
67 7 0 at! ." line:" curlocy @ .
\r
68 11 0 at! ." ascii:" curlocy @ 50 * curlocx @ + handletxt @ dynp + c@ .
\r
69 1B 0 at! ." file:" editfile Dstr.
\r
70 49 0 at! ." F1-help"
\r
73 : charins ( char x y )
\r
74 50 * handletxt @ dynp + ( char x addr )
\r
76 + dup dup 1+ 4F pop - cmove ( char addr )
\r
79 : charcut ( x y -- char )
\r
81 50 * handletxt @ dynp + +
\r
82 dup c@ swap ( char addr )
\r
83 dup dup 1+ swap ( char addr addr+1 addr )
\r
84 4F pop - dup push cmove ( char addr )
\r
88 50 * dup push handletxt @ dynp + ( addr )
\r
89 dup dup 50 + handletxt @ dyns 50 - pop - cmove ( addr )
\r
93 50 * dup push handletxt @ dynp + ( addr )
\r
94 dup 50 + swap handletxt @ dyns 50 - pop - cmove ;
\r
97 0 curlocy @ 1E - 794 bound shifty !
\r
101 : length ( line -- length )
\r
102 50 * 4F + handletxt @ dynp + ( addr )
\r
105 dup c@ FF - if pop drop 0 push then
\r
112 : fsavechar ( char ) tmp2 @ swap over c! 1+ tmp2 ! ;
\r
114 27200 dynal dup dynp tmp2 !
\r
117 i length if drop pop 1+ 0 push then
\r
119 0 swap for ( desthand )
\r
121 i 50 * handletxt @ dynp +
\r
122 0 i length for ( desthand srcaddr )
\r
124 i tab 8 = if tmp3 @ if FD fsavechar tmp3 off then then
\r
126 drop tmp3 @ 1+ tmp3 !
\r
128 tmp3 @ do FF fsavechar loop tmp3 off
\r
135 tmp2 @ over dynp - over dynresize
\r
136 dup editfile fsDsave
\r
137 dynde ; rh tmp2 rh tmp3
\r
139 str TXT_default" tmpdefault
\r
145 colneg dispcur dispstatbar KBD_FW@ colnorm dispcur
\r
147 dup 415 = if ( DEL )
\r
148 curlocx @ curlocy @ charcut drop
\r
152 dup FC = if ( BACKSPACE )
\r
154 curlocx @ 1- curlocy @ charcut drop
\r
159 curlocy @ 1- dup length dup curlocx ! ( y-1 strlen )
\r
160 swap 50 * handletxt @ dynp + ( strlen y1addr )
\r
161 2dup + swap 50 + ( strlen dest src )
\r
162 swap rot 50 swap - cmove
\r
170 dup FD = if ( TAB )
\r
172 dup do FF curlocx @ curlocy @ charins loop
\r
173 curlocx @ + curlocx !
\r
177 dup FE = if ( ENTER )
\r
179 curlocy @ 1+ lineins
\r
182 over curlocy @ charcut
\r
183 over curlocy @ 1+ charins
\r
192 dup 418 = if curlocy @ 3A - curlocy ! then ( PG-UP )
\r
193 dup 419 = if curlocy @ 3A + curlocy ! then ( PG-DOWN )
\r
194 dup 416 = if curlocx off then ( HOME )
\r
195 dup 417 = if curlocy @ length curlocx ! then ( END )
\r
196 dup 401 = if tmphelpfile fsdisp disppage then ( F1 )
\r
197 dup 402 = if fsave then ( F2 )
\r
198 dup 403 = if fclose drop 1B then ( F3 )
\r
199 dup 400 = if done 0 0 at! screen cls drop -1 then ( ESC )
\r
201 0 over F0 bound? if -1 else 0 then ( NORMAL KEY )
\r
202 over FF = if drop -1 then
\r
204 curlocx @ curlocy @ charins
\r
209 dup 411 = if curlocx @ 1+ curlocx ! then ( RIGHT )
\r
210 dup 413 = if curlocx @ 1- curlocx ! then ( LEFT )
\r
211 dup 412 = if curlocy @ 1+ curlocy ! then ( DOWN )
\r
212 dup 410 = if curlocy @ 1- curlocy ! then ( UP )
\r
215 0 curlocx @ 4F bound curlocx !
\r
216 0 curlocy @ 7CF bound curlocy !
\r
218 curlocy @ shifty @ - 3B > if screenaim then
\r
220 curlocy @ shifty @ - 3B - 0 = if
\r
221 0 0 8 screen scrollf
\r
222 shifty @ 1+ shifty !
\r
226 curlocy @ shifty @ - -1 < if screenaim then
\r
228 curlocy @ shifty @ - 1+ 0 = if
\r
229 0 0 -8 screen scrollf
\r
230 shifty @ 1- shifty !
\r
236 tmpdefault editfile str2Dstr
\r
253 : ETh tmphelpfile fs. ;
\r
258 rh shiftx rh shifty
\r
259 rh curlocx rh curlocy
\r
263 rh dispchar rh dispcur
\r
264 rh displine rh dispstatbar
\r
265 rh charins rh charcut
\r
266 rh lineins rh linecut
\r
267 rh screenaim rh length
\r
268 rh fsavechar rh fsave
\r
269 rh ETnewpage rh tmpdefault
\r