taro-ls: add all buttons, click handling, implement refresh and read_all; taro-ctl: fix message size and handle 0 length messages

This commit is contained in:
Iris Lightshard 2023-03-20 22:32:11 -06:00
parent 47c0289dd6
commit bb102262e5
Signed by: nilix
GPG key ID: 3B7FBC22144E6398
2 changed files with 85 additions and 24 deletions

View file

@ -111,12 +111,16 @@ module Taro
szhigh : UInt16 = UInt16.new(szslice[1]) szhigh : UInt16 = UInt16.new(szslice[1])
@szshort = szlow + szhigh @szshort = szlow + szhigh
@sizing = false @sizing = false
if @szshort == 0
@decoding = false
break
end
else else
slc = Slice(UInt8).new(@szshort) slc = Slice(UInt8).new(@szshort)
@stdout_r.read_fully(slc) @stdout_r.read_fully(slc)
@decoding = false
data = slc data = slc
szshort = 0 @decoding = false
@szshort = 0
break break
end end
end end

View file

@ -52,7 +52,8 @@
@list [ &bytes $2 &data $2 &len $2 &offset $2 &elem_offset $1 @list [ &bytes $2 &data $2 &len $2 &offset $2 &elem_offset $1
&top $2 &height $1 &select_index $2 &select_len $2 &top $2 &height $1 &select_index $2 &select_len $2
&sb_len $1 &sb_pos $2 &sb_step $2 ] &sb_len $1 &sb_pos $2 &sb_step $2 ]
@btn_colors [ &read_all $1 ] @btn_colors [ &compose $1 &refresh $1 &read_all $1 &search $1 &refile $1 &trash $1 ]
@btn_fns [ &compose $2 &refresh $2 &read_all $2 &search $2 &refile $2 &trash $2 ]
( program ) ( program )
@ -73,9 +74,24 @@
.Screen/height DEI2 TOP_SECTION BOTTOM_SECTION ADD2 MID_SEPARATOR ADD2 SUB2 #03 SFT2 NIP .list/height STZ .Screen/height DEI2 TOP_SECTION BOTTOM_SECTION ADD2 MID_SEPARATOR ADD2 SUB2 #03 SFT2 NIP .list/height STZ
TOP_SECTION #03 SFT2 NIP .mboxes/height STZ TOP_SECTION #03 SFT2 NIP .mboxes/height STZ
#01 .refresh/btns STZ #01 .refresh/btns STZ
#01 .refresh/fg STZ #01 .refresh/fg STZ
#03 .btn_colors/compose STZ
#03 .btn_colors/refresh STZ
#03 .btn_colors/read_all STZ #03 .btn_colors/read_all STZ
#03 .btn_colors/search STZ
#03 .btn_colors/refile STZ
#03 .btn_colors/trash STZ
;noop_button_click .btn_fns/compose STZ2
;send_get_mbox .btn_fns/refresh STZ2
;send_mark_all_read .btn_fns/read_all STZ2
;noop_button_click .btn_fns/search STZ2
;noop_button_click .btn_fns/refile STZ2
;noop_button_click .btn_fns/trash STZ2
;on_screen .Screen/vector DEO2 ;on_screen .Screen/vector DEO2
;on_mouse .Mouse/vector DEO2 ;on_mouse .Mouse/vector DEO2
@ -163,6 +179,12 @@ JMP2r
JMP2r JMP2r
@send_mark_all_read ( -> )
#03 .Console/write DEO
#00 .Console/write DEOk DEO
( message size is 0, no payload )
JMP2r
@send_str ( str* -- ) @send_str ( str* -- )
&while &while
@ -182,7 +204,7 @@ BRK
;mbox_select_handler .mboxes .refresh/mboxes #0000 #00 mouse_event_list ;mbox_select_handler .mboxes .refresh/mboxes #0000 #00 mouse_event_list
;noop_list_click .list .refresh/list TOP_SECTION MID_SEPARATOR ADD2 #04 mouse_event_list ;noop_list_click .list .refresh/list TOP_SECTION MID_SEPARATOR ADD2 #04 mouse_event_list
#01 mouse_event_buttons .btn_fns .btn_colors SUB mouse_event_buttons
.resizing LDZ #00 EQU ,&resz_check JCN .resizing LDZ #00 EQU ,&resz_check JCN
( resizing ) ( resizing )
@ -215,20 +237,27 @@ BRK
( TODO: check if any button is active and only refresh if it is ) ( TODO: check if any button is active and only refresh if it is )
STHkr #00 &while EQUk ,&end JCN STHkr #00 &while EQUk ,&end JCN
DUP .btn_colors ADD #03 SWP STZ DUP .btn_colors ADD
DUP LDZ #01 NEQ ,&continue JCN
#01 .refresh/btns STZ
&continue
#03 SWP STZ
INC INC
,&while JMP &end POP2 ,&while JMP &end POP2
.Mouse/x DEI2 #0008 LTH2 ,&done JCN .Mouse/x DEI2 #0008 LTH2 ,&done JCN
.Mouse/x DEI2 #0008 SUB2 [ STHkr #00 SWP #40 SFT2 #0001 SUB2 ] GTH2 ,&done JCN .Mouse/x DEI2 #0008 SUB2 [ STHkr #00 SWP #40 SFT2 #0001 SUB2 ] GTH2 ,&done JCN
.Mouse/y DEI2 .Screen/height DEI2 #0020 SUB2 LTH2 ,&done JCN .Mouse/y DEI2 .Screen/height DEI2 #0030 SUB2 LTH2 ,&done JCN
.Mouse/y DEI2 .Screen/height DEI2 #0010 SUB2 GTH2 ,&done JCN .Mouse/y DEI2 .Screen/height DEI2 #0020 SUB2 GTH2 ,&done JCN
#01 [ .Mouse/x DEI2 #0008 SUB2 #04 SFT2 NIP ] .btn_colors ADD STZ #01 [ .Mouse/x DEI2 #0008 SUB2 #04 SFT2 NIP ] .btn_colors ADD STZ
#01 .refresh/btns STZ
.Mouse/state DEI #01 AND #00 EQU ,&done JCN
.Mouse/x DEI2 #0008 SUB2 #04 SFT2 NIP #10 SFT .btn_fns ADD LDZ2 JSR2
&done &done
#01 .refresh/btns STZ
POPr POPr
JMP2r JMP2r
@ -374,6 +403,10 @@ JMP2r
JMP2r JMP2r
@noop_button_click ( -> )
JMP2r
@try_scroll_up_mouse ( list -- ) @try_scroll_up_mouse ( list -- )
STH STH
@ -417,7 +450,12 @@ JMP2r
&no_list &no_list
.refresh/btns LDZ #00 EQU ,&no_btns JCN .refresh/btns LDZ #00 EQU ,&no_btns JCN
.btn_colors/read_all LDZ ;all_read_button #0008 .Screen/height DEI2 #0020 SUB2 draw_button_2x2_symmetrical .btn_colors/compose LDZ ;compose_button #0008 .Screen/height DEI2 #0030 SUB2 draw_2x2
.btn_colors/refresh LDZ ;refresh_button #0018 .Screen/height DEI2 #0030 SUB2 draw_2x2
.btn_colors/read_all LDZ ;all_read_button #0028 .Screen/height DEI2 #0030 SUB2 draw_2x2
.btn_colors/search LDZ ;search_button #0038 .Screen/height DEI2 #0030 SUB2 draw_2x2
.btn_colors/refile LDZ ;refile_button #0048 .Screen/height DEI2 #0030 SUB2 draw_2x2
.btn_colors/trash LDZ ;trash_button #0058 .Screen/height DEI2 #0030 SUB2 draw_2x2
#00 .refresh/btns STZ #00 .refresh/btns STZ
&no_btns &no_btns
@ -655,23 +693,14 @@ JMP2r
JMP2r JMP2r
@draw_button_2x2_symmetrical ( color sprite* x* y* -- ) @draw_2x2 ( color sprite* x* y* -- )
.Screen/y DEO2 .Screen/y DEO2
.Screen/x DEO2 .Screen/x DEO2
#16 .Screen/auto DEO
.Screen/addr DEO2 .Screen/addr DEO2
.Screen/sprite DEOk DEO
STHk .Screen/sprite DEO #00 .Screen/auto DEO
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
STHkr #10 ADD .Screen/sprite DEO
.Screen/x DEI2 #0008 SUB2 .Screen/x DEO2
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
STHkr #20 ADD .Screen/sprite DEO
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
STHr #30 ADD .Screen/sprite DEO
JMP2r JMP2r
@ -714,7 +743,35 @@ JMP2r
@scrollbar [ 0707 0707 0707 0707 ] @scrollbar [ 0707 0707 0707 0707 ]
@blank [ 0000 0000 0000 0000 ] @blank [ 0000 0000 0000 0000 ]
@all_read_button [ 0001 0111 0904 0278 ] @refresh_button [
0000 0708 1010 1000 0000 e010 3e1c 0800
0010 387c 0807 0000 0008 0808 10e0 0000
]
@all_read_button [
0000 0101 0905 003c 0000 8080 90a0 003c
3c00 0509 0101 0000 3c00 a090 8080 0000
]
@search_button [
0000 0007 0810 2142 0000 00e0 1008 8442
4221 1008 0700 0000 4284 0810 e000 0000
]
@refile_button [
0000 003f 202f 2024 0000 fe82 12fa 1202
2f24 203f 0000 0000 fa02 02fe 0000 0000
]
@trash_button [
0003 021f 101f 080a 00c0 40f8 08f8 1050
0a0a 0a08 0f00 0000 5050 5010 f000 0000
]
@compose_button [
0010 107c 1010 0102 0000 0020 5088 1020
0408 191e 1d00 0000 4080 00a8 5000 0000
]
@font [ @font [
00 00 00 00 00 00 00 00 00 18 18 18 08 00 08 00 00 14 14 00 00 00 00 00 00 24 7e 24 24 7e 24 00 00 00 00 00 00 00 00 00 00 18 18 18 08 00 08 00 00 14 14 00 00 00 00 00 00 24 7e 24 24 7e 24 00
@ -745,6 +802,6 @@ JMP2r
@word $ff @word $ff
@selected_mbox $ff @selected_mbox "INBOX 00 $f9 ( default mailbox is INBOX, total space #06 + #f9 = #ff bytes )
@list_data $4000 @list_data $4000
@mbox_data $4000 @mbox_data $4000