fix some bugs

This commit is contained in:
~d6 2022-03-31 01:52:20 -04:00
parent 240aa6b095
commit ac49260c04
1 changed files with 22 additions and 5 deletions

View File

@ -314,7 +314,7 @@
&done ;redraw-cursor JSR2 ;return JMP2 &done ;redraw-cursor JSR2 ;return JMP2
@center-view @center-view
;term/rows LDZ2 INC2 #0002 DIV2 STH2k .term/rows LDZ2 INC2 #0002 DIV2 STH2k
.cursor/row LDZ2 LTH2 ,&standard JCN .cursor/row LDZ2 LTH2 ,&standard JCN
POP2r POP2r
#0000 .buffer/line-offset STZ2 #0000 .buffer/line-offset STZ2
@ -429,7 +429,7 @@
GTH2 JMP2r GTH2 JMP2r
@backspace ( -> ) @backspace ( -> )
.buffer/offset LDZ2 ;data EQU2 ,&skip JCN ;cur-pos JSR2 ;data EQU2 ,&skip JCN
;go-back JSR2 ;go-back JSR2
;delete JMP2 ;delete JMP2
&skip &skip
@ -707,7 +707,24 @@
;redraw-all JSR2 ;redraw-all JSR2
;return JMP2 ;return JMP2
@move-to-prev-match BRK @move-to-prev-match
;data
( FIXME: we should consider starting at the _end_ of the current match )
;cur-pos JSR2 #0001 SUB2
&loop
GTH2k ,&fail JCN
&next
DUP2 ;matches-at JSR2
ORA ,&found JCN
#0001 SUB2 ,&loop JMP
&found
NIP2 ;jump-to-pos JSR2
,&done JMP
&fail
POP2 POP2
&done
;redraw-all JSR2
;return JMP2
@on-key-searching @on-key-searching
.state/key LDZ #07 EQU ( C-g ) ;cancel-search JCN2 .state/key LDZ #07 EQU ( C-g ) ;cancel-search JCN2
@ -726,8 +743,6 @@
BRK BRK
( TODO: C-h for help ) ( TODO: C-h for help )
( TODO: C-s for search )
( TODO: tab input? )
@on-key @on-key
.Console/read DEI .state/key STZ .Console/read DEI .state/key STZ
;clear-message-line JSR2 ;clear-message-line JSR2
@ -1073,6 +1088,7 @@
&tabs #0004 ADD2 ,&loop JMP &tabs #0004 ADD2 ,&loop JMP
&done POP2 STH2r JMP2r ) &done POP2 STH2r JMP2r )
( TODO: leaving stuff on stack it seems )
@jump-to-pos ( s* -> ) @jump-to-pos ( s* -> )
;pos-to-row-col JSR2 ( row col ) ;pos-to-row-col JSR2 ( row col )
SWP2 ;jump-to-line JSR2 SWP2 ;jump-to-line JSR2
@ -1094,6 +1110,7 @@
,&row LDR2 INC2 ,&row STR2 ,&row LDR2 INC2 ,&row STR2
INC2 ,&loop JMP INC2 ,&loop JMP
&done &done
POP2 POP2
,&row LDR2 ,&col LDR2 JMP2r ,&row LDR2 ,&col LDR2 JMP2r
[ &row $2 &col $2 ] [ &row $2 &col $2 ]