~rabbits/left

fcd62a66449f04d0c0508f85a400f6b6f0971f4a — neauoire a month ago 9a05a07
Fixed copy/paste issue
3 files changed, 54 insertions(+), 65 deletions(-)

M src/assets.tal
M src/main.tal
M untitled.txt
M src/assets.tal => src/assets.tal +2 -2
@@ 15,7 15,7 @@
	aa55 aa55 aa55 aa55 aa55 aa55 aa55 aa55

@font-data-regular 
	0000 0100 0100 0000 0010 0000 0001 0000
	0000 0808 0808 0808 0808 0808 0808 0808
	0808 0808 0808 0808 0808 0808 0808 0808
	0404 050a 070a 0903 0505 0707 0405 0406
	0808 0808 0808 0808 0808 0404 0708 0706


@@ 225,7 225,7 @@
	0000 0000 0000 0000 0000 0000 0000 0000

@font-data-bold
	0000 0100 0100 0000 0010 0000 0001 0000
	0000 0808 0808 0808 0808 0808 0808 0808
	0808 0808 0808 0808 0808 0808 0808 0808
	0405 070b 070e 0a04 0606 0707 0505 0507
	0808 0808 0807 0808 0808 0505 0707 0707

M src/main.tal => src/main.tal +50 -63
@@ 40,7 40,7 @@
%RELEASE-MOUSE { #00 .Mouse/state DEO }
%RESET-SELECTION { .selection/from LDZ2 ;select-addr JSR2 }

%EOF { ;document/body DUP2 ;document/length LDA2 ++ }
%EOF { ;document/body ;document/length LDA2 ++ }
%SPACE-AVAILABLE { #fff0 ;document/length LDA2 ;document/body ++ -- }

%IS-SPACER   { #21 < } ( char -- flag )


@@ 195,7 195,7 @@ BRK
	DUP ( ctrl+a ) #61 ! ,&no-selectall JCN
		;clear-textarea JSR2
		;document/body .selection/from STZ2
		;get-eof JSR2 #0001 -- .selection/to STZ2
		EOF .selection/to STZ2
		;draw-textarea JSR2
		POP BRK
		&no-selectall


@@ 337,8 337,8 @@ RTN
			POP BRK
			&no-clamp-to
		;clear-textarea JSR2
		SELECTION-LENGTH DUP2 #0001 == TOS -- ;shift-left JSR2
		#0001 ;shift-right JSR2
		.selection/from LDZ2 SELECTION-LENGTH DUP2 #0001 == TOS -- STH2k ++ EOF STH2r ;shiftl JSR2
		.selection/from LDZ2 EOF #0001 ;shiftr JSR2
		.selection/from LDZ2 STH2k STA
		STH2r #0001 ++ ;select-addr/no-clear JSR2
		;draw-widget/memory JSR2


@@ 359,14 359,14 @@ RTN
		;clear-textarea JSR2
		.selection/from LDZ2 #0001 -- DUP2 STH2k .selection/from STZ2 
			#0001 ++ .selection/to STZ2
		SELECTION-LENGTH ;shift-left JSR2
		.selection/from LDZ2 #0001 ++ EOF #0001 ;shiftl JSR2
		STH2r ;select-addr/no-clear JSR2
		;draw-widget/memory JSR2
	BRK

	&erase-multiple ( -- )
		;clear-textarea JSR2
		SELECTION-LENGTH ;shift-left JSR2
		.selection/from LDZ2 SELECTION-LENGTH STH2k ++ EOF STH2r ;shiftl JSR2
		.selection/from LDZ2 #0001 ++ .selection/to STZ2
		;draw-textarea JSR2
		;draw-widget/memory JSR2


@@ 683,52 683,53 @@ RTN

RTN

@clamp-addr ( addr* -- addr* )

	;document/body GTH2k ,&no-clamp-start JCN
		SWP2  
		&no-clamp-start
	POP2
	;get-eof JSR2 LTH2k ,&no-clamp-end JCN
		SWP2
		&no-clamp-end
	POP2

RTN

@get-eof ( -- length* )
		
	.scroll/addr LDZ2 
		LDAk ,&loop JCN RTN
@shiftr ( from* to* length* -- )
	
	STH2
	SWP2 #0001 --
	&loop
		( incr iterator ) #0001 ++
		LDAk ,&loop JCN
		OVR2 DUP2 LDA 
		ROT ROT STH2kr ++ STA 
		DECR2 GTH2k ,&loop JCN
	POP2 POP2
	;document/length LDA2 STH2r ++ ;document/length STA2

RTN

@shift-left ( length* -- )
@shiftl ( from* to* length* -- )
	
	STH2
	.selection/to LDZ2 ;get-eof JSR2 #0001 ++
	#0001 ++
	&loop
		( value ) OVR2 LDAk ROT ROT STH2kr -- STA
		OVR2 DUP2 LDA
		ROT ROT STH2kr -- STA 
		INCR2 LTH2k ,&loop JCN
	POP2 POP2
	( update )
	;document/length LDA2 STH2r -- ;document/length STA2

	;document/length LDA2 STH2r -- ;document/length STA2
	
RTN

@shift-right ( length* -- )
		
	STH2
	;get-eof JSR2 .selection/from LDZ2 #0001 --
@wiper ( addr* -- )

	&loop
		( value ) OVR2 LDAk ROT ROT STH2kr ++ STA
		DECR2 GTH2k ,&loop JCN
	POP2 POP2
	( update )
	;document/length LDA2 STH2r ++ ;document/length STA2
		DUP2 #00 ROT ROT STA
		#0001 ++ 
		DUP2 #0000 == ,&loop JCN
	POP2

RTN

@clamp-addr ( addr* -- addr* )

	;document/body GTH2k ,&no-clamp-start JCN
		SWP2  
		&no-clamp-start
	POP2
	EOF LTH2k ,&no-clamp-end JCN
		SWP2
		&no-clamp-end
	POP2

RTN



@@ 1017,7 1018,7 @@ RTN

@new-file ( default* -- )
	
	;clear-file JSR2
	;document/body ;wiper JSR2
	#0000 ;document/body STA2
	#0000 ;document/length STA2
	( rename )


@@ 1036,7 1037,7 @@ RTN

@load-file ( -- )

	;clear-file JSR2
	;document/body ;wiper JSR2
	;path/name .File/name DEO2 
	#fff0 ;document/body -- .File/length DEO2 
	;document/body .File/load DEO2


@@ 1061,28 1062,17 @@ RTN

RTN

@clear-file ( -- )

	;document/body
	&loop
		DUP2 #00 ROT ROT STA
		#0001 ++ 
		DUP2 #0000 == ,&loop JCN
	POP2

RTN

( snarf )

@cut-snarf ( -- )
	
	SELECTION-LENGTH STH2k #0001 >> ,&continue JCN
	SELECTION-LENGTH #0001 >> ,&continue JCN
		POP2r RTN
		&continue

	;clear-textarea JSR2
	,copy-snarf JSR
	STH2r ;shift-left JSR2
	.selection/from LDZ2 SELECTION-LENGTH STH2k ++ EOF STH2r ;shiftl JSR2
	RESET-SELECTION
	;draw-textarea JSR2



@@ 1103,17 1093,14 @@ RTN
@paste-snarf ( -- )
	
	;clear-textarea JSR2
	( erase selection ) SELECTION-LENGTH DUP2 #0001 == TOS -- ;shift-left JSR2
	( max available size ) #0200
	( push right ) STH2k ;shift-right JSR2
	( erase selection ) .selection/from LDZ2 SELECTION-LENGTH DUP2 #0001 == TOS -- STH2k ++ EOF STH2r ;shiftl JSR2
	( push right ) .selection/from LDZ2 EOF #0008 ;shiftr JSR2
	;snarfpath-txt .File/name DEO2 
	STH2kr .File/length DEO2 
	#0008 .File/length DEO2 
	.selection/from LDZ2 .File/load DEO2 
	( go to shifted text ) .selection/from LDZ2 STH2kr ++ .selection/to STZ2
	( pull left ) STH2r .File/success DEI2 STH2k -- ;shift-left JSR2
	.selection/from LDZ2 STH2r ++ 
		DUP2 .selection/from STZ2 #0001 ++ .selection/to STZ2
	;draw-textarea JSR2
	( pull left ) .selection/from LDZ2 #0008 ++ EOF #0008 .File/success DEI2 -- ;shiftl JSR2
	( cap ) #00 EOF STA
	.selection/from LDZ2 .File/success DEI2 ++ ;select-addr/no-clear JSR2 

RTN


M untitled.txt => untitled.txt +2 -0
@@ 1,5 1,7 @@
( Example file )

[]

a very long line that doesn't quite display on a single screen to test the scroll-x behaviour.

@on-frame ( -> )