fix some refactoring bugs

This commit is contained in:
~d6 2022-04-01 00:44:07 -04:00
parent f122c6e2aa
commit 17ed894126
1 changed files with 9 additions and 48 deletions

View File

@ -282,8 +282,7 @@
;redraw-statusbar-and-cursor JSR2
,&skip JMP
&next-line #0000 .cursor/col STZ2
.cursor/row LDZ2 INC2 .cursor/row STZ2 JMP2r
( ;inc-row JSR2 )
.cursor/row LDZ2 INC2 .cursor/row STZ2
;ensure-visible-cursor JSR2
;redraw-cursor JSR2
&skip ;return JMP2
@ -294,8 +293,7 @@
;cur-col JSR2 #0001 SUB2 .cursor/col STZ2
;redraw-statusbar-and-cursor JSR2 JMP2r
&next-line
( ;dec-row JSR2 )
.cursor/row LDZ2 #0001 SUB2 .cursor/row STZ2 JMP2r
.cursor/row LDZ2 #0001 SUB2 .cursor/row STZ2
;cur-len JSR2 .cursor/col STZ2
;ensure-visible-cursor JSR2 ( FIXME )
;redraw-cursor JSR2
@ -306,16 +304,14 @@
@up ( -> )
;cur-abs-row JSR2 #0000 EQU2 ,&done JCN
.cursor/row LDZ2 #0001 SUB2 .cursor/row STZ2 JMP2r
( ;dec-row JSR2 )
.cursor/row LDZ2 #0001 SUB2 .cursor/row STZ2
;ensure-visible-cursor JSR2
;redraw-statusbar JSR2
&done ;redraw-cursor JSR2 ;return JMP2
@down ( -> )
;cur-abs-row JSR2 ;last-abs-row JSR2 EQU2 ,&done JCN
( ;inc-row JSR2 )
.cursor/row LDZ2 INC2 .cursor/row STZ2 JMP2r
.cursor/row LDZ2 INC2 .cursor/row STZ2
;ensure-visible-cursor JSR2
;redraw-statusbar JSR2
&done ;redraw-cursor JSR2 ;return JMP2
@ -416,8 +412,7 @@
#01 .state/modified STZ
#0a ;cur-pos JSR2 ;shift-right JSR2
#0000 .cursor/col STZ2
( ;inc-row JSR2 )
.cursor/row LDZ2 INC2 .cursor/row STZ2 JMP2r
.cursor/row LDZ2 INC2 .cursor/row STZ2
.buffer/line-count LDZ2k INC2 ROT STZ2
;ensure-visible-cursor JSR2
;redraw-all JSR2 ;return JMP2
@ -745,7 +740,7 @@
&found
NIP2 ;jump-to-pos JSR2 #01 ,&done JMP
&fail
POP2 POP2 #00
;redraw-cursor JSR2 POP2 POP2 #00
&done
JMP2r
@ -753,14 +748,14 @@
;data
;cur-pos JSR2 #0001 SUB2
&loop
GTH2k ,&fail JMP
GTH2k ,&fail JCN
DUP2 ;matches-at JSR2
ORA ,&found JCN
#0001 SUB2 ,&loop JMP
&found
NIP2 ;jump-to-pos JSR2 #01 ,&done JMP
&fail
POP2 POP2 #00
;redraw-cursor JSR2 POP2 POP2 #00
&done
JMP2r
@ -790,7 +785,7 @@
( ;data
;cur-pos JSR2 #0001 SUB2
&loop
GTH2k ,&fail JMP
GTH2k ,&fail JCN
DUP2 ;matches-at JSR2
ORA ,&found JCN
#0001 SUB2 ,&loop JMP
@ -852,9 +847,6 @@
@min2 ( x* y* -> min* )
LTH2k JMP SWP2 POP2 JMP2r
( @max2 ( x* y* -> min* )
GTH2k JMP SWP2 POP2 JMP2r )
@term-move-cursor ( col* row* -> )
ansi INC2 ( row+1 ) ;emit-dec2 JSR2
emit-; INC2 ( col+1 ) ;emit-dec2 JSR2
@ -869,22 +861,13 @@
@term-erase-all ( -> )
ansi emit-2 emit-J JMP2r
( @redraw-is-set ( n^ -> ok^ )
.state/redraw LDZ AND JMP2r )
( @redraw-is-unset ( n^ -> ok^ )
;redraw-is-set JSR2 #00 EQU JMP2r )
@redraw-add ( n^ -> )
.state/redraw LDZk ROT ORA SWP STZ JMP2r
( @redraw-clear ( -> ) #00 .state/redraw STZ JMP2r )
@redraw-cursor ( -> ) #01 ;redraw-add JMP2
@redraw-statusbar ( -> ) #02 ;redraw-add JMP2
@redraw-statusbar-and-cursor ( -> ) #03 ;redraw-add JMP2
( @redraw-prompt ( -> ) #04 ;redraw-add JMP2 )
@redraw-prompt-and-cursor ( -> ) #05 ;redraw-add JMP2
( @redraw-matches ( -> ) #08 ;redraw-add JMP2 )
@redraw-all ( -> ) #1f ;redraw-add JMP2
( @offset-for-cur-row
@ -959,10 +942,6 @@
;tmp/data ;print JSR2
JMP2r
( @draw-prompt-and-cursor ( -> )
;draw-prompt JSR2
;draw-cursor JMP2 )
@draw-linenum ( n* -> )
;emit-reset JSR2
ansi .config/color LDZ2 emit emit emit-m
@ -1141,15 +1120,6 @@
@cur-len ( -> n* )
;cur-line JSR2 ;line-len JMP2
( @cur-last ( -> n* )
;cur-line JSR2 ;line-len JSR2 #0001 SUB2 JMP2r )
( @cur-width ( -> n* )
;cur-line JSR2 ;line-width JMP2 )
( @cur-w-last ( -> n* )
;cur-line JSR2 ;line-width JSR2 #0001 SUB2 JMP2r )
@line-len ( s* -> n* )
#0000 STH2
&loop LDAk #00 EQU ,&end JCN
@ -1157,15 +1127,6 @@
INC2 INC2r ,&loop JMP
&end POP2 STH2r JMP2r
( @line-width ( s* -> n* )
#0000 STH2
&loop LDAk #00 EQU ,&done JCN
LDAk #0a EQU ,&done JCN
LDAk #09 EQU ,&tabs JCN
INC2 INC2r ,&loop JMP
&tabs #0004 ADD2 ,&loop JMP
&done POP2 STH2r JMP2r )
@line-is-visible ( n* -> bool^ )
.buffer/line-offset LDZ2 LTH2k ,&no JCN
.term/rows LDZ2 ADD2 LTH2 JMP2r