ref: refs/heads/master
commit 5987d7b23fcefb52e21f4907b27c375d116f5ef1
Author: Michael Andres
Date: Mon Nov 2 18:40:37 2009 +0100
Prevent clipping lines when output is redirected. (bnc #551744)
---
src/utils/misc.cc | 2 +-
src/utils/misc.h | 2 ++
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/utils/misc.cc b/src/utils/misc.cc
index 32c881b..d0f278c 100644
--- a/src/utils/misc.cc
+++ b/src/utils/misc.cc
@@ -65,7 +65,7 @@ string readline_getline()
unsigned get_screen_width()
{
if (!::isatty(STDOUT_FILENO))
- return 80;
+ return -1; // no clipping
int width = 80;
diff --git a/src/utils/misc.h b/src/utils/misc.h
index a94c4c4..4291b8c 100644
--- a/src/utils/misc.h
+++ b/src/utils/misc.h
@@ -37,6 +37,8 @@ std::string readline_getline();
/**
* Reads COLUMNS environment variable or gets the screen width from readline,
* in that order. Falls back to 80 if all that fails.
+ * \NOTE In case stdout is not connected to a terminal max. unsigned
+ * is returned. This should prevent clipping when output is redirected.
*/
unsigned get_screen_width();
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org