taro-ls: generalize nav_list_by_key

This commit is contained in:
Iris Lightshard 2023-03-26 15:57:37 -06:00
parent a25d225fa5
commit baeb19bcae
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398

View file

@ -328,7 +328,7 @@ JMP2r
send_reader send_reader
&no_reader &no_reader
DUP #09 NEQ ,&no_tab JCN DUP #09 NEQ ,&no_tab JCN
change_mbox_by_key ;mbox_select_handler .mboxes [ .Controller/button DEI #04 AND ] nav_list_by_key
&no_tab &no_tab
&check_btns &check_btns
POP POP
@ -339,31 +339,32 @@ JMP2r
&no_down &no_down
BRK BRK
@change_mbox_by_key ( -> ) @nav_list_by_key ( onchange* list up? -- )
.Controller/button DEI #04 AND ,&back JCN ,&back JCN
( fwd ) ( fwd )
.mboxes/select_index LDZ2 INC2 .mboxes/len LDZ2 NEQ2 ,&can_go_fwd JCN STHk LB_SELECT_IDX LDZ2 INC2 STHkr LB_LEN LDZ2 NEQ2 ,&can_go_fwd JCN
( jump to first ) ( jump to first )
#0000 .mboxes/select_index STZ2 #0000 STHkr LB_SELECT_IDX STZ2
#0000 .mboxes/top STZ2 #0000 STHkr LB_TOP STZ2
,&end JMP ,&no_scroll_down JMP
&can_go_fwd &can_go_fwd
.mboxes/select_index LDZ2 INC2 .mboxes/select_index STZ2 STHkr LB_SELECT_IDX LDZ2 INC2 STHkr LB_SELECT_IDX STZ2
.mboxes/select_index LDZ2 #00 .mboxes/height LDZ .mboxes/top LDZ2 ADD2 LTH2 ,&no_scroll_down JCN STHkr LB_SELECT_IDX LDZ2 #00 STHkr LB_HEIGHT LDZ STHkr LB_TOP LDZ2 ADD2 LTH2 ,&no_scroll_down JCN
.mboxes/top LDZ2 INC2 .mboxes/top STZ2 STHkr LB_TOP LDZ2 INC2 STHkr LB_TOP STZ2
&no_scroll_down ,&end JMP &no_scroll_down ,&end JMP
&back &back
.mboxes/select_index LDZ2 #0000 NEQ2 ,&can_go_back JCN STHk LB_SELECT_IDX LDZ2 #0000 NEQ2 ,&can_go_back JCN
.mboxes/len LDZ2 #0001 SUB2 .mboxes/select_index STZ2 STHkr LB_LEN LDZ2 #0001 SUB2 STHkr LB_SELECT_IDX STZ2
.mboxes/len LDZ2 #00 .mboxes/height LDZ SUB2 .mboxes/top STZ2 STHkr LB_LEN LDZ2 #00 STHkr LB_HEIGHT LDZ SUB2 STHkr LB_TOP STZ2
,&end JMP ,&end JMP
&can_go_back &can_go_back
.mboxes/select_index LDZ2 #0001 SUB2 .mboxes/select_index STZ2 STHkr LB_SELECT_IDX LDZ2 #0001 SUB2 STHkr LB_SELECT_IDX STZ2
.mboxes/select_index LDZ2 INC2 .mboxes/top LDZ2 GTH2 ,&no_scroll_up JCN STHkr LB_SELECT_IDX LDZ2 INC2 STHkr LB_TOP LDZ2 GTH2 ,&no_scroll_up JCN
.mboxes/top LDZ2 #0001 SUB2 .mboxes/top STZ2 STHkr LB_TOP LDZ2 #0001 SUB2 STHkr LB_TOP STZ2
&no_scroll_up ,&end JMP &no_scroll_up ,&end JMP
&end &end
.mboxes mbox_select_handler ( onchange )
STHr ROT ROT JSR2
#01 .refresh/mboxes STZ #01 .refresh/mboxes STZ
#01 .refresh/list STZ #01 .refresh/list STZ
JMP2r JMP2r