From 38db3c5fe89c2bad97a0f10677a99d79c6509d2e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Mon, 24 Apr 2023 20:14:24 +0200 Subject: [PATCH] quicker discard of unpaged items --- list.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/list.sh b/list.sh index dd5c83d..8df5b6e 100755 --- a/list.sh +++ b/list.sh @@ -160,13 +160,15 @@ list_paginate() { printf '[div .itemlist ' while :; do - c=$((c + 1)) - if [ $c -gt $page -a $c -le $end ]; then + if [ $c -lt $page ]; then + read -r discard || break + elif [ $c -ge $end ]; then + c=$((c + $(wc -l) )) + else read_meta || break list_item - else - read -r discard || break fi + c=$((c + 1)) done printf ']' -- 2.39.2