From ac49260c044f73d68322b2586cd3c4682510a56b Mon Sep 17 00:00:00 2001 From: d6 Date: Thu, 31 Mar 2022 01:52:20 -0400 Subject: [PATCH] fix some bugs --- femto.tal | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/femto.tal b/femto.tal index 4366c49..f48546f 100644 --- a/femto.tal +++ b/femto.tal @@ -314,7 +314,7 @@ &done ;redraw-cursor JSR2 ;return JMP2 @center-view - ;term/rows LDZ2 INC2 #0002 DIV2 STH2k + .term/rows LDZ2 INC2 #0002 DIV2 STH2k .cursor/row LDZ2 LTH2 ,&standard JCN POP2r #0000 .buffer/line-offset STZ2 @@ -429,7 +429,7 @@ GTH2 JMP2r @backspace ( -> ) - .buffer/offset LDZ2 ;data EQU2 ,&skip JCN + ;cur-pos JSR2 ;data EQU2 ,&skip JCN ;go-back JSR2 ;delete JMP2 &skip @@ -707,7 +707,24 @@ ;redraw-all JSR2 ;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 .state/key LDZ #07 EQU ( C-g ) ;cancel-search JCN2 @@ -726,8 +743,6 @@ BRK ( TODO: C-h for help ) -( TODO: C-s for search ) -( TODO: tab input? ) @on-key .Console/read DEI .state/key STZ ;clear-message-line JSR2 @@ -1073,6 +1088,7 @@ &tabs #0004 ADD2 ,&loop JMP &done POP2 STH2r JMP2r ) +( TODO: leaving stuff on stack it seems ) @jump-to-pos ( s* -> ) ;pos-to-row-col JSR2 ( row col ) SWP2 ;jump-to-line JSR2 @@ -1094,6 +1110,7 @@ ,&row LDR2 INC2 ,&row STR2 INC2 ,&loop JMP &done + POP2 POP2 ,&row LDR2 ,&col LDR2 JMP2r [ &row $2 &col $2 ]