From 6e8e4e01ed646b0c7ef9309577a28c6a44a7c4dd Mon Sep 17 00:00:00 2001 From: Dominik Honnef Date: Mon, 7 Jun 2021 22:02:31 +0200 Subject: mless: list same number of mails whether we're at the beginning or end --- mless | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 -- cgit 1.4.1