diff --git a/gui/notepad/notepad.tal b/gui/notepad/notepad.tal index acf6bf7..7b5c885 100644 --- a/gui/notepad/notepad.tal +++ b/gui/notepad/notepad.tal @@ -8,13 +8,13 @@ ( TODOs: > Show blinker on last character > Mouse2 select word - > Page memory mapping ) + > Page memory mapping + > Always select end of note on change ) |0000 @page $1 @selection &from $2 &to $2 &length $2 - @textarea &length $2 |0100 @@ -32,7 +32,6 @@ ;on-frame .Screen/vector DEO2 ;on-control .Controller/vector DEO2 ( init ) - ;mem/end ;mem SUB2 .textarea/length STZ2 ;mem select-from draw-header draw-note @@ -43,7 +42,7 @@ BRK .Controller/key DEI .Controller/button DEI ( shortcuts ) - DUP2 [ LIT2 "a 01 ] NEQ2 ?&no-ca POP2 select-all JMP2r &no-ca + DUP2 [ LIT2 "a 01 ] NEQ2 ?&no-ca POP2 select-all BRK &no-ca 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 @@ -155,13 +154,6 @@ BRK ( @|editor ) -@erase-selection ( -- ) - - .selection/from LDZ2 get-eof .selection/length LDZ2 msfl - #0001 .selection/length LDZ2 SUB2 - -!mod-length - @insert ( char -- ) ( move ) #fff0 get-eof SUB2 ORA ?&valid @@ -176,7 +168,6 @@ BRK &no-block .selection/from LDZ2 STH2k #0001 SUB2 get-eof #0001 msfr - #0001 mod-length STH2kr STA STH2r INC2 @@ -196,6 +187,12 @@ BRK !select-from +@erase-selection ( -- ) + + .selection/from LDZ2 get-eof .selection/length LDZ2 msfl + +JMP2r + @delete ( -- ) get-eof .selection/from LDZ2 SUB2 ORA #01 [ JCN JMP2r ] @@ -211,7 +208,7 @@ BRK @get-eof ( -- addr* ) - ;mem .textarea/length LDZ2 ADD2 + ;mem scap JMP2r @@ -219,16 +216,11 @@ JMP2r get-eof #0001 msfl - #ffff - -( >> ) - -@mod-length ( change* -- ) - - .textarea/length LDZ2 ADD2 .textarea/length STZ2 - JMP2r +( +@|selection ) + @select-reset ( -- ) .selection/from LDZ2 @@ -260,7 +252,7 @@ JMP2r @select-all ( -- ) ;mem .selection/from STZ2 - ;mem .textarea/length LDZ2 ADD2 #0001 SUB2 .selection/to STZ2 + ;mem scap .selection/to STZ2 .selection/to LDZ2 .selection/from LDZ2 SUB2 .selection/length STZ2 @@ -275,6 +267,9 @@ JMP2r JMP2r &false POP2 #00 JMP2r +( +@|file ) + @file-size ( path* -- size* ) .File/name DEO2 @@ -304,7 +299,6 @@ JMP2r &no-selection ( push right ) .selection/from LDZ2 #0001 SUB2 get-eof STH2kr msfr - STH2kr mod-length .selection/from LDZ2 .File/read DEO2 .selection/from LDZ2 STH2r ADD2