~rabbits/left

b8b34cd4d71196748e750453c8845d103731261e — Devine Lu Linvega 18 days ago 7d60e6b
faster scrollbar drawing
1 files changed, 33 insertions(+), 42 deletions(-)

M src/left.tal
M src/left.tal => src/left.tal +33 -42
@@ 65,7 65,7 @@ BRK
	( name ) "Left 0a
	( details ) "A 20 "Text 20 "Editor 0a
	( author ) "By 20 "Hundred 20 "Rabbits 0a
	( date ) "Feb 20 "17, 20 "2023 00
	( date ) "Feb 20 "23, 20 "2023 00
	02
		( icon ) 83 =appicon
		( mask ) 41 1705


@@ 405,36 405,25 @@ JMP2r

	DUP2 .scroll/y LDZ2 EQU2 ?&skip
	DUP2 count-lines GTH2 ?&skip
	DUP2 set-scroll-y
	draw-textarea
	&skip
	POP2

JMP2r

@set-scroll-x ( x* -- )

	DUP2 .scroll/x LDZ2 EQU2 ?&same
		DUP2 .scroll/x STZ2
		update-nav
		&same
	POP2

JMP2r
	set-scroll-y
!draw-textarea
	&skip POP2 JMP2r

@set-scroll-y ( line* -- )

	( reset ratio )
	#0001 count-lines .scrollbar/height LDZ2 DIV2 NIP #40 SFT SFT2 .scroll/ratio STZ2
	DUP2 .scroll/y LDZ2 EQU2 ?&skip
	#00 draw-position
	DUP2 .scroll/y STZ2
	line-to-addr .scroll/addr STZ2
	#02 draw-position
!update-nav
	&skip POP2 JMP2r

	DUP2 .scroll/y LDZ2 EQU2 ?&same
		#00 draw-position
		DUP2 .scroll/y STZ2
		DUP2 line-to-addr .scroll/addr STZ2
		update-nav
		#02 draw-position
		&same
	POP2
@update-scrollbar ( -- )

	#0001 count-lines .scrollbar/height LDZ2 DIV2 NIP #40 SFT SFT2 .scroll/ratio STZ2

JMP2r



@@ 460,7 449,7 @@ JMP2r
	.Screen/width DEI2 SUB2 DUP2 #8000 LTH2 ?&no-scroll
		POP2 #0000
		&no-scroll
	set-scroll-x
	.scroll/x STZ2
	( scroll-y )
	.selection/to LDZ2 addr-to-line
	DUP2 .scroll/y LDZ2 .textarea/lines LDZ2 ADD2 LTH2 ?&no-below


@@ 495,12 484,10 @@ JMP2r

@reset-selection ( -- )

	.selection/from LDZ2 INC2k set-selection ?&no-unsearch
		#00 .search STZ
		&no-unsearch
	update-nav
	#0000 .search STZ2
	.selection/from LDZ2

!draw-textarea
!select-start

@set-selection ( from* to* -- changed )



@@ 946,7 933,7 @@ JMP2r
	;text select-start
	#0000
		DUP2 set-scroll-y
		set-scroll-x
		.scroll/x STZ2
	( draw )
	#01 draw-filepath
	update-nav


@@ 967,11 954,13 @@ JMP2r
	file-detect

	( draw )
	update-scrollbar
	update-nav
	reset-selection
	#01 draw-filepath
	#01
	#01 draw-state

!draw-state
!draw-textarea

@file-open-binary ( -- )



@@ 994,9 983,9 @@ JMP2r
	#0101 .textarea STZ2
	reset-selection
	#01 draw-filepath
	#02
	#02 draw-state

!draw-state
!draw-textarea

@file-save ( -- )



@@ 1052,19 1041,20 @@ JMP2r

@edit-cut ( -- )

	.selection/length LDZ2 #0001 GTH2 [ JMP JMP2r ]

	edit-copy
	erase-selection
	reset-selection

!reset-selection
!draw-textarea

@edit-copy ( -- )

	.selection/length LDZ2 STH2k #0001 GTH2 ?&continue
		POP2r JMP2r
		&continue
	.selection/length LDZ2 #0001 GTH2 [ JMP JMP2r ]

	;snarf-txt .File/name DEO2
	STH2r .File/length DEO2
	.selection/length LDZ2 .File/length DEO2
	.selection/from LDZ2 .File/write DEO2

JMP2r


@@ 1108,8 1098,9 @@ JMP2r
		LDA2k #0a20 NEQ2 ?&no-ls INC2k cut-char &no-ls
		INC2 GTH2k ?&l
	POP2 POP2
	reset-selection

!reset-selection
!draw-textarea

(
@|drawing )