tAlignment in news is now according to the URIs. - rohrpost - A commandline mail client to change the world as we see it.
(HTM) git clone git://r-36.net/rohrpost
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 980ce8e2a6edf338eadb4cd3d3d26427853b2385
(DIR) parent a7298da94f108fb84172b99f66631b92139aee8a
(HTM) Author: Christoph Lohmann <20h@r-36.net>
Date: Wed, 26 Nov 2014 19:43:49 +0100
Alignment in news is now according to the URIs.
Diffstat:
tmpl/news.sh | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
---
(DIR) diff --git a/tmpl/news.sh b/tmpl/news.sh
t@@ -6,10 +6,6 @@ idformat="$(tput bold)"
dateformat="$(tput setaf 3)"
subjectformat="$reset"
-flen=22
-cols=$(tput cols)
-scols=$(($cols - $flen))
-
first=1
cfgname="$(rpcfg -n)"
t@@ -22,6 +18,8 @@ fi
mailboxname="$(rpsel)"
baseuri="rpo:/${cfgname}/${mailboxname}/"
+cols=$(tput cols)
+
while read -r line;
do
id=$(echo -n "$line" | cut -f 1 | head -c 8)
t@@ -34,8 +32,13 @@ do
# "$subject"
first=0
else
- printf "${idformat}%8s${reset} " "${baseuri}$id"
- printf "${dateformat}%10s${reset} " "$date"
+ ostr="$(printf "${dateformat}%10s${reset}" "$date")"
+ flen=$(($(utf8expr length "$date") + 2))
+ ostr="${ostr} $(printf "${idformat}%s${reset}" "${baseuri}$id")"
+ flen=$(($flen + $(utf8expr length "${baseuri}$id") + 2))
+ scols=$(($cols - $flen))
+
+ printf "%s " "${ostr}"
slen=$(utf8expr length "$subject")
if [ $scols -lt 1 ] || [ $scols -gt $slen ];
then