diff --git a/gui/notepad/notepad.tal b/gui/notepad/notepad.tal index 382865a..b063868 100644 --- a/gui/notepad/notepad.tal +++ b/gui/notepad/notepad.tal @@ -111,7 +111,7 @@ BRK trap-mouse [ LIT &last $1 ] .Mouse/state DEI - DUP2 #0002 NEQ2 ?&no-mouse2 + DUP #02 LTH ?&no-mouse2 get-position select-word &no-mouse2 DUP2 #0001 NEQ2 ?&no-down @@ -237,8 +237,7 @@ BRK @select-from ( addr* -- ) - ( min ) get-page GTH2k [ JMP SWP2 POP2 ] - ( max ) get-eof #0001 SUB2 LTH2k [ JMP SWP2 POP2 ] + clamp-selection DUP2 .selection/a STZ2 .selection/b STZ2 @@ -247,8 +246,7 @@ BRK @select-to ( addr* -- ) - ( min ) get-page GTH2k [ JMP SWP2 POP2 ] - ( max ) get-eof #0001 SUB2 LTH2k [ JMP SWP2 POP2 ] + clamp-selection .selection/b STZ2 !select @@ -308,19 +306,22 @@ JMP2r @get-from ( -- addr* ) - .selection/a LDZ2 .selection/b LDZ2 GTH2 ?&rev - .selection/a LDZ2 + .selection/b LDZ2 .selection/a LDZ2 LTH2k [ JMP SWP2 POP2 ] JMP2r - &rev .selection/b LDZ2 JMP2r @get-to ( -- addr* ) - .selection/a LDZ2 .selection/b LDZ2 GTH2 ?&rev - .selection/b LDZ2 + .selection/a LDZ2 .selection/b LDZ2 GTH2k [ JMP SWP2 POP2 ] + +JMP2r + +@clamp-selection ( addr* -- addr* ) + + ( min ) get-page GTH2k [ JMP SWP2 POP2 ] + ( max ) get-eof #0001 SUB2 LTH2k [ JMP SWP2 POP2 ] JMP2r - &rev .selection/a LDZ2 JMP2r @is-selected ( addr* -- f ) @@ -673,6 +674,9 @@ JMP2r JMP2r +( +@|stdlib ) + @load-theme ( -- ) ;&path .File/name DEO2 @@ -688,9 +692,6 @@ JMP2r JMP2r &path ".theme $1 -( -@|stdlib ) - @msfl ( b* a* len* -- ) STH2 SWP2 EQU2k ?&e &l DUP2k STH2kr ADD2 LDA ROT ROT STA INC2 GTH2k ?&l POP2 POP2 &e POP2r JMP2r @msfr ( b* a* len* -- ) STH2 EQU2k ?&e &l DUP2 LDAk ROT ROT STH2kr ADD2 STA #0001 SUB2 LTH2k ?&l POP2 POP2 &e POP2r JMP2r @scap ( str* -- end* ) LDAk #00 NEQ [ JMP JMP2r ] &w INC2 LDAk ?&w JMP2r