Completed shift left/right

This commit is contained in:
neauoire 2021-03-10 11:00:21 -08:00
parent 9661defe53
commit 607f1b567f
1 changed files with 35 additions and 24 deletions

View File

@ -31,15 +31,14 @@
&Textarea2d { x1 2 y1 2 x2 2 y2 2 addr 2 cursor 1 } &Textarea2d { x1 2 y1 2 x2 2 y2 2 addr 2 cursor 1 }
&Touch2d { x1 2 y1 2 x2 2 y2 2 state 1 } &Touch2d { x1 2 y1 2 x2 2 y2 2 state 1 }
;touch Touch2d
;lock 1 ;lock 1
;selection Range2d ;i 2 ;j 2 ;addr 2
;pt Point2d ;mouse Point2d ;position Point2d ;scroll Point2d
;textarea Textarea2d
;label Label2d
;j 2 ;addr 2
;selection Range2d ;position Point2d ;scroll Point2d
;pt Point2d ;mouse Point2d ;touch Touch2d
;textarea Textarea2d
;label Label2d ( remove )
|0100 @RESET |0100 @RESET
@ -59,9 +58,7 @@ BRK
( ctrl ) ( ctrl )
,ctrl-end ~dev/ctrl #00 EQU ~lock #00 NEQ #0000 NEQ2 JMP? POP2 ,ctrl-end ~dev/ctrl #00 EQU ~lock #00 NEQ #0000 NEQ2 JMP? POP2
( lock ) #04 =lock
( lock ) #03 =lock
,no-ctrl-up ~dev/ctrl #10 NEQ JMP? POP2 ,no-ctrl-up ~dev/ctrl #10 NEQ JMP? POP2
( clamp ) ,no-ctrl-up ~position.y #0000 EQU2 JMP? POP2 ( clamp ) ,no-ctrl-up ~position.y #0000 EQU2 JMP? POP2
,find-lineoffset JSR =position.x ,find-lineoffset JSR =position.x
@ -128,26 +125,16 @@ BRK
,no-backspace ~dev/key #08 NEQ JMP? POP2 ,no-backspace ~dev/key #08 NEQ JMP? POP2
( erase ) ( erase )
~selection.to ~selection.from SUB2 ,shift-left JSR
~selection.from #0001 SUB2 =selection.from ~selection.from #0001 SUB2 =selection.from
~selection.from #0001 ADD2 =selection.to ~selection.from #0001 ADD2 =selection.to
~document.eof #0001 SUB2 =document.eof
~selection.from =j ( start -> end )
@erase-loop
~j #0001 ADD2 LDR ~j STR
( incr ) ~j #0001 ADD2 =j
,erase-loop ~j ~document.eof LTH2 JMP? POP2
( release ) #00 =dev/key ( release ) #00 =dev/key
,redraw JSR ,redraw JSR
,keys-end JMP ,keys-end JMP
@no-backspace @no-backspace
( insert ) ( insert )
~document.eof #0001 ADD2 =document.eof ~selection.to ~selection.from SUB2 ,shift-right JSR
~document.eof =j ( end -> start )
@insert-loop
~j #0001 SUB2 LDR ~j STR
( decr ) ~j #0001 SUB2 =j
,insert-loop ~j ~selection.from GTH2 JMP? POP2
~dev/key ~selection.from STR ~dev/key ~selection.from STR
~selection.from #0001 ADD2 =selection.from ~selection.from #0001 ADD2 =selection.from
~selection.from #0001 ADD2 =selection.to ~selection.from #0001 ADD2 =selection.to
@ -231,6 +218,30 @@ RTS
RTS RTS
@shift-left ( length )
=i
~selection.from #0001 SUB2 =j ( start -> end )
@shift-left-loop
( move ) ~j ~i ADD2 LDR ~j STR
( incr ) ~j #0001 ADD2 =j
,shift-left-loop ~j ~document.eof LTH2 JMP? POP2
~document.eof ~i SUB2 =document.eof
RTS
@shift-right ( length )
=i
~document.eof =j ( end -> start )
@shift-right-loop
( move ) ~j ~i SUB2 LDR ~j STR
( decr ) ~j #0001 SUB2 =j
,shift-right-loop ~j ~selection.from GTH2 JMP? POP2
~document.eof ~i ADD2 =document.eof
RTS
@clamp-selection @clamp-selection
~selection.from ~selection.to LTH2 RTS? ~selection.from ~selection.to LTH2 RTS?
@ -618,8 +629,8 @@ RTS
@arrowdown_icn [ 0010 1010 fe7c 3810 ] @arrowdown_icn [ 0010 1010 fe7c 3810 ]
@load_icn [ feaa d6aa d4aa f400 ] @load_icn [ feaa d6aa d4aa f400 ]
@save_icn [ fe82 8282 848a f400 ] @save_icn [ fe82 8282 848a f400 ]
@filepath1 [ test.txt 00 ] @filepath [ test.txt 00 ]
@filepath [ projects/software/left.usm 00 ] @filepath1 [ projects/software/left.usm 00 ]
|4000 ;document Document |4000 ;document Document