~rabbits/left

bbfd6cf44fd96026f28c0aed1c0ca624a77214a0 — Devine Lu Linvega a month ago 67325bf
Added parens matching back
2 files changed, 45 insertions(+), 3 deletions(-)

M src/left.tal
M untitled.txt
M src/left.tal => src/left.tal +39 -3
@@ 14,6 14,7 @@
	@textarea &highlight $1 &length $2
	@scroll &x $2 &y $2 &addr $2 &ratio $2
	@scrollbar &height $2
	@wrap &left $2 &right $2
	@state &comment $1 &underline $1 &label $1 &mono $1 &rune $1
	@nav &cat $1 &len $1 &buf $60



@@ 60,7 61,7 @@
	( name ) "Left 0a
	( details ) "A 20 "Text 20 "Editor 0a
	( author ) "By 20 "Hundred 20 "Rabbits 0a
	( date ) "21 20 "Mar 20 "2024 $1
	( date ) "14 20 "Apr 20 "2024 $1
	01
	( > ) 83 =appicon



@@ 517,7 518,7 @@
	( >> )

@selection-changed ( -- )
	scroll-follow update-nav !reqdraw-textarea
	scroll-follow update-wrap update-nav !reqdraw-textarea

@get-from ( -- addr* )
	.selection/b LDZ2 .selection/a LDZ2 LTH2k ?{ SWP2 }


@@ 784,6 785,37 @@
		next-glyph & GTH2k ?&>l
	POP2 POP2 STH2r JMP2r

@balance-wrap ( c -- offset )
	DUP LIT "( EQU ?&a
	DUP LIT "[ EQU ?&a
	DUP LIT "{ EQU ?&a
	DUP LIT ") EQU ?&b
	DUP LIT "] EQU ?&b
	DUP LIT "} EQU ?&b
	POP #00 JMP2r
	&a POP #ff JMP2r
	&b POP #01 JMP2r

@update-wrap ( -- )
	#0000 .wrap/left STZ2k INC INC STZ2
	.selection/b LDZ2
	( | left )
	[ LITr 01 ] .scroll/addr LDZ2 ;text ADD2 #0001 SUB2 OVR2 #0001 SUB2 EQU2k ?{
		&l ( -- )
		LDAk balance-wrap STH
		ADDr STHkr ?{ .wrap/left STZ2
			!&end-l }
		prev-glyph LTH2k ?&l }
	POP2 &end-l POP2 POPr
	( | right )
	[ LITr 01 ] get-eof SWP2 EQU2k ?{
		&r ( -- )
		LDAk balance-wrap STH
		SUBr STHkr ?{ .wrap/right STZ2
			!&end-r }
		next-glyph GTH2k ?&r }
	POP2 &end-r POP2 POPr JMP2r

@clamp-addr ( addr* -- addr* )
	( min ) ;text GTH2k ?{ SWP2 }
	POP2


@@ 853,7 885,10 @@
@get-color ( addr* -- addr* color )
	DUP2 get-from LTH2 ?&no-selected
	DUP2 get-to LTH2 ?&selected
	&no-selected .textarea/highlight LDZ ?&skip
	&no-selected ( -- )
	DUP2 .wrap/left LDZ2 EQU2 ?&wrap
	DUP2 .wrap/right LDZ2 EQU2 ?&wrap
	.textarea/highlight LDZ ?&skip
	.state/comment LDZ ?&comment
	.state/label LDZ ?&label
	&skip #01 JMP2r


@@ 861,6 896,7 @@
	#0d JMP2r
	&label #02 JMP2r
	&comment #03 JMP2r
	&wrap #0d JMP2r

@get-high-width ( addr* -- addr* width* )
	LDA2k #c2b7 NEQ2 ?{ #0006 JMP2r }

M untitled.txt => untitled.txt +6 -0
@@ 2,6 2,12 @@

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

<> (reverse List (  ) ?* ) (?*)
<> (reverse (?*)) (reverse List (?*) ())
<> (reverse List (?x ?y) ?z) (reverse List ?y (?x ?z))

(reverse (modal))

@delete ( -- )
	[ LIT2 &name $2 ]
	[ LIT &field -default ]