move forward through searchings uses 'n'
This commit is contained in:
parent
e035b456f6
commit
240aa6b095
58
femto.tal
58
femto.tal
|
@ -603,8 +603,7 @@
|
|||
|
||||
@do-search ( -> )
|
||||
#01 .searching/active STZ
|
||||
;redraw-all JSR2 ;return JMP2
|
||||
|
||||
;move-to-next-match JMP2
|
||||
|
||||
@toggle-color ( -> )
|
||||
.config/color LDZ2 #3733 EQU2 ,&wrap-around JCN
|
||||
|
@ -621,7 +620,7 @@
|
|||
( maybe M-% for search&replace )
|
||||
@on-key-escaped ( -> )
|
||||
#00 .state/saw-esc STZ
|
||||
.Console/read DEI .state/key STZ
|
||||
( .Console/read DEI .state/key STZ )
|
||||
.state/key LDZ LIT '< EQU ( M-< ) ;goto-start JCN2
|
||||
.state/key LDZ LIT '> EQU ( M-> ) ;goto-end JCN2
|
||||
.state/key LDZ LIT 'c EQU ( M-c ) ;toggle-color JCN2
|
||||
|
@ -636,7 +635,7 @@
|
|||
|
||||
@on-key-vt ( -> )
|
||||
.state/saw-vt LDZk STH #00 SWP STZ
|
||||
.Console/read DEI LIT '~ EQU ,&ok JCN
|
||||
.state/key LDZ LIT '~ EQU ,&ok JCN
|
||||
POPr BRK
|
||||
&ok
|
||||
STHr DUP LIT '1 NEQ ,¬-1 JCN
|
||||
|
@ -660,7 +659,6 @@
|
|||
|
||||
@on-key-xterm ( -> )
|
||||
#00 .state/saw-xterm STZ
|
||||
.Console/read DEI .state/key STZ
|
||||
.state/key LDZ LIT 'A EQU ( ^[[A -> up ) ;up JCN2
|
||||
.state/key LDZ LIT 'B EQU ( ^[[B -> down ) ;down JCN2
|
||||
.state/key LDZ LIT 'C EQU ( ^[[C -> right ) ;forward JCN2
|
||||
|
@ -682,17 +680,36 @@
|
|||
|
||||
@cancel-search
|
||||
#00 .searching/active STZ
|
||||
.searching/orig-row LDZ2 ;jump-to-line JSR2
|
||||
.searching/orig-col LDZ2 .cursor/col STZ2
|
||||
;redraw-all JSR2 ;return JMP2
|
||||
|
||||
@finish-search
|
||||
#00 .searching/active STZ
|
||||
;redraw-all JSR2 ;return JMP2
|
||||
|
||||
@move-to-next-match BRK
|
||||
@move-to-next-match
|
||||
.buffer/limit LDZ2
|
||||
( FIXME: we should consider starting at the _end_ of the current match )
|
||||
;cur-pos JSR2 INC2
|
||||
&loop
|
||||
GTH2k ,&next JCN ,&fail JMP
|
||||
&next
|
||||
DUP2 ;matches-at JSR2
|
||||
ORA ,&found JCN
|
||||
INC2 ,&loop JMP
|
||||
&found
|
||||
NIP2 ;jump-to-pos JSR2
|
||||
,&done JMP
|
||||
&fail
|
||||
POP2 POP2
|
||||
&done
|
||||
;redraw-all JSR2
|
||||
;return JMP2
|
||||
|
||||
@move-to-prev-match BRK
|
||||
|
||||
@on-key-searching
|
||||
.Console/read DEI .state/key STZ
|
||||
.state/key LDZ #07 EQU ( C-g ) ;cancel-search JCN2
|
||||
.state/key LDZ #0d EQU ( \r ) ;finish-search JCN2
|
||||
.state/key LDZ #6e EQU ( n ) ;move-to-next-match JCN2
|
||||
|
@ -700,7 +717,6 @@
|
|||
;ignore JMP2
|
||||
|
||||
@on-key-prompt
|
||||
.Console/read DEI .state/key STZ
|
||||
.state/key LDZ #07 EQU ( C-g ) ;cancel-prompt JCN2
|
||||
.state/key LDZ #0d EQU ( \r ) ;finish-prompt JCN2
|
||||
.state/key LDZ #7f EQU ( DEL ) ;backspace-prompt JCN2
|
||||
|
@ -713,13 +729,13 @@
|
|||
( TODO: C-s for search )
|
||||
( TODO: tab input? )
|
||||
@on-key
|
||||
.Console/read DEI .state/key STZ
|
||||
;clear-message-line JSR2
|
||||
.searching/active LDZ ;on-key-searching JCN2
|
||||
.prompt/active LDZ ;on-key-prompt JCN2
|
||||
.state/saw-vt LDZ ;on-key-vt JCN2
|
||||
.state/saw-xterm LDZ ;on-key-xterm JCN2
|
||||
.state/saw-esc LDZ ;on-key-escaped JCN2
|
||||
.Console/read DEI .state/key STZ
|
||||
.state/key LDZ #01 EQU ( C-a ) ;bol JCN2
|
||||
.state/key LDZ #02 EQU ( C-b ) ;back JCN2
|
||||
.state/key LDZ #04 EQU ( C-d ) ;delete JCN2
|
||||
|
@ -1057,6 +1073,30 @@
|
|||
&tabs #0004 ADD2 ,&loop JMP
|
||||
&done POP2 STH2r JMP2r )
|
||||
|
||||
@jump-to-pos ( s* -> )
|
||||
;pos-to-row-col JSR2 ( row col )
|
||||
SWP2 ;jump-to-line JSR2
|
||||
.cursor/col STZ2
|
||||
JMP2r
|
||||
|
||||
@pos-to-row-col ( s* -> row* col* )
|
||||
#0000 ,&row STR2
|
||||
#0000 ,&col STR2
|
||||
;data
|
||||
&loop ( s pos )
|
||||
GTH2k ,&next JCN ,&done JMP
|
||||
&next
|
||||
LDAk #0a EQU ,&newline JCN
|
||||
,&col LDR2 INC2 ,&col STR2
|
||||
INC2 ,&loop JMP
|
||||
&newline
|
||||
#0000 ,&col STR2
|
||||
,&row LDR2 INC2 ,&row STR2
|
||||
INC2 ,&loop JMP
|
||||
&done
|
||||
,&row LDR2 ,&col LDR2 JMP2r
|
||||
[ &row $2 &col $2 ]
|
||||
|
||||
@abs-line ( y* -> s* )
|
||||
#0000 SWP2 SUB2 STH2 ( [-y] )
|
||||
;data ( addr )
|
||||
|
|
Loading…
Reference in New Issue