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 ( -> )
|
@do-search ( -> )
|
||||||
#01 .searching/active STZ
|
#01 .searching/active STZ
|
||||||
;redraw-all JSR2 ;return JMP2
|
;move-to-next-match JMP2
|
||||||
|
|
||||||
|
|
||||||
@toggle-color ( -> )
|
@toggle-color ( -> )
|
||||||
.config/color LDZ2 #3733 EQU2 ,&wrap-around JCN
|
.config/color LDZ2 #3733 EQU2 ,&wrap-around JCN
|
||||||
|
@ -621,7 +620,7 @@
|
||||||
( maybe M-% for search&replace )
|
( maybe M-% for search&replace )
|
||||||
@on-key-escaped ( -> )
|
@on-key-escaped ( -> )
|
||||||
#00 .state/saw-esc STZ
|
#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-start JCN2
|
||||||
.state/key LDZ LIT '> EQU ( M-> ) ;goto-end JCN2
|
.state/key LDZ LIT '> EQU ( M-> ) ;goto-end JCN2
|
||||||
.state/key LDZ LIT 'c EQU ( M-c ) ;toggle-color JCN2
|
.state/key LDZ LIT 'c EQU ( M-c ) ;toggle-color JCN2
|
||||||
|
@ -636,7 +635,7 @@
|
||||||
|
|
||||||
@on-key-vt ( -> )
|
@on-key-vt ( -> )
|
||||||
.state/saw-vt LDZk STH #00 SWP STZ
|
.state/saw-vt LDZk STH #00 SWP STZ
|
||||||
.Console/read DEI LIT '~ EQU ,&ok JCN
|
.state/key LDZ LIT '~ EQU ,&ok JCN
|
||||||
POPr BRK
|
POPr BRK
|
||||||
&ok
|
&ok
|
||||||
STHr DUP LIT '1 NEQ ,¬-1 JCN
|
STHr DUP LIT '1 NEQ ,¬-1 JCN
|
||||||
|
@ -660,7 +659,6 @@
|
||||||
|
|
||||||
@on-key-xterm ( -> )
|
@on-key-xterm ( -> )
|
||||||
#00 .state/saw-xterm STZ
|
#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 'A EQU ( ^[[A -> up ) ;up JCN2
|
||||||
.state/key LDZ LIT 'B EQU ( ^[[B -> down ) ;down JCN2
|
.state/key LDZ LIT 'B EQU ( ^[[B -> down ) ;down JCN2
|
||||||
.state/key LDZ LIT 'C EQU ( ^[[C -> right ) ;forward JCN2
|
.state/key LDZ LIT 'C EQU ( ^[[C -> right ) ;forward JCN2
|
||||||
|
@ -682,17 +680,36 @@
|
||||||
|
|
||||||
@cancel-search
|
@cancel-search
|
||||||
#00 .searching/active STZ
|
#00 .searching/active STZ
|
||||||
|
.searching/orig-row LDZ2 ;jump-to-line JSR2
|
||||||
|
.searching/orig-col LDZ2 .cursor/col STZ2
|
||||||
;redraw-all JSR2 ;return JMP2
|
;redraw-all JSR2 ;return JMP2
|
||||||
|
|
||||||
@finish-search
|
@finish-search
|
||||||
#00 .searching/active STZ
|
#00 .searching/active STZ
|
||||||
;redraw-all JSR2 ;return JMP2
|
;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
|
@move-to-prev-match BRK
|
||||||
|
|
||||||
@on-key-searching
|
@on-key-searching
|
||||||
.Console/read DEI .state/key STZ
|
|
||||||
.state/key LDZ #07 EQU ( C-g ) ;cancel-search JCN2
|
.state/key LDZ #07 EQU ( C-g ) ;cancel-search JCN2
|
||||||
.state/key LDZ #0d EQU ( \r ) ;finish-search JCN2
|
.state/key LDZ #0d EQU ( \r ) ;finish-search JCN2
|
||||||
.state/key LDZ #6e EQU ( n ) ;move-to-next-match JCN2
|
.state/key LDZ #6e EQU ( n ) ;move-to-next-match JCN2
|
||||||
|
@ -700,7 +717,6 @@
|
||||||
;ignore JMP2
|
;ignore JMP2
|
||||||
|
|
||||||
@on-key-prompt
|
@on-key-prompt
|
||||||
.Console/read DEI .state/key STZ
|
|
||||||
.state/key LDZ #07 EQU ( C-g ) ;cancel-prompt JCN2
|
.state/key LDZ #07 EQU ( C-g ) ;cancel-prompt JCN2
|
||||||
.state/key LDZ #0d EQU ( \r ) ;finish-prompt JCN2
|
.state/key LDZ #0d EQU ( \r ) ;finish-prompt JCN2
|
||||||
.state/key LDZ #7f EQU ( DEL ) ;backspace-prompt JCN2
|
.state/key LDZ #7f EQU ( DEL ) ;backspace-prompt JCN2
|
||||||
|
@ -713,13 +729,13 @@
|
||||||
( TODO: C-s for search )
|
( TODO: C-s for search )
|
||||||
( TODO: tab input? )
|
( TODO: tab input? )
|
||||||
@on-key
|
@on-key
|
||||||
|
.Console/read DEI .state/key STZ
|
||||||
;clear-message-line JSR2
|
;clear-message-line JSR2
|
||||||
.searching/active LDZ ;on-key-searching JCN2
|
.searching/active LDZ ;on-key-searching JCN2
|
||||||
.prompt/active LDZ ;on-key-prompt JCN2
|
.prompt/active LDZ ;on-key-prompt JCN2
|
||||||
.state/saw-vt LDZ ;on-key-vt JCN2
|
.state/saw-vt LDZ ;on-key-vt JCN2
|
||||||
.state/saw-xterm LDZ ;on-key-xterm JCN2
|
.state/saw-xterm LDZ ;on-key-xterm JCN2
|
||||||
.state/saw-esc LDZ ;on-key-escaped 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 #01 EQU ( C-a ) ;bol JCN2
|
||||||
.state/key LDZ #02 EQU ( C-b ) ;back JCN2
|
.state/key LDZ #02 EQU ( C-b ) ;back JCN2
|
||||||
.state/key LDZ #04 EQU ( C-d ) ;delete JCN2
|
.state/key LDZ #04 EQU ( C-d ) ;delete JCN2
|
||||||
|
@ -1057,6 +1073,30 @@
|
||||||
&tabs #0004 ADD2 ,&loop JMP
|
&tabs #0004 ADD2 ,&loop JMP
|
||||||
&done POP2 STH2r JMP2r )
|
&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* )
|
@abs-line ( y* -> s* )
|
||||||
#0000 SWP2 SUB2 STH2 ( [-y] )
|
#0000 SWP2 SUB2 STH2 ( [-y] )
|
||||||
;data ( addr )
|
;data ( addr )
|
||||||
|
|
Loading…
Reference in New Issue