aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2013-11-15 00:56:22 +0100
committerUlrich Müller <ulm@gentoo.org>2013-11-15 09:01:31 +0100
commitba92c398946c8608aaf8b0884d7ed2a7d2905586 (patch)
tree7c0c9c21757bbf005517751d8a5ab3b7b8132e6a
parentNew local option --only-names in modules list action. (diff)
downloadeselect-ba92c398946c8608aaf8b0884d7ed2a7d2905586.tar.gz
eselect-ba92c398946c8608aaf8b0884d7ed2a7d2905586.tar.bz2
eselect-ba92c398946c8608aaf8b0884d7ed2a7d2905586.zip
More cosmetic changes in output.bash.
-rw-r--r--libs/output.bash.in13
1 files changed, 5 insertions, 8 deletions
diff --git a/libs/output.bash.in b/libs/output.bash.in
index 78e0c4f..5390792 100644
--- a/libs/output.bash.in
+++ b/libs/output.bash.in
@@ -90,6 +90,7 @@ write_kv_list_entry() {
local n text key val lindent rindent
local left=${COLOUR_LIST_LEFT} right=${COLOUR_LIST_RIGHT}
local normal=${COLOUR_NORMAL}
+ local cols=${COLUMNS:-80}
local IFS=$' \t\n'
if [[ $1 == "-p" ]]; then
@@ -117,19 +118,15 @@ write_kv_list_entry() {
n=$(( 28 + ${#rindent} ))
fi
- space ${n}
- echo -n -e "${right}"
+ echo -n -e "$(space ${n})${right}"
n=$(( 28 + ${#rindent} ))
- local cols=${COLUMNS:-80}
- local cwords=$(apply_text_highlights "${right}" "${val}")
-
text=${val//\%%%??%%%/}
# only loop if it doesn't fit on the same line
if [[ $(( ${n} + ${#text} )) -ge ${cols} ]]; then
local i=0 spc=""
rindent=$(space ${n})
- cwords=( ${cwords} )
+ local cwords=( $(apply_text_highlights "${right}" "${val}") )
for text in ${val}; do
text=${text//\%%%??%%%/}
# put the word on the same line if it fits
@@ -141,11 +138,11 @@ write_kv_list_entry() {
echo -n -e "\n${rindent}${cwords[i]}"
n=$(( ${#rindent} + ${#text} ))
fi
- i=$(( ${i} + 1 ))
+ (( i++ ))
spc=" "
done
else
- echo -n -e "${cwords}"
+ echo -n -e "$(apply_text_highlights "${right}" "${val}")"
fi
echo -e "${normal}"
}