@@ 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"
@@ 71,7 71,6 @@ BRK
( mask ) 41 1705
@manifest
-
06 "Left $1
01 "n =file-new "New $1
01 "r =trap "Rename $1
@@ 87,7 86,7 @@ BRK
00 7f =delete "Delete $1
01 09 =edit-select-at "SelectWord $1
00 1b =reset-selection "SelectReset $1
- 00 00 =edit-trim "Trim $1
+ 01 "t =edit-trim "Trim $1
02 "Go $1
01 "/ =go-directory "Directory $1
01 0d =go-selection "Selection $1
@@ 170,7 169,7 @@ BRK
@on-mouse-trap ( -> )
( release on touch )
- .Mouse/state DEI #00 NEQ [ JMP BRK ]
+ .Mouse/state DEI #01 [ JCN BRK ]
untrap
BRK
@@ 271,7 270,7 @@ JMP2r
.Mouse/x DEI2 #0088 GTH2 ?on-mouse-textarea
.Mouse/x DEI2 #0008 LTH2 ?on-mouse-scrollbar
( on-navbar )
- .Mouse/state DEI #00 NEQ [ JMP BRK ]
+ .Mouse/state DEI #01 [ JCN BRK ]
.Mouse/y DEI2 #04 SFT2 NIP #02 SUB
select-marker
( release )
@@ 325,7 324,7 @@ BRK
EQUkr STHr ?&ver-end
scan-comment
scan-fixed
- LDAk #0a NEQ JMP INCr
+ LDAk #0a NEQ [ JMP INCr ]
INC2 LDAk ?&ver
&ver-end
POP2r
@@ 373,17 372,6 @@ BRK
(
@|actions )
-@scroll-to ( line* -- )
-
- DUP2 .scroll/y LDZ2 EQU2 ?&skip
- DUP2 count-lines GTH2 ?&skip
- DUP2 set-scroll-y
- draw-textarea
- &skip
- POP2
-
-JMP2r
-
@get-eof ( -- addr* )
;text .textarea/length LDZ2 ADD2
@@ 397,22 385,51 @@ JMP2r
@put-char ( char -- )
- get-eof STA .textarea/length LDZ2k INC2 ROT STZ2
+ get-eof
+ DUP2 #fff0 GTH2 ?&skip
+ STA .textarea/length LDZ2k INC2 ROT STZ2
JMP2r
+ &skip POP2 POP JMP2r
+
+@cut-char ( addr* -- )
+
+ get-eof #0001 msfl
+ #ffff
+
+( >> )
+
+@mod-length ( change* -- )
+
+ STH2
+ .textarea/length LDZ2k STH2r ADD2 ROT STZ2
+ #02
+
+!draw-state
@count-lines ( -- line* )
LITr -scroll/y LDZ2r
- get-eof .scroll/addr LDZ2
+ .scroll/addr LDZ2
&w
- LDAk #0a NEQ JMP INC2r
- INC2 GTH2k ?&w
- POP2 POP2
+ LDAk #0a NEQ [ JMP INC2r ]
+ INC2 LDAk ?&w
+ POP2
STH2r
JMP2r
+@scroll-to ( line* -- )
+
+ 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
@@ 439,14 456,6 @@ JMP2r
JMP2r
-@mod-length ( change* -- )
-
- STH2
- .textarea/length LDZ2k STH2r ADD2 ROT STZ2
- #02
-
-!draw-state
-
@line-to-addr ( line* -- addr* )
STH2
@@ 454,7 463,7 @@ JMP2r
;text
&w
EQU2kr STHr ?&end
- LDAk #0a NEQ JMP INC2r
+ LDAk #0a NEQ [ JMP INC2r ]
INC2 LDAk ?&w
&end
POP2r POP2r
@@ 466,7 475,7 @@ JMP2r
LIT2r 0000
;text
&l
- LDAk #0a NEQ JMP INC2r
+ LDAk #0a NEQ [ JMP INC2r ]
INC2 GTH2k ?&l
POP2 POP2
STH2r
@@ 487,26 496,6 @@ JMP2r
JMP2r
-@update-selection ( -- )
-
- ( scroll-x )
- .selection/to LDZ2 #0001 SUB2 addr-to-x #00a0 ADD2
- .Screen/width DEI2 SUB2 DUP2 #8000 LTH2 ?&no-scroll
- POP2 #0000
- &no-scroll
- set-scroll-x
- ( scroll-y )
- .selection/to LDZ2 addr-to-line
- DUP2 .scroll/y LDZ2 .textarea/lines LDZ2 ADD2 LTH2 ?&no-below
- DUP2 .scroll/y LDZ2 .textarea/lines LDZ2 ADD2 SUB2
- .scroll/y LDZ2 INC2 ADD2 set-scroll-y
- &no-below
- DUP2 .scroll/y LDZ2 GTH2 ?&no-above
- DUP2 set-scroll-y
- &no-above
- POP2
-
-!draw-textarea
@select-word ( addr* -- )
@@ 525,7 514,24 @@ JMP2r
@select-range ( from* to* -- )
set-selection [ JMP JMP2r ]
- update-selection
+ ( scroll-x )
+ .selection/to LDZ2 #0001 SUB2 addr-to-x #00a0 ADD2
+ .Screen/width DEI2 SUB2 DUP2 #8000 LTH2 ?&no-scroll
+ POP2 #0000
+ &no-scroll
+ set-scroll-x
+ ( scroll-y )
+ .selection/to LDZ2 addr-to-line
+ DUP2 .scroll/y LDZ2 .textarea/lines LDZ2 ADD2 LTH2 ?&no-below
+ DUP2 .scroll/y LDZ2 .textarea/lines LDZ2 ADD2 SUB2
+ .scroll/y LDZ2 INC2 ADD2 set-scroll-y
+ &no-below
+ DUP2 .scroll/y LDZ2 GTH2 ?&no-above
+ DUP2 set-scroll-y
+ &no-above
+ POP2
+
+ draw-textarea
!update-nav
@@ 612,7 618,7 @@ JMP2r
.selection/from LDZ2 ;text NEQ2 [ JMP JMP2r ]
.selection/from LDZ2 #0001 SUB2
- DUP2 trim
+ DUP2 cut-char
!select-start
@@ 625,18 631,11 @@ JMP2r
!reset-selection
&no-block
- .selection/from LDZ2 trim
+ .selection/from LDZ2 cut-char
update-nav
!draw-textarea
-@trim ( addr* -- )
-
- get-eof #0001 msfl
- #ffff
-
-!mod-length
-
@is-selected ( addr* -- addr* bool )
DUP2 .selection/from LDZ2 #0001 SUB2 GTH2 STH
@@ 1278,8 1277,6 @@ JMP2r
@file-save ( -- )
- edit-trim
-
;filepath .File/name DEO2
;text
DUP2 slen .File/length DEO2
@@ 1380,12 1377,12 @@ JMP2r
get-eof ;text
&l
- LDA2k #0920 NEQ2 ?&no-ts INC2k trim &no-ts
- LDA2k #2009 NEQ2 ?&no-st DUP2 trim &no-st
- LDA2k #2020 NEQ2 ?&no-ss INC2k trim &no-ss
- LDA2k #200a NEQ2 ?&no-sl DUP2 trim &no-sl
- LDA2k #090a NEQ2 ?&no-tl DUP2 trim &no-tl
- LDA2k #0a20 NEQ2 ?&no-ls INC2k trim &no-ls
+ LDA2k #0920 NEQ2 ?&no-ts INC2k cut-char &no-ts
+ LDA2k #2009 NEQ2 ?&no-st DUP2 cut-char &no-st
+ LDA2k #2020 NEQ2 ?&no-ss INC2k cut-char &no-ss
+ LDA2k #200a NEQ2 ?&no-sl DUP2 cut-char &no-sl
+ LDA2k #090a NEQ2 ?&no-tl DUP2 cut-char &no-tl
+ LDA2k #0a20 NEQ2 ?&no-ls INC2k cut-char &no-ls
INC2 GTH2k ?&l
POP2 POP2