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