(notepad) Walking to line

This commit is contained in:
Devine Lu Linvega 2023-04-26 20:44:04 -07:00
parent 5571680f3e
commit fe0d461997
1 changed files with 34 additions and 19 deletions

View File

@ -310,31 +310,46 @@ JMP2r
JMP2r
@pos-to-line ( y* -- line )
#0018 SUB2 #04 SFT2 NIP
JMP2r
@get-position ( -- addr* )
#0008 .Screen/x DEO2
#0018 .Screen/y DEO2
( walk to line )
.Mouse/y DEI2 pos-to-line ,&line STR
;mem
&while
.Screen/y DEI2 pos-to-line [ LIT &line $1 ] EQU ?&end
walk-char
INC2 LDAk ?&while
&end
( walk to char )
JMP2r
@walk-char ( addr* -- addr* )
( wrap )
LDAk #20 GTH ?&no-wrap
DUP2 word-length .Screen/x DEI2 ADD2 #00d0 LTH2 ?&no-wrap
draw-linebreak
INC2 LDAk walk-on AND ?&while JMP2r
!draw-linebreak
&no-wrap
( char )
LDAk #20 SUB #00 SWP ;font ADD2 LDA #00 SWP .Screen/x DEI2 ADD2
.Screen/x DEO2
( tab )
LDAk #09 NEQ ?&no-tab
draw-tab
INC2 LDAk walk-on AND ?&while JMP2r
!draw-tab
&no-tab
( linebreak )
LDAk #0a NEQ ?&no-lb
draw-linebreak
INC2 LDAk walk-on AND ?&while JMP2r
!draw-linebreak
&no-lb
INC2 LDAk walk-on AND ?&while
JMP2r