aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--libs/output.bash.in10
2 files changed, 11 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 75f65db..ffa0097 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-05-06 Ulrich Mueller <ulm@gentoo.org>
+
+ * libs/output.bash.in (write_kv_list_entry): Call get_column_width
+ only if stdout is a tty.
+ (get_column_width): Revert change of 2009-04-15; we can't test for
+ stdout being a tty when called via command substitution.
+
2009-04-18 Ulrich Mueller <ulm@gentoo.org>
+ Release: 1.0.12
diff --git a/libs/output.bash.in b/libs/output.bash.in
index 628acf5..63f308c 100644
--- a/libs/output.bash.in
+++ b/libs/output.bash.in
@@ -115,8 +115,9 @@ write_kv_list_entry() {
echo -n -e "${right}"
fi
- local cols=$(get_column_width) \
+ local cols=${COLS:-80} \
cwords="$(apply_text_highlights "${right}" "${val}")"
+ [[ -t 1 ]] && cols=$(get_column_width)
text=${val//\%%%??%%%/}
# only loop if it doesn't fit on the same line
@@ -190,11 +191,8 @@ write_numbered_list() {
# Get current column width
get_column_width() {
if [[ -z "${COLS}" ]] ; then
- COLS=79
- if [[ -t 1 ]] ; then
- COLS=( $(stty size 2>/dev/null) )
- is_number "${COLS[1]}" && COLS=${COLS[1]} || COLS=79
- fi
+ COLS=( $(stty size 2>/dev/null) )
+ is_number "${COLS[1]}" && COLS=${COLS[1]} || COLS=79
fi
echo -n ${COLS}