commit 607f1b567fc4c7c26e2b395c55a5165bceec4060
parent 9661defe53cbfdbc413a25caea20097389ef1018
Author: neauoire <aliceffekt@gmail.com>
Date: Wed, 10 Mar 2021 11:00:21 -0800
Completed shift left/right
Diffstat:
1 file changed, 35 insertions(+), 24 deletions(-)
diff --git a/projects/software/left.usm b/projects/software/left.usm
@@ -31,15 +31,14 @@
&Textarea2d { x1 2 y1 2 x2 2 y2 2 addr 2 cursor 1 }
&Touch2d { x1 2 y1 2 x2 2 y2 2 state 1 }
-;touch Touch2d
-
;lock 1
-;selection Range2d
-;pt Point2d ;mouse Point2d ;position Point2d ;scroll Point2d
-;textarea Textarea2d
-;label Label2d
-;j 2 ;addr 2
+;i 2 ;j 2 ;addr 2
+;selection Range2d ;position Point2d ;scroll Point2d
+
+;pt Point2d ;mouse Point2d ;touch Touch2d
+;textarea Textarea2d
+;label Label2d ( remove )
|0100 @RESET
@@ -59,9 +58,7 @@ BRK
( ctrl )
,ctrl-end ~dev/ctrl #00 EQU ~lock #00 NEQ #0000 NEQ2 JMP? POP2
-
- ( lock ) #03 =lock
-
+ ( lock ) #04 =lock
,no-ctrl-up ~dev/ctrl #10 NEQ JMP? POP2
( clamp ) ,no-ctrl-up ~position.y #0000 EQU2 JMP? POP2
,find-lineoffset JSR =position.x
@@ -128,26 +125,16 @@ BRK
,no-backspace ~dev/key #08 NEQ JMP? POP2
( erase )
+ ~selection.to ~selection.from SUB2 ,shift-left JSR
~selection.from #0001 SUB2 =selection.from
~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
,redraw JSR
,keys-end JMP
@no-backspace
( insert )
- ~document.eof #0001 ADD2 =document.eof
- ~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
+ ~selection.to ~selection.from SUB2 ,shift-right JSR
~dev/key ~selection.from STR
~selection.from #0001 ADD2 =selection.from
~selection.from #0001 ADD2 =selection.to
@@ -231,6 +218,30 @@ 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
~selection.from ~selection.to LTH2 RTS?
@@ -618,8 +629,8 @@ RTS
@arrowdown_icn [ 0010 1010 fe7c 3810 ]
@load_icn [ feaa d6aa d4aa f400 ]
@save_icn [ fe82 8282 848a f400 ]
-@filepath1 [ test.txt 00 ]
-@filepath [ projects/software/left.usm 00 ]
+@filepath [ test.txt 00 ]
+@filepath1 [ projects/software/left.usm 00 ]
|4000 ;document Document