[pacman-dev] [PATCH] table_display: only check width when non-zero

Andrew Gregory andrew.gregory.8 at gmail.com
Thu Sep 18 02:19:46 EDT 2014


A width of 0 indicates that either pacman is not attached
to a tty or the user does not want line wrapping.  Either
way pacman should not fall back to the basic display.

Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
 src/pacman/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pacman/util.c b/src/pacman/util.c
index e91d654..e1880ec 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -640,7 +640,7 @@ static int table_display(const alpm_list_t *header,
 	totalwidth = table_calc_widths(first, rows, padding, totalcols,
 			&widths, &has_data);
 	/* return -1 if terminal is not wide enough */
-	if(totalwidth > cols) {
+	if(cols && totalwidth > cols) {
 		pm_printf(ALPM_LOG_WARNING,
 				_("insufficient columns available for table display\n"));
 		ret = -1;
-- 
2.1.0


More information about the pacman-dev mailing list