... | ... |
@@ -8,12 +8,12 @@ |
8 | 8 |
- Page up/down move with ctrl+arrow |
9 | 9 |
- Double-click select word |
10 | 10 |
- Right-click find next instance of selection |
11 |
- - Mouse down selection |
|
12 | 11 |
- Copy/Cut/Paste |
13 | 12 |
- x scroll |
14 | 13 |
- Don't scroll past oef |
15 | 14 |
- Don't draw past eof |
16 | 15 |
- Draw tab characters |
16 |
+ - Blink cursor |
|
17 | 17 |
) |
18 | 18 |
|
19 | 19 |
&Console { pad 8 stdio 1 } |
... | ... |
@@ -30,8 +30,11 @@ |
30 | 30 |
&Point2d { x 2 y 2 } |
31 | 31 |
&Label2d { x 2 y 2 color 1 addr 2 } |
32 | 32 |
&Textarea2d { x1 2 y1 2 x2 2 y2 2 addr 2 cursor 1 } |
33 |
+&Touch2d { x1 2 y1 2 x2 2 y2 2 state 1 } |
|
33 | 34 |
|
34 |
-;ctrl_lock 1 |
|
35 |
+;touch Touch2d |
|
36 |
+ |
|
37 |
+;lock 1 |
|
35 | 38 |
;selection Range2d |
36 | 39 |
;pt Point2d ;mouse Point2d ;position Point2d ;scroll Point2d |
37 | 40 |
;textarea Textarea2d |
... | ... |
@@ -56,25 +59,30 @@ BRK |
56 | 59 |
|
57 | 60 |
( ctrl ) |
58 | 61 |
|
59 |
- ,ctrl-end ~dev/ctrl #00 EQU ~ctrl_lock #00 NEQ #0000 NEQ2 JMP? POP2 |
|
62 |
+ ,ctrl-end ~dev/ctrl #00 EQU ~lock #00 NEQ #0000 NEQ2 JMP? POP2 |
|
60 | 63 |
|
61 |
- ( lock ) #04 =ctrl_lock |
|
64 |
+ ( lock ) #04 =lock |
|
62 | 65 |
|
63 | 66 |
,no-ctrl-up ~dev/ctrl #10 NEQ JMP? POP2 |
64 |
- ,find-wordstart JSR DUP2 =selection.from #0001 ADD2 =selection.to |
|
65 |
- ,redraw JSR ,ctrl-end JMP |
|
67 |
+ ( clamp ) ,no-ctrl-up ~position.y #0000 EQU2 JMP? POP2 |
|
68 |
+ ,find-lineoffset JSR =position.x |
|
69 |
+ ~position.y #0001 SUB2 =position.y |
|
70 |
+ ,find-selection JSR DUP2 =selection.from #0001 ADD2 =selection.to |
|
71 |
+ ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
|
66 | 72 |
@no-ctrl-up |
67 | 73 |
,no-ctrl-down ~dev/ctrl #20 NEQ JMP? POP2 |
68 |
- ,find-wordend JSR DUP2 =selection.from #0001 ADD2 =selection.to |
|
69 |
- ,redraw JSR ,ctrl-end JMP |
|
74 |
+ ,find-lineoffset JSR =position.x ~position.y #0001 ADD2 =position.y |
|
75 |
+ ,find-selection JSR DUP2 =selection.from #0001 ADD2 =selection.to |
|
76 |
+ ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
|
70 | 77 |
@no-ctrl-down |
71 | 78 |
,no-ctrl-left ~dev/ctrl #40 NEQ JMP? POP2 |
79 |
+ ( clamp ) ,no-ctrl-left ~selection.from ,document.body EQU2 JMP? POP2 |
|
72 | 80 |
~selection.from #0001 SUB2 DUP2 =selection.from #0001 ADD2 =selection.to |
73 |
- ,redraw JSR ,ctrl-end JMP |
|
81 |
+ ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
|
74 | 82 |
@no-ctrl-left |
75 | 83 |
,no-ctrl-right ~dev/ctrl #80 NEQ JMP? POP2 |
76 | 84 |
~selection.from #0001 ADD2 DUP2 =selection.from #0001 ADD2 =selection.to |
77 |
- ,redraw JSR ,ctrl-end JMP |
|
85 |
+ ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
|
78 | 86 |
@no-ctrl-right |
79 | 87 |
( alt ) |
80 | 88 |
,no-alt ~dev/ctrl #0f AND #02 NEQ JMP? POP2 |
... | ... |
@@ -143,45 +151,67 @@ BRK |
143 | 151 |
|
144 | 152 |
( mouse ) |
145 | 153 |
|
146 |
- ,click-end ~dev/mouse.state #00 EQU JMP? POP2 |
|
147 |
- |
|
148 |
- ( scrollbar ) |
|
149 |
- ,no-click-scroll ~dev/mouse.x ~dev/screen.width #0008 SUB2 LTH2 JMP? POP2 |
|
150 |
- ,no-click-scroll-up ~dev/mouse.y #0008 GTH2 JMP? POP2 |
|
151 |
- ( decr ) ~scroll.y #00 ~scroll.y #0000 NEQ2 SUB2 =scroll.y |
|
152 |
- ,redraw JSR ,click-end JMP |
|
153 |
- @no-click-scroll-up |
|
154 |
- ,no-click-scroll-down ~dev/mouse.y ~dev/screen.height #0008 SUB2 LTH2 JMP? POP2 |
|
155 |
- ( incr ) ~scroll.y #0001 ADD2 =scroll.y |
|
156 |
- ,redraw JSR ,click-end JMP |
|
157 |
- @no-click-scroll-down |
|
158 |
- ( on scrollbar ) |
|
159 |
- ~dev/mouse.y #0008 SUB2 =scroll.y |
|
160 |
- ,redraw JSR ,click-end JMP |
|
161 |
- @no-click-scroll |
|
162 |
- |
|
163 |
- ( line number ) |
|
164 |
- ,no-click-line ~dev/mouse.x #0010 GTH2 JMP? POP2 |
|
165 |
- ~dev/mouse.y #0008 DIV2 ~scroll.y ADD2 =position.y #0000 =position.x |
|
166 |
- ,find-selection JSR DUP2 =selection.from #0001 ADD2 =selection.to |
|
167 |
- ,redraw JSR ,click-end JMP |
|
168 |
- @no-click-line |
|
154 |
+ ,touch-end ~dev/mouse.state #00 EQU JMP? POP2 |
|
169 | 155 |
|
170 |
- ( select body ) |
|
171 |
- ~dev/mouse.y #0008 DIV2 ~scroll.y ADD2 =position.y |
|
172 |
- ~dev/mouse.x ~textarea.x1 SUB2 #0007 ADD2 #0007 DIV2 =position.x |
|
156 |
+ ,touch-linebar ~dev/mouse.x #0010 LTH2 JMP? POP2 |
|
157 |
+ ,touch-body ~dev/mouse.x ~dev/screen.width #0008 SUB2 LTH2 JMP? POP2 |
|
158 |
+ ,touch-scrollbar JMP |
|
173 | 159 |
|
174 |
- ,find-selection JSR DUP2 =selection.from #0001 ADD2 =selection.to |
|
175 |
- ,redraw JSR |
|
160 |
+ @touch-end |
|
176 | 161 |
|
177 |
- @click-end |
|
162 |
+ ~dev/mouse.state =touch.state |
|
178 | 163 |
|
179 |
- ( unlock ) ,skip-unlock ~ctrl_lock #00 EQU JMP? POP2 ~ctrl_lock #01 SUB =ctrl_lock @skip-unlock |
|
164 |
+ ( unlock ) ,skip-unlock ~lock #00 EQU JMP? POP2 ~lock #01 SUB =lock @skip-unlock |
|
180 | 165 |
|
181 | 166 |
,draw-cursor JSR |
182 | 167 |
|
183 | 168 |
BRK |
184 | 169 |
|
170 |
+@touch-scrollbar |
|
171 |
+ |
|
172 |
+ ,no-click-scroll-up ~dev/mouse.y #0008 GTH2 JMP? POP2 |
|
173 |
+ ( decr ) ~scroll.y #00 ~scroll.y #0000 NEQ2 SUB2 =scroll.y |
|
174 |
+ ,redraw JSR ,touch-end JMP |
|
175 |
+ @no-click-scroll-up |
|
176 |
+ ,no-click-scroll-down ~dev/mouse.y ~dev/screen.height #0008 SUB2 LTH2 JMP? POP2 |
|
177 |
+ ( incr ) ~scroll.y #0001 ADD2 =scroll.y |
|
178 |
+ ,redraw JSR ,touch-end JMP |
|
179 |
+ @no-click-scroll-down |
|
180 |
+ ~dev/mouse.y #0008 SUB2 =scroll.y |
|
181 |
+ ,redraw JSR |
|
182 |
+ ,touch-end JMP |
|
183 |
+ |
|
184 |
+RTS |
|
185 |
+ |
|
186 |
+@touch-linebar |
|
187 |
+ |
|
188 |
+ ~dev/mouse.y #0008 DIV2 ~scroll.y ADD2 =position.y #0000 =position.x |
|
189 |
+ ,find-selection JSR DUP2 =selection.from #0001 ADD2 =selection.to |
|
190 |
+ ,redraw JSR |
|
191 |
+ ,touch-end JMP |
|
192 |
+ |
|
193 |
+RTS |
|
194 |
+ |
|
195 |
+@touch-body |
|
196 |
+ |
|
197 |
+ ~dev/mouse.y #0008 DIV2 ~scroll.y ADD2 =position.y |
|
198 |
+ ~dev/mouse.x ~textarea.x1 SUB2 #0007 ADD2 #0007 DIV2 =position.x |
|
199 |
+ |
|
200 |
+ ,touch-when ~dev/mouse.state ~touch.state NEQ JMP? POP2 |
|
201 |
+ ( on drag ) |
|
202 |
+ ,find-selection JSR =selection.to |
|
203 |
+ ,clamp-selection JSR |
|
204 |
+ ,redraw JSR |
|
205 |
+ ,touch-end JMP |
|
206 |
+ |
|
207 |
+ @touch-when |
|
208 |
+ ( on click ) |
|
209 |
+ ,find-selection JSR DUP2 =selection.from #0001 ADD2 =selection.to |
|
210 |
+ ,redraw JSR |
|
211 |
+ ,touch-end JMP |
|
212 |
+ |
|
213 |
+RTS |
|
214 |
+ |
|
185 | 215 |
@load-file ( path ) |
186 | 216 |
|
187 | 217 |
=dev/file.name #8000 =dev/file.length ,document.body =dev/file.load |
... | ... |
@@ -255,6 +285,19 @@ RTS |
255 | 285 |
|
256 | 286 |
RTS |
257 | 287 |
|
288 |
+@find-lineoffset ( return character offset from linestart ) |
|
289 |
+ |
|
290 |
+ #0000 =j |
|
291 |
+ @find-lineoffset-loop |
|
292 |
+ ( incr ) ~j #0001 ADD2 =j |
|
293 |
+ ,find-lineoffset-end ~selection.from ~j SUB2 LDR #0a EQU JMP? POP2 |
|
294 |
+ ,find-lineoffset-end ~selection.from ~j SUB2 LDR #0d EQU JMP? POP2 |
|
295 |
+ ,find-lineoffset-loop ~selection.from ~j SUB2 ,document.body GTH2 JMP? POP2 |
|
296 |
+ @find-lineoffset-end |
|
297 |
+ ( return ) ~j |
|
298 |
+ |
|
299 |
+RTS |
|
300 |
+ |
|
258 | 301 |
@find-line ( position -> addr ) |
259 | 302 |
|
260 | 303 |
,document.body =j #0000 =pt.y |
... | ... |
@@ -568,8 +611,8 @@ RTS |
568 | 611 |
@arrowdown_icn [ 0010 1010 fe7c 3810 ] |
569 | 612 |
@load_icn [ feaa d6aa d4aa f400 ] |
570 | 613 |
@save_icn [ fe82 8282 848a f400 ] |
571 |
-@filepath1 [ test.txt 00 ] |
|
572 |
-@filepath [ projects/software/left.usm 00 ] |
|
614 |
+@filepath1 [ test.txt 00 ] |
|
615 |
+@filepath [ projects/software/left.usm 00 ] |
|
573 | 616 |
|
574 | 617 |
|4000 ;document Document |
575 | 618 |
|