hbbs

bbs.hlirc.net
Log | Files | Refs | README | LICENSE

commit 7eb5a036e6242fc093d3e2b3aa6a3d11a4fa671e
parent 21d7b83ce62aa8272dece7001412d2f08c7a257c
Author: hhvn <hayden@haydenvh.com>
Date:   Tue,  2 Feb 2021 14:27:23 +0000

config.sh bin/interface.sh hbbs.sh: fix pager

Diffstat:
Mbin/interface.sh | 7+++----
Mconfig.sh | 2++
Mhbbs.sh | 4++--
3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/bin/interface.sh b/bin/interface.sh @@ -18,9 +18,8 @@ parse_in(){ } pager(){ - rows=$(echo "$(tput lines) - ${1:-0} - ${2:-0}" | bc) - remove=$(echo "$rows * $page" | bc) - head -n -$remove | head -n $rows + rows=$(echo "$term_height - 4" | bc) + head -n $(($rows*($page+1))) | tail -n +$((($rows*$page)+1)) } menu_boards(){ @@ -146,7 +145,7 @@ menu_list(){ pager2(){ lfile=$(cat) len=$(echo "$lfile" | wc -l) - [ $(($len-1)) -gt $(tput cols) ] && echo "$lfile" | less \ + [ $(($len-1)) -gt $term_height ] && echo "$lfile" | less \ -k$cwd/etc/less \ -Ps"${s}Re${k}t${s}urn pager(less)-${k}h${s}elp" \ -Pm"${s}Re${k}t${s}urn pager(less)-${k}h${s}elp" \ diff --git a/config.sh b/config.sh @@ -25,6 +25,8 @@ board_admin_post_whitelist="hhvn" bbs_addr="bbs.hlirc.net" email_addr="bbs@hlirc.net" term="xterm-256color" +term_height=34 +term_width=80 datadir="/var/bbs" error_colour=88 info__colour=239 diff --git a/hbbs.sh b/hbbs.sh @@ -14,8 +14,8 @@ mkdir -p $datadir/profile $datadir/boards $datadir/users $(for b in $(echo "$boa info "Setting terminal to $term" export TERM="$term" -info "Your terminal is $(tput lines) tall" -info "Your terminal is $(tput cols) wide" +info "Your terminal must be $term_height tall" +info "Your terminal must be $term_width wide" info "Welcome to hbbs version $(cat $cwd/.version)" anykey sleep 0.1