fix some bugs

This commit is contained in:
~d6 2022-03-11 00:06:48 -05:00
parent 7fce584588
commit ed20ad7865
1 changed files with 10 additions and 9 deletions

View File

@ -440,6 +440,7 @@
&noop JMP2r
@refresh
;rel-line-error ;error! JMP2 ( FIXME )
;draw-all JSR2 BRK
@debug
@ -522,6 +523,9 @@
@draw-cursor ( -> )
;cur-w-col JSR2 .term/lmargin LDZ2 ADD2
DUP2 .term/cols LDZ2 LTH2 ,&ok JCN
( TODO: handle long line here )
&ok
;cur-rel-row JSR2
;term-move-cursor JMP2
@ -546,7 +550,7 @@
;messages/lines ;print JSR2
#20 emit
LIT '( emit
;cur-col JSR2 INC ;emit-dec JSR2
;cur-col JSR2 INC2 ;emit-dec2 JSR2
LIT ', emit
;cur-abs-row JSR2 INC2 ;emit-dec2 JSR2
LIT ') emit
@ -586,9 +590,6 @@
&bol
ADD2kr STH2r ;draw-linenum JSR2
.term/lmargin LDZ2 INC2 ,&x STR2
( TODO: use this for cursor-line highlighting and long line support )
( STH2kr .cursor/row LDZ2 INC2 NEQ2 ,&loop JCN
;emit-color-reverse JSR2 )
&loop ( offset [k line-offset] )
LDAk #00 EQU ,&eof JCN
LDAk #0a EQU ,&eol JCN
@ -597,14 +598,14 @@
GTH2 ,&skip JCN
;emit-red-dollar JSR2 ,&x LDR2 INC2 ,&x STR2
&skip INC2
,&loop JMP
,&loop JMP
&ok POP2 POP2
LDAk #09 EQU ,&do-tab JCN
LDAk emit INC2 ,&x LDR2 INC2 ,&x STR2
,&loop JMP
&eol INC2r
STH2kr .term/rows LDZ2 GTH2 ,&done JCN
cr nl INC2 ,&bol JMP
STH2kr .term/rows LDZ2 GTH2 ,&done JCN
cr nl INC2 ,&bol JMP
&do-tab ;emit-tab JSR2 INC2
.config/tab-width LDZ2 ,&x LDR2 ADD2 ,&x STR2
,&loop JMP
@ -759,10 +760,10 @@
JMP2r
@inc-row ( -> )
.cursor/row LDZ2k INC2 SWP2 STA2 JMP2r
.cursor/row LDZ2 INC2 .cursor/row STZ2 JMP2r
@dec-row ( -> )
.cursor/row LDZ2k #0001 SUB2 SWP2 STA2
.cursor/row LDZ2 #0001 SUB2 .cursor/row STZ2 JMP2r
@last-pos ( -> addr* )
.buffer/limit LDZ2 #0001 SUB2 JMP2r