Improved binary paste

This commit is contained in:
Devine Lu Linvega 2024-07-17 20:12:30 -07:00
parent ac50e330fb
commit ea3cd85c97
1 changed files with 14 additions and 10 deletions

View File

@ -1052,8 +1052,8 @@
@file-open-binary ( path* -- )
.File/name DEO2
#0001 .File/length DEO2
;text inject-binary ;text SUB2 .textarea/length STZ2
;text <inject-binary>
;text SUB2 .textarea/length STZ2
( | continue )
[ LIT2 01 -textarea/highlight ] STZ
select-reset #01 <draw-filepath>
@ -1084,21 +1084,24 @@
@file-inject ( name* -- )
DUP2 fbin? ?file-inject-binary
DUP2 flen ORAk ?{ POP2 POP2 JMP2r }
( skip if empty ) DUP2 flen ORAk ?{ POP2 POP2 JMP2r }
( erase sel ) has-empty? ?{ erase-selection }
( | name* addr* )
STH2k .File/length DEO2
.File/name DEO2
( | erase when selection length )
has-empty? ?{ erase-selection }
( push right ) get-from STH2kr <msfr>
.File/name DEO2
STH2kr <mod-length>
get-from .File/read DEO2
get-from STH2r ADD2 !<select-a>
@file-inject-binary ( name* -- )
get-from STH2k OVR2 flen DUP2 ADD2 DUP2 #02 SFT2 ADD2 <msfr>
( skip if empty ) DUP2 flen ORAk ?{ POP2 POP2 JMP2r }
( erase sel ) has-empty? ?{ erase-selection }
( | name* addr* )
( push right ) get-from STH2k SWP2 DUP2 ADD2 DUP2 #02 SFT2 ADD2 <msfr>
.File/name DEO2
#0001 .File/length DEO2
STH2r inject-binary DUP2 get-from SUB2 <mod-length> !<select-a>
STH2r <inject-binary>
DUP2 get-from SUB2 <mod-length> !<select-a>
@file-detect ( -- )
file-is-dir? ?&dir
@ -1125,7 +1128,8 @@
&tal-ext ".tal $1
@inject-binary ( addr* -- addr* )
@<inject-binary> ( addr* -- addr* )
#0001 .File/length DEO2
STH2
#0000
&s ( -- )