diff --git a/gui/notepad/notepad.tal b/gui/notepad/notepad.tal index eb13797..0aa416e 100644 --- a/gui/notepad/notepad.tal +++ b/gui/notepad/notepad.tal @@ -302,14 +302,6 @@ JMP2r JMP2r -@walk-on ( -- f ) - - .Screen/x DEI2 .Mouse/x DEI2 LTH2 - .Screen/y DEI2 .Mouse/y DEI2 #0008 SUB2 LTH2 ORA #00 NEQ - #ff MUL - -JMP2r - @pos-to-line ( y* -- line ) #0018 SUB2 #04 SFT2 NIP @@ -323,33 +315,40 @@ JMP2r ( walk to line ) .Mouse/y DEI2 pos-to-line ,&line STR ;mem - &while - .Screen/y DEI2 pos-to-line [ LIT &line $1 ] EQU ?&end - walk-char - INC2 LDAk ?&while - &end + &walk-line + .Screen/y DEI2 pos-to-line [ LIT &line $1 ] EQU ?&end-line + walk-char POP + INC2 LDAk ?&walk-line + &end-line ( walk to char ) + .Mouse/x DEI2 #0001 SUB2 ,&x STR2 + &walk-char + .Screen/x DEI2 [ LIT2 &x $2 ] GTH2 ?&end-char + walk-char ?&end-char + INC2 LDAk ?&walk-char + &end-char JMP2r -@walk-char ( addr* -- addr* ) +@walk-char ( addr* -- addr* lb ) ( wrap ) LDAk #20 GTH ?&no-wrap DUP2 word-length .Screen/x DEI2 ADD2 #00d0 LTH2 ?&no-wrap - !draw-linebreak + #01 !draw-linebreak &no-wrap ( char ) LDAk #20 SUB #00 SWP ;font ADD2 LDA #00 SWP .Screen/x DEI2 ADD2 .Screen/x DEO2 ( tab ) LDAk #09 NEQ ?&no-tab - !draw-tab + #01 !draw-tab &no-tab ( linebreak ) LDAk #0a NEQ ?&no-lb - !draw-linebreak + #01 !draw-linebreak &no-lb + #00 JMP2r