~rabbits/left

bb269f583c995d2b480370a1939dd0477b9efd9c — Devine Lu Linvega a month ago 24c1617
Faster token drawing
1 files changed, 26 insertions(+), 40 deletions(-)

M src/left.tal
M src/left.tal => src/left.tal +26 -40
@@ 439,6 439,18 @@ JMP2r

JMP2r

@addr-to-line ( addr* -- line* )

	LIT2r 0000
	;text
	&l
		LDAk #0a NEQ JMP INC2r
		INC2 GTH2k ?&l
	POP2 POP2
	STH2r

JMP2r

@addr-to-x ( addr* -- x* )

	LIT2r 0000


@@ 464,18 476,6 @@ JMP2r
	&special POP
	&rune #0008 JMP2r

@addr-to-line ( addr* -- line* )

	LIT2r 0000
	;text
	&l
		LDAk #0a NEQ JMP INC2r
		INC2 GTH2k ?&l
	POP2 POP2
	STH2r

JMP2r

@update-selection ( -- )

	( scroll-x )


@@ 586,7 586,6 @@ JMP2r

	.selection/length LDZ2 #0001 EQU2 ?&no-block
		erase-selection
		.selection/from LDZ2 INC2k set-selection POP
		&no-block

	.selection/from LDZ2 STH2k #0001 SUB2 get-eof #0001 msfr


@@ 598,17 597,17 @@ JMP2r

@erase ( -- )

	.selection/from LDZ2 ;text NEQ2 [ JMP JMP2r ]

	.selection/length LDZ2 #0001 EQU2 ?&no-block
		erase-selection
		!reset-selection
		&no-block

	.selection/from LDZ2 ;text NEQ2 [ JMP JMP2r ]

	.selection/from LDZ2 #0001 SUB2
		DUP2 get-eof #0001 msfl
		select-start
	#ffff !mod-length ( .. )
	#ffff !mod-length

( .. )



@@ 624,9 623,8 @@ JMP2r
	.selection/from LDZ2 get-eof #0001 msfl
	update-nav
	#ffff mod-length
	!draw-textarea

( .. )
!draw-textarea

@is-selected ( addr* -- addr* bool )



@@ 639,9 637,8 @@ JMP2r

	;walk-color/c LDA ?&skip
	.textarea/highlight LDZ ?&skip
	#0001 SUB2 LDA2
		;runes cndx INC2 ORA
		SWP #21 LTH AND
	INC2k LDA #21 LTH ?&skip
	LDA ;runes cndx INC2 ORA

JMP2r
	&skip POP2 #00 JMP2r


@@ 837,9 834,14 @@ JMP2r
@draw-token ( str* -- str* )

	LDAk #21 LTH ?&whitespace

	( rune )
	DUP2 is-rune #00 EQU ?&no-rune
		#01 ;draw-ufx/ul STA
		( color ) is-selected #0c MUL INC DUP ,&color STR ;draw-ufx/color STA
		( glyph ) LDAk ;runes cndx #50 SFT2 ;rune-icns ADD2 #08 ROT ROT draw-ufx/seg
		INC2 !&w
		&no-rune
	( color ) walk-color ,&color STR
	( rune ) draw-rune
	&w
		is-selected STH
		LDAk [ LIT2 0d &color 00 ] STHr [ JMP SWP POP ] draw-ufx


@@ 858,20 860,6 @@ JMP2r

JMP2r

@draw-rune ( addr* -- addr* )

	LDAk ;runes cndx
		DUP2 #ffff EQU2 ?&no-rune
		;walk-color/c LDA ?&no-rune
		.textarea/highlight LDZ ?&no-rune
	#01 ;draw-ufx/ul STA
	( color ) SWP2 is-selected #0c MUL INC ;draw-ufx/color STA
	( glyph ) SWP2 #50 SFT2 ;rune-icns ADD2 #08 ROT ROT draw-ufx/seg
	INC2

JMP2r
	&no-rune ( addr* ffff* -- addr* ) POP2 #00 ;draw-ufx/ul STA JMP2r

@walk-color ( addr* -- addr* color )

	.textarea/highlight LDZ ?&skip


@@ 1182,11 1170,9 @@ JMP2r
@edit-cut ( -- )

	edit-copy

	erase-selection
	!reset-selection

( .. )
!reset-selection

@edit-copy ( -- )