aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Honnef <dominik@honnef.co>2021-06-07 22:02:31 +0200
committerLeah Neukirchen <leah@vuxu.org>2021-06-07 22:10:29 +0200
commit6e8e4e01ed646b0c7ef9309577a28c6a44a7c4dd (patch)
tree9caa2966ea5b42b4100edebeeadbcac0931b2a97
parent6684f74f0719be15fad22df73723380b91c3b71e (diff)
downloadmblaze-6e8e4e01ed646b0c7ef9309577a28c6a44a7c4dd.tar.gz
mblaze-6e8e4e01ed646b0c7ef9309577a28c6a44a7c4dd.tar.xz
mblaze-6e8e4e01ed646b0c7ef9309577a28c6a44a7c4dd.zip
mless: list same number of mails whether we're at the beginning or end
-rwxr-xr-xmless11
1 files changed, 10 insertions, 1 deletions
diff --git a/mless b/mless
index b859a15..08ce513 100755
--- a/mless
+++ b/mless
@@ -22,7 +22,16 @@ if [ "$1" = --filter ]; then
fi
mseq -C "$2"
- mscan .-2:.+3 2>/dev/null | colorscan
+
+ total=$(mscan -n -- -1)
+ case $2 in
+ 1) mscan .-0:.+5 ;;
+ 2) mscan .-1:.+4 ;;
+ $((total - 2))) mscan .-3:.+2 ;;
+ $((total - 1))) mscan .-4:.+1 ;;
+ $total) mscan .-5:.+0 ;;
+ *) mscan .-2:.+3 ;;
+ esac 2>/dev/null | colorscan
echo
if ! [ -f "$(mseq -r "$2")" ]; then