~rabbits/left

ea3cd85c97d0462dd7bc79012758718c22ba1745 — Devine Lu Linvega 2 months ago ac50e33
Improved binary paste
1 files changed, 14 insertions(+), 10 deletions(-)

M src/left.tal
M src/left.tal => src/left.tal +14 -10
@@ 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 ( -- )