update build script and add quote escape to config; taro-ls: fix scroll wrap by keyboard if the number of items is less than the height of the listbox

This commit is contained in:
Iris Lightshard 2023-03-29 12:11:47 -06:00
parent f3a781e42b
commit 62a4845edd
Signed by: nilix
GPG key ID: 3B7FBC22144E6398
4 changed files with 34 additions and 20 deletions

View file

@ -1,6 +1,20 @@
#!/bin/sh #!/bin/sh
# check we have all dependencies
echo "Checking dependencies..."
if ! which uxnasm || ! which uxnemu || ! which crystal || ! which mseq ; then
echo "dependencies are not met - we need:"
echo "- uxnasm"
echo "- uxnemu"
echo "- crystal"
echo "- mblaze"
exit 1
fi
# build config into crystal constants # build config into crystal constants
echo "Generating config.cr" echo "Generating config.cr"
. ./config . ./config
@ -15,12 +29,8 @@ READER_PROG = "${READER_PROG}"
COMPOSE_PROG = "${COMPOSE_PROG}" COMPOSE_PROG = "${COMPOSE_PROG}"
END END
if ! which ${UXN_EMU}; then
echo "${UXN_EMU} is not in PATH! Beware..."
sleep 1
fi
# build # build
echo "Building taro-ls" echo "Building taro-ls"
uxnasm taro-ls.tal taro-ls uxnasm taro-ls.tal taro-ls
echo "Building taro-ctl" echo "Building taro-ctl"
@ -28,15 +38,20 @@ crystal build --release --no-debug -s taro-ctl.cr
# setup TARO_LIB # setup TARO_LIB
if [ ${TARO_LIB} != ${PWD} ]; then if [ "${TARO_LIB}" != "${PWD}" ]; then
mkdir -p ${TARO_LIB} mkdir -p "${TARO_LIB}"
for x in "taro-ls taro-reader lesskey .theme font.icn taro-ctl taro.svg"; do for x in taro-ls taro-reader lesskey .theme font.icn taro-ctl taro.svg; do
if [ -e ${x} ]; then if [ -e ${x} ]; then
cp ${x} ${TARO_LIB} cp ${x} "${TARO_LIB}"
fi fi
done done
echo "TARO_LIB is in ${TARO_LIB}; add it to your PATH or you can just copy taro-ctl there." echo "TARO_LIB is in ${TARO_LIB}; you can either"
echo "- add it to your PATH"
echo "- or copy taro-ctl into your PATH"
fi fi
cp "$(which uxnemu)" "${TARO_LIB}/${UXN_EMU}"
# optionally, fill out desktopfile with proper variables and install it
if [ "$1" = "desktopfile" ]; then if [ "$1" = "desktopfile" ]; then
sed -e "s#TARO_LIB#${TARO_LIB}#g" -e "s#UXN_EMU#${UXN_EMU}#g" taro.desktop > ~/.local/share/applications/taro.desktop sed -e "s#TARO_LIB#${TARO_LIB}#g" -e "s#UXN_EMU#${UXN_EMU}#g" taro.desktop > ~/.local/share/applications/taro.desktop

10
config
View file

@ -1,16 +1,16 @@
# where your maildir folders live # where your maildir folders live
MBOX_ROOT=${HOME}/lib/mail/zoho MBOX_ROOT=${HOME}/lib/mail/zoho
# where runtime files live (probably this git repo for simplicity) # where runtime files live
TARO_LIB=${PWD} TARO_LIB=${HOME}/lib/taro
# where attachments are saved to # where attachments are saved to
TARO_DOWNLOADS=${HOME}/tmp TARO_DOWNLOADS=${HOME}/tmp
# name of your uxnemu executable; it must be in PATH; i copy mine to "taro" so it gets the _NET_WM_CLASS=taro - there may be a better way to do this in the future # uxnemu will be copied to TARO_LIB/UXN_EMU to give it the right _NET_WM_CLASS
UXN_EMU=taro UXN_EMU=taro
# any custom env you want to set for reader/compose wins # any custom env you want to set for reader/compose wins
TARO_ENV="PINENTRY_USER_DATA=taro" TARO_ENV="PINENTRY_USER_DATA=taro"
# reader and compose progs - I use st, you may use your own terminal although the command line options may differ so read the manual # reader and compose progs - I use st, you may use your own terminal although the command line options may differ so read the manual
READER_PROG="${TARO_ENV} TARO_DOWNLOADS=${TARO_DOWNLOADS} LESSKEYIN=${TARO_LIB}/lesskey st -c taro -n taro -t taro-reader -e ${TARO_LIB}/taro-reader" READER_PROG="${TARO_ENV} TARO_DOWNLOADS=\\\"${TARO_DOWNLOADS}\\\" LESSKEYIN=\\\"${TARO_LIB}/lesskey\\\" st -c ${UXN_EMU} -n ${UXN_EMU} -t taro-reader -e \\\"${TARO_LIB}/taro-reader\\\""
COMPOSE_PROG="${TARO_ENV} st -c taro -n taro -t taro-compose -e mcom" COMPOSE_PROG="${TARO_ENV} st -c ${UXN_EMU} -n ${UXN_EMU} -t taro-compose -e mcom"

View file

@ -81,14 +81,11 @@ module Taro
@stdin_r, @stdin_w = IO.pipe @stdin_r, @stdin_w = IO.pipe
@lifetime = Channel(UInt8).new @lifetime = Channel(UInt8).new
uxnrom : String = ""
uxnargs = ["-s", "1", "#{TARO_LIB}/#{uxnrom}.rom"]
case w case w
when WinType::LIST then when WinType::LIST then
spawn do spawn do
Process.run( Process.run(
command: UXN_EMU, command: "#{TARO_LIB}/#{UXN_EMU}",
args: [ "-s", "1", "taro-ls" ], args: [ "-s", "1", "taro-ls" ],
chdir: TARO_LIB, chdir: TARO_LIB,
input: @stdin_r, input: @stdin_r,

View file

@ -438,6 +438,8 @@ JMP2r
&back &back
STHk LB_SELECT_IDX LDZ2 #0000 NEQ2 ,&can_go_back JCN STHk LB_SELECT_IDX LDZ2 #0000 NEQ2 ,&can_go_back JCN
STHkr LB_LEN LDZ2 #0001 SUB2 STHkr LB_SELECT_IDX STZ2 STHkr LB_LEN LDZ2 #0001 SUB2 STHkr LB_SELECT_IDX STZ2
( if number of entries is less than height, don't scroll to bottom )
STHkr LB_LEN LDZ2 #0001 SUB2 #00 STHkr LB_HEIGHT LDZ LTH2 ,&end JCN
STHkr LB_LEN LDZ2 #00 STHkr LB_HEIGHT LDZ SUB2 STHkr LB_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