taro-ls: fix div by zero when resetting scrollbar; taro-ctl: use capped IO to truncate command output before writing message

This commit is contained in:
Iris Lightshard 2023-03-30 22:33:12 -06:00
parent d2a3e71fd6
commit 43c5286527
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
3 changed files with 18 additions and 5 deletions

View file

@ -19,9 +19,9 @@
The `config` file is processed into a bunch of constants for `taro-ctl` by the build script. Adjust them to your needs:
- `MBOX_ROOT`: the directory where your maildirs are.
- `TARO_LIB`: the directory where your runtime files (`taro-ls` rom, `taro-reader` script, `.theme` and `font.icn` files, etc.) will be installed to; probably just where you clone this repo to.
- `TARO_LIB`: the directory where your runtime files (`taro-ls` rom, `taro-reader` script, `.theme` and `font.icn` files, etc.) will be installed to, as well as a copy of `uxnemu`
- `TARO_DOWNLOADS`: directory where attachments are downloaded to.
- `UXN_EMU`: name of the `uxnemu` executable. You can copy `uxnemu` to, eg `taro` and it will have that `_NET_WM_CLASS`.
- `UXN_EMU`: name the `uxnemu` will be copied to - this is a hack to set the `_NET_WM_CLASS`.
- `TARO_ENV`: environment variables as you type them in the terminal, that you can use for the `READER_PROG` and `COMPOSE_PROG` commands
- `READER_PROG`: command to spawn to read mail - by default it calls the `st` terminal with some environment variables and options set, and runs `taro-reader`
- `COMPOSE_PROG`: command to spawn to write mail - by default it calls the `st` terminal with some environment variables and options set and runs `mcom` from `mblaze`
@ -126,7 +126,7 @@ Odd messages go from the `uxn` windows to `taro-ctl` (or from `taro-ctl` to itse
- `9`: trash mail; payload is the beginning and end of the `mmsg` range in u16
- `11`: read mail; payload is a single u16 `mmsg` number in the current sequence
- `13`: compose mail; no payload
- `15`: push view update (keeps search query, for after replying/writing mail or when new mail comes in)
- `15`: push view update (keeps search query, for after replying/writing mail or when new mail comes in); no payload
## socket (other IPC)

View file

@ -166,6 +166,16 @@ module Taro
end
class CappedIO < IO::Memory
def write(slice : Bytes)
if slice.size >= MSG_SIZES[MsgType::MAIL_LIST]
super(slice[0..MSG_SIZES[MsgType::MAIL_LIST] - 1])
else
super(slice)
end
end
end
class MblazeProxy
@@mailbox : String = "INBOX"
@@search_regex : String = ""
@ -179,7 +189,7 @@ module Taro
end
private def run_cmd(cmdtxt : String) : IO::Memory
io = IO::Memory.new
io = CappedIO.new
Process.run(cmdtxt, shell: true, output: io)
return io
end

View file

@ -1118,7 +1118,10 @@ JMP2r
JMP2r
@update_sb_pos ( list -- )
DUP SB_STEP LDZ2 #0000 NEQ2 ,&safe_to_divide JCN
POP JMP2r
&safe_to_divide
DUP DUP
LB_TOP LDZ2 ROT SB_STEP LDZ2 DIV2 ROT SB_POS STZ2