Pasting binary data is working

This commit is contained in:
Devine Lu Linvega 2024-07-15 10:54:31 -07:00
parent 2e0d772990
commit f7f3f73cc8
1 changed files with 22 additions and 20 deletions

View File

@ -375,20 +375,20 @@
@<insert-char> ( c addr* -- )
DUP2 #0001 <msfr>
STA
#0001 !mod-length
#0001 !<mod-length>
@<cut-char> ( addr* -- )
#0001 <msfl>
#ffff
( >> )
@mod-length ( change* -- )
@<mod-length> ( change* -- )
.textarea/length LDZ2 ADD2 .textarea/length STZ2
reqdraw-textarea reqdraw-navbar #0a !<draw-state>
@erase-selection ( -- )
get-from get-length STH2k <msfl>
update-nav #0000 STH2r SUB2 !mod-length
update-nav #0000 STH2r SUB2 !<mod-length>
@join-spaces ( addr* -- addr* )
[ LIT2r 0000 ]
@ -1052,19 +1052,8 @@
@file-open-binary ( path* -- )
.File/name DEO2
#0001 .textarea/length STZ2
#0001 .File/length DEO2
#0000 [ LIT2r =text ]
&s ( -- )
;&b feof? ?{
[ LIT &b $1 ] STH2kr INC2r INC2r <put-byte>
INC2
( | format )
DUP #01 AND ?&s
DUP #0f AND #00 NEQ #16 MUL #0a ADD STH2kr INC2r STA !&s }
POP2
( | set length )
STH2r ;text SUB2 .textarea/length STZ2
;text inject-binary ;text SUB2 .textarea/length STZ2
( | continue )
[ LIT2 01 -textarea/highlight ] STZ
select-reset #01 <draw-filepath>
@ -1111,14 +1100,15 @@
( | erase when selection length )
has-empty? ?{ erase-selection }
( push right ) get-from STH2kr <msfr>
STH2kr mod-length get-from .File/read DEO2
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
get-from STH2k OVR2 file-size 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>
@file-detect ( -- )
file-is-dir? ?&dir
@ -1159,6 +1149,18 @@
.File/read DEO2
.File/success DEI2 #0000 EQU2 JMP2r
@inject-binary ( addr* -- addr* )
STH2
#0000
&s ( -- )
;&b feof? ?{
[ LIT &b $1 ] STH2kr INC2r INC2r <put-byte>
INC2
( | format )
DUP #01 AND ?&s
DUP #0f AND #00 NEQ #16 MUL #0a ADD STH2kr INC2r STA !&s }
POP2 STH2r JMP2r
(
@|edit )