diff --git a/gui/notepad/notepad.tal b/gui/notepad/notepad.tal index 52d242a..fa56171 100644 --- a/gui/notepad/notepad.tal +++ b/gui/notepad/notepad.tal @@ -4,9 +4,6 @@ |90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1 |a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 -( TODOs: - > Up and down arrows ) - |0000 @page $1 @@ -54,13 +51,15 @@ BRK DUP2 [ LIT2 "x 01 ] NEQ2 ?&no-cx POP2 edit-cut BRK &no-cx DUP2 [ LIT2 "c 01 ] NEQ2 ?&no-cc POP2 edit-copy BRK &no-cc DUP2 [ LIT2 "v 01 ] NEQ2 ?&no-cv POP2 edit-paste BRK &no-cv + ( mask shift key ) + #fb AND ( arrows ) - DUP #10 NEQ ?&no-u select-up &no-u - DUP #20 NEQ ?&no-d select-down &no-d + DUP #10 NEQ ?&no-u get-to #0001 SUB2 find-line-start select-variable &no-u + DUP #20 NEQ ?&no-d get-to INC2 find-line-end select-variable &no-d DUP #40 NEQ ?&no-l select-left &no-l DUP #80 NEQ ?&no-r select-right &no-r - DUP #44 NEQ ?&no-sl .selection/b LDZ2 #0001 SUB2 select-to &no-sl - DUP #84 NEQ ?&no-sr .selection/b LDZ2 INC2 select-to &no-sr + DUP #42 NEQ ?&no-sbl .selection/b LDZ2 #0001 SUB2 find-word-start select-variable &no-sbl + DUP #82 NEQ ?&no-sbr .selection/b LDZ2 INC2 find-word-end select-variable &no-sbr POP ( key ) DUP #08 NEQ ?&no-bs erase &no-bs @@ -115,7 +114,7 @@ BRK get-position select-word &no-mouse2 DUP2 #0001 NEQ2 ?&no-down - get-position select-from + get-position select-variable &no-down DUP2 #0101 NEQ2 ?&no-drag get-position select-to @@ -229,6 +228,12 @@ BRK ( @|selection ) +@select-variable ( addr* -- ) + + .Controller/button DEI #04 AND ?select-to + +!select-from + @select-reset ( -- ) get-from @@ -273,35 +278,27 @@ BRK !redraw -@select-up ( -- ) - - ( TODO ) - -JMP2r - -@select-down ( -- ) - - ( TODO ) - -JMP2r - @select-left ( -- ) - .selection/length LDZ2 #0000 EQU2 ?&no-block + .selection/length LDZ2 #0000 EQU2 + .Controller/button DEI #04 AND #00 NEQ + ORA ?&no-block get-from !select-from &no-block - get-from #0001 SUB2 + .selection/b LDZ2 #0001 SUB2 -!select-from +!select-variable @select-right ( -- ) - .selection/length LDZ2 #0000 EQU2 ?&no-block + .selection/length LDZ2 #0000 EQU2 + .Controller/button DEI #04 AND #00 NEQ + ORA ?&no-block get-to !select-from &no-block - get-from INC2 + .selection/b LDZ2 INC2 -!select-from +!select-variable @get-from ( -- addr* ) @@ -545,6 +542,50 @@ JMP2r JMP2r +@find-line-start ( addr* -- addr* ) + + ;mem SWP2 + &l + #0001 SUB2 LDAk #0a EQU ?&end + LTH2k ?&l + &end + NIP2 INC2 + +JMP2r + +@find-line-end ( addr* -- addr* ) + + get-eof SWP2 + &l + LDAk #0a EQU ?&end + INC2 GTH2k ?&l + &end + NIP2 + +JMP2r + +@find-word-start ( addr* -- addr* ) + + ;mem SWP2 + &l + #0001 SUB2 LDAk #21 LTH ?&end + LTH2k ?&l + &end + NIP2 INC2 + +JMP2r + +@find-word-end ( addr* -- addr* ) + + get-eof SWP2 + &l + LDAk #21 LTH ?&end + INC2 GTH2k ?&l + &end + NIP2 + +JMP2r + ( @|drawing )