~rabbits/left

e613186ec990102d342df08ab1bbbab675d8ef84 — Devine Lu Linvega 24 days ago b989cb1
Improved directory navigation
2 files changed, 59 insertions(+), 35 deletions(-)

M build.sh
M src/left.tal
M build.sh => build.sh +4 -4
@@ 9,7 9,7 @@ SRC="src/left.tal"
DST="bin/left.rom"

CPY="$HOME/roms"
ARG="untitled.txt"
ARG="src/left.tal"

APPID="hundredrabbits/left:uxn"



@@ 19,7 19,7 @@ mkdir bin

if [[ "$*" == *"--lint"* ]]
then
    echo ">> Linting $SRC"
  echo ">> Linting $SRC"
	$LIN $SRC
fi



@@ 28,13 28,13 @@ $ASM $SRC $DST

if [[ "$*" == *"--save"* ]]
then
    echo ">> Saving $DST"
  echo ">> Saving $DST"
	cp $DST $CPY
fi

if [[ "$*" == *"--push"* ]]
then
    echo ">> Pushing $DST"
  echo ">> Pushing $DST"
	$APP $DST $APPID
fi


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


@@ 94,7 94,7 @@ BRK
		01 "f =capture-selection "Selection $1
	02 "View $1
		01 "h =toggle-highlight "Highlight $1
		01 09 =toggle-monospace "Monospace $1
		01 "m =toggle-monospace "Monospace $1
	$1

(


@@ 1150,13 1150,38 @@ JMP2r
JMP2r

(
@|Go )
@|go )

@go-directory ( -- )

	#00 draw-filepath
	;filepath DUP2 scap #0001 SUB2 EQU2k ?&skip
	&w
		#0001 SUB2
		LDAk LIT "/ NEQ ?&no-path
			NIP2 ( null ) LITr 00 STH2 INC2r STAr !file-open
			&no-path
		NEQ2k ?&w
	&skip
	POP2
	LIT2 ". 00 SWP2 STA2

!file-open

@go-selection ( -- )

	.selection/from LDZ2 LDA2 [ LIT2 ".. ] EQU2 ?go-directory

	( append to path, if path is folder )
	[ LITr -filepath ]
	#00 STHkr scap #0001 SUB2 LDAk LIT "/ NEQ ?&no-append
		POPr INCk STH
		&no-append
	POP2

	#00 draw-filepath
	( copy selection to filepath )
	.selection/to LDZ2 .selection/from LDZ2 [ LITr -filepath ]
	.selection/to LDZ2 .selection/from LDZ2
	&w
		( end of buffer ) STHkr .filepath/end EQU ?&e
		( end of selection ) EQU2k ?&e


@@ 1169,29 1194,6 @@ JMP2r

!file-open

@go-directory ( -- )

	#00 draw-filepath
	LIT2 ". 00 .filepath STZ2

!file-open-directory

@file-open-directory ( -- )

	#0101 .textarea STZ2

	;text #ffff OVR2 SUB2 mclr
	;filepath .File/name DEO2
	#fff0 ;text SUB2 .File/length DEO2
	;text .File/read DEO2
	.File/success DEI2 .textarea/length STZ2

	reset-selection
	#01 draw-filepath
	#01

!draw-state

(
@|document )



@@ 1223,16 1225,15 @@ JMP2r
	#fff0 ;text SUB2 .File/length DEO2
	;text .File/read DEO2
	.File/success DEI2 .textarea/length STZ2
	( toggle syntax highlight )
	;filepath scap #0004 SUB2 ;&tal-ext scmp #00 EQU
		.textarea/highlight STZ

	file-detect

	( draw )
	reset-selection
	#01 draw-filepath
	#01

!draw-state
	&tal-ext ".tal $1

@file-save ( -- )



@@ 1246,6 1247,29 @@ JMP2r

!draw-state

@file-detect ( -- )

	file-is-dir ?&dir
	file-is-tal ?&tal
	#0100 .textarea STZ2

JMP2r
	&dir #0101 .textarea STZ2 JMP2r
	&tal #0000 .textarea STZ2 JMP2r

@file-is-dir ( -- bool )

	;filepath scap #0001 SUB2 LDA DUP LIT "/ EQU SWP LIT ". EQU ORA

JMP2r

@file-is-tal ( -- bool )

	;filepath scap #0004 SUB2 ;&tal-ext

!scmp
	&tal-ext ".tal $1

(
@|snarf )