@@ 368,18 368,9 @@
(
@|editing )
-@<put-byte> ( byte -- )
- DUP #04 SFT <put-byte>/h
- &h ( byte -- )
- #0f AND DUP #09 GTH #27 MUL ADD #30 ADD
- ( >> )
-
-@<put-char> ( char -- )
- get-eof DUP2 #fff0 GTH2 ?{
- #0001 SUB2 STA
- .textarea/length LDZ2k INC2 ROT STZ2
- JMP2r }
- POP2 POP JMP2r
+@<put-byte> ( byte addr* -- )
+ ROT DUP #04 SFT hexc SWP hexc SWP2 STA2
+ JMP2r
@<insert-char> ( c addr* -- )
DUP2 #0001 <msfr>
@@ 1049,8 1040,8 @@
@file-reopen ( -- )
;text <sclr>
- ;filepath file-is-bin? ?file-open-binary
- ;filepath .File/name DEO2
+ ;filepath DUP2 file-is-bin? ?file-open-binary
+ .File/name DEO2
#fff0 ;text SUB2 .File/length DEO2
;text .File/read DEO2
.File/success DEI2 INC2 .textarea/length STZ2
@@ 1059,19 1050,21 @@
update-scrollbar update-nav select-reset #01 <draw-filepath>
#05 <draw-state> !reqdraw-textarea
-@file-open-binary ( -- )
+@file-open-binary ( path* -- )
+ .File/name DEO2
#0001 .textarea/length STZ2
- ;filepath .File/name DEO2
#0001 .File/length DEO2
- #0000
+ #0000 [ LIT2r =text ]
&s ( -- )
;&b feof? ?{
- [ LIT &b $1 ] <put-byte>
+ [ LIT &b $1 ] STH2kr INC2r INC2r <put-byte>
INC2
( | format )
DUP #01 AND ?&s
- DUP #0f AND #00 NEQ #16 MUL #0a ADD <put-char> !&s }
+ DUP #0f AND #00 NEQ #16 MUL #0a ADD STH2kr INC2r STA !&s }
POP2
+ ( | set length )
+ STH2r ;text SUB2 .textarea/length STZ2
( | continue )
[ LIT2 01 -textarea/highlight ] STZ
select-reset #01 <draw-filepath>
@@ 1110,6 1103,7 @@
&b $1
@file-inject ( name* -- )
+ DUP2 file-is-bin? ?file-inject-binary
DUP2 file-size ORAk ?{ POP2 POP2 JMP2r }
STH2
.File/name DEO2
@@ 1120,6 1114,12 @@
STH2kr mod-length get-from .File/read DEO2
get-from STH2r ADD2 !<select-a>
+@file-inject-binary ( name* -- )
+ DUP2 .File/name DEO2
+ DUP2 file-size <phex>
+ #0a18 DEO
+ POP2 JMP2r
+
@file-detect ( -- )
file-is-dir? ?&dir
file-is-tal? ?&tal
@@ 1174,7 1174,7 @@
JMP2r
@edit-paste ( -- )
- ;snarf-txt file-is-bin? ;snarf-txt !file-inject
+ ;snarf-txt !file-inject
@edit-inject ( -- )
;search !file-inject
@@ 1579,6 1579,11 @@
(
@|stdlib )
+@hexc ( hex -- char )
+ #0f AND #0a LTHk ?{
+ SUB [ LIT "a ] ADD JMP2r }
+ POP [ LIT "0 ] ADD JMP2r
+
@clab? ( c -- bool )
DUP LIT "0 SUB #0a LTH ?&ok
DUP LIT "a SUB #1a LTH ?&ok