diff --git a/gui/notepad/src/notepad.tal b/gui/notepad/src/notepad.tal index a8c9f2d..d403ab4 100644 --- a/gui/notepad/src/notepad.tal +++ b/gui/notepad/src/notepad.tal @@ -96,7 +96,9 @@ @on-mouse-body ( -> ) [ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;caret-icn - [ LIT &last $1 ] .Mouse/state DEI DUP #02 LTH ?{ get-position } + [ LIT &last $1 ] .Mouse/state DEI DUP #02 LTH ?{ + get-position + [ LIT2 00 -Mouse/state ] DEO } DUP2 #0001 NEQ2 ?{ get-position } DUP2 #0101 NEQ2 ?{ get-position } ,&last STR @@ -177,10 +179,22 @@ !select @ ( addr* -- ) - DUP2 &back #0001 SUB2 LDAk #20 GTH ?&back - INC2 .selection/a STZ2 - &next INC2 LDAk #20 GTH ?&next - .selection/b STZ2 + DUP2 + &>back ( -- ) + #0001 SUB2 LDAk #20 GTH ?&>back + INC2 SWP2 + &>next ( -- ) + INC2 LDAk #20 GTH ?&>next + OVR2 OVR2 is-selection ?{ + .selection/b STZ2 + .selection/a STZ2 + !select } + POP2 + ( >> ) + +@ ( addr* -- ) + DUP2 find-line-start .selection/a STZ2 + find-line-end .selection/b STZ2 !select @ ( -- ) @@ -217,6 +231,10 @@ #01 JMP2r &false #00 JMP2r +@is-selection ( a* b* -- f ) + .selection/b LDZ2 EQU2 STH + .selection/a LDZ2 EQU2 STHr AND JMP2r + ( @|file ) @@ -370,7 +388,7 @@ POP2 STH2r JMP2r @find-line-start ( addr* -- addr* ) - ;mem SWP2 + ;mem #0001 SUB2 SWP2 &>l ( -- ) #0001 SUB2 LDAk DUP #0a EQU SWP #00 EQU ORA ?&end LTH2k ?&>l