Replaced lambda-less labels

This commit is contained in:
Devine Lu Linvega 2024-05-28 08:25:16 -07:00
parent c9aaa93d74
commit 84bef276ee
1 changed files with 43 additions and 51 deletions

View File

@ -1,3 +1,5 @@
( A port of the macintosh classic notepad )
|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2 |00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller &vector $2 &button $1 &key $1 |80 @Controller &vector $2 &button $1 &key $1
@ -10,19 +12,19 @@
@collapsed $1 @collapsed $1
@selection &a $2 &b $2 &length $2 @selection &a $2 &b $2 &length $2
|100 |100 @on-reset ( -> )
( meta ) ( | meta )
;meta #06 DEO2 ;meta #06 DEO2
( theme ) ( | theme )
#f00f .System/r DEO2 #f00f .System/r DEO2
#f00f .System/g DEO2 #f00f .System/g DEO2
#f00f .System/b DEO2 #f00f .System/b DEO2
load-theme load-theme
( size ) ( | size )
#00e0 .Screen/width DEO2 #00e0 .Screen/width DEO2
#00f8 .Screen/height DEO2 #00f8 .Screen/height DEO2
( unlock ) ( | unlock )
;on-mouse-body .Mouse/vector DEO2 ;on-mouse-body .Mouse/vector DEO2
;on-frame .Screen/vector DEO2 ;on-frame .Screen/vector DEO2
;on-control .Controller/vector DEO2 ;on-control .Controller/vector DEO2
@ -37,7 +39,7 @@ BRK
( name ) "Note 20 "Pad 0a ( name ) "Note 20 "Pad 0a
( details ) "Original 20 "by 20 "Donn 20 "Denman 0a ( details ) "Original 20 "by 20 "Donn 20 "Denman 0a
( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a ( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
( date ) "May 20 "27, 20 "2024 00 ( date ) "May 20 "28, 20 "2024 00
01 01
( icon ) 83 =appicon ( icon ) 83 =appicon
@ -48,27 +50,27 @@ BRK
.Controller/key DEI .Controller/button DEI .Controller/key DEI .Controller/button DEI
( shortcuts ) ( shortcuts )
DUP2 [ LIT2 "a 01 ] NEQ2 ?&no-ca POP2 select-all BRK &no-ca DUP2 [ LIT2 "a 01 ] NEQ2 ?{ POP2 select-all BRK }
DUP2 [ LIT2 "x 01 ] NEQ2 ?&no-cx POP2 edit-cut BRK &no-cx DUP2 [ LIT2 "x 01 ] NEQ2 ?{ POP2 edit-cut BRK }
DUP2 [ LIT2 "c 01 ] NEQ2 ?&no-cc POP2 edit-copy BRK &no-cc DUP2 [ LIT2 "c 01 ] NEQ2 ?{ POP2 edit-copy BRK }
DUP2 [ LIT2 "v 01 ] NEQ2 ?&no-cv POP2 edit-paste BRK &no-cv DUP2 [ LIT2 "v 01 ] NEQ2 ?{ POP2 edit-paste BRK }
( mask shift key ) ( mask shift key )
#fb AND #fb AND
( arrows ) ( arrows )
DUP #10 NEQ ?&no-u get-to #0001 SUB2 find-line-start select-variable &no-u DUP #10 NEQ ?{ get-to #0001 SUB2 find-line-start select-variable }
DUP #20 NEQ ?&no-d get-to INC2 find-line-end select-variable &no-d DUP #20 NEQ ?{ get-to INC2 find-line-end select-variable }
DUP #40 NEQ ?&no-l select-left &no-l DUP #40 NEQ ?{ select-left }
DUP #80 NEQ ?&no-r select-right &no-r DUP #80 NEQ ?{ select-right }
DUP #42 NEQ ?&no-sbl .selection/b LDZ2 #0001 SUB2 find-word-start select-variable &no-sbl DUP #42 NEQ ?{ .selection/b LDZ2 #0001 SUB2 find-word-start select-variable }
DUP #82 NEQ ?&no-sbr .selection/b LDZ2 INC2 find-word-end select-variable &no-sbr DUP #82 NEQ ?{ .selection/b LDZ2 INC2 find-word-end select-variable }
( pagination ) ( pagination )
DUP #21 NEQ OVR #81 NEQ AND ?{ next-page } DUP #21 NEQ OVR #81 NEQ AND ?{ next-page }
DUP #11 NEQ OVR #41 NEQ AND ?{ prev-page } DUP #11 NEQ OVR #41 NEQ AND ?{ prev-page }
POP POP
( key ) ( key )
DUP #08 NEQ ?&no-bs erase &no-bs DUP #08 NEQ ?{ erase }
DUP #7f NEQ ?&no-del delete &no-del DUP #7f NEQ ?{ delete }
DUP #09 LTH ?&no-ascii DUP insert &no-ascii DUP #09 LTH ?{ DUP insert }
POP POP
#00 ;on-frame/f STA #00 ;on-frame/f STA
@ -114,15 +116,9 @@ BRK
trap-mouse trap-mouse
[ LIT &last $1 ] .Mouse/state DEI [ LIT &last $1 ] .Mouse/state DEI
DUP #02 LTH ?&no-mouse2 DUP #02 LTH ?{ get-position select-word }
get-position select-word DUP2 #0001 NEQ2 ?{ get-position select-variable }
&no-mouse2 DUP2 #0101 NEQ2 ?{ get-position select-to }
DUP2 #0001 NEQ2 ?&no-down
get-position select-variable
&no-down
DUP2 #0101 NEQ2 ?&no-drag
get-position select-to
&no-drag
,&last STR POP ,&last STR POP
BRK BRK
@ -170,9 +166,7 @@ BRK
( convert linebreaks ) ( convert linebreaks )
DUP #0d EQU #03 MUL SUB DUP #0d EQU #03 MUL SUB
.selection/length LDZ2 #0000 EQU2 ?&no-block .selection/length LDZ2 #0000 EQU2 ?{ erase-selection }
erase-selection
&no-block
get-from STH2k #0001 SUB2 get-eof #0001 msfr get-from STH2k #0001 SUB2 get-eof #0001 msfr
STH2kr STA STH2kr STA
@ -182,10 +176,9 @@ BRK
@erase ( -- ) @erase ( -- )
.selection/length LDZ2 #0000 EQU2 ?&no-block .selection/length LDZ2 #0000 EQU2 ?{
erase-selection erase-selection
!select-reset !select-reset }
&no-block
get-from get-page NEQ2 [ JMP JMP2r ] get-from get-page NEQ2 [ JMP JMP2r ]
@ -205,10 +198,9 @@ BRK
get-eof get-from SUB2 ORA #01 [ JCN JMP2r ] get-eof get-from SUB2 ORA #01 [ JCN JMP2r ]
.selection/length LDZ2 #0000 EQU2 ?&no-block .selection/length LDZ2 #0000 EQU2 ?{
erase-selection erase-selection
!select-reset !select-reset }
&no-block
get-from cut-char get-from cut-char
redraw redraw
@ -284,9 +276,9 @@ BRK
.selection/length LDZ2 #0000 EQU2 .selection/length LDZ2 #0000 EQU2
[ LIT2 04 -Controller/button ] DEI AND #00 NEQ [ LIT2 04 -Controller/button ] DEI AND #00 NEQ
ORA ?&no-block ORA ?{
get-from !select-from get-from !select-from
&no-block }
.selection/b LDZ2 #0001 SUB2 .selection/b LDZ2 #0001 SUB2
!select-variable !select-variable
@ -295,9 +287,9 @@ BRK
.selection/length LDZ2 #0000 EQU2 .selection/length LDZ2 #0000 EQU2
[ LIT2 04 -Controller/button ] DEI AND #00 NEQ [ LIT2 04 -Controller/button ] DEI AND #00 NEQ
ORA ?&no-block ORA ?{
get-to !select-from get-to !select-from
&no-block }
.selection/b LDZ2 INC2 .selection/b LDZ2 INC2
!select-variable !select-variable
@ -388,9 +380,9 @@ JMP2r
.File/name DEO2 .File/name DEO2
STH2kr .File/length DEO2 STH2kr .File/length DEO2
( erase when selection length ) ( erase when selection length )
.selection/length LDZ2 #0000 EQU2 ?&no-selection .selection/length LDZ2 #0000 EQU2 ?{
get-from get-eof .selection/length LDZ2 msfl get-from get-eof .selection/length LDZ2 msfl
&no-selection }
( push right ) get-from #0001 SUB2 ( push right ) get-from #0001 SUB2
get-eof STH2kr msfr get-eof STH2kr msfr
get-from .File/read DEO2 get-from .File/read DEO2
@ -431,12 +423,12 @@ JMP2r
@trap-mouse ( -- ) @trap-mouse ( -- )
.Mouse/y DEI2 .Mouse/y DEI2
DUP2 #0018 GTH2 ?&no-head DUP2 #0018 GTH2 ?{
POP2 ;on-mouse-head .Mouse/vector DEO2 JMP2r POP2 ;on-mouse-head .Mouse/vector DEO2 JMP2r
&no-head }
DUP2 #00d6 LTH2 ?&no-foot DUP2 #00d6 LTH2 ?{
POP2 ;on-mouse-foot .Mouse/vector DEO2 JMP2r POP2 ;on-mouse-foot .Mouse/vector DEO2 JMP2r
&no-foot }
POP2 POP2
;on-mouse-body .Mouse/vector DEO2 ;on-mouse-body .Mouse/vector DEO2
@ -507,13 +499,13 @@ JMP2r
LDAk char-width .Screen/x DEI2 ADD2 LDAk char-width .Screen/x DEI2 ADD2
.Screen/x DEO2 .Screen/x DEO2
( tab ) ( tab )
LDAk #09 NEQ ?&no-tab LDAk #09 NEQ ?{
#00 !draw-tab #00 !draw-tab
&no-tab }
( linebreak ) ( linebreak )
LDAk #0a NEQ ?&no-lb LDAk #0a NEQ ?{
#01 #0008 !draw-linebreak #01 #0008 !draw-linebreak
&no-lb }
#00 #00
JMP2r JMP2r