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