Fix eend so that it works properly on a standard BSD console. Thanks to UberLord.
authorZac Medico <zmedico@gentoo.org>
Wed, 2 May 2007 17:23:13 +0000 (17:23 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 2 May 2007 17:23:13 +0000 (17:23 -0000)
svn path=/main/trunk/; revision=6467

bin/isolated-functions.sh
pym/portage/output.py

index 41595ea30ab203486e4b80c93c854f49fcab271e..e6517af74d3b97a558b833f89e0d1ba46b2283db 100755 (executable)
@@ -279,6 +279,8 @@ set_colors() {
        (( COLS == 0 )) && COLS=$(set -- $(stty size 2>/dev/null) ; echo $2)
        (( COLS > 0 )) || (( COLS = 80 ))
        COLS=$((${COLS} - 8))   # width of [ ok ] == 7
+       # Adjust COLS so that eend works properly on a standard BSD console.
+       [ "${TERM}" = "cons25" ] && COLS=$((${COLS} - 1))
 
        ENDCOL=$'\e[A\e['${COLS}'C'    # Now, ${ENDCOL} will move us to the end of the
                                       # column;  irregardless of character width
index bbac9d97dc36e4e0970d7565702a5b99681ae3ae..75e9aad42db93932b0810aad239e169f1c529784 100644 (file)
@@ -277,6 +277,9 @@ class EOutput:
                                pass
                if columns <= 0:
                        columns = 80
+               # Adjust columns so that eend works properly on a standard BSD console.
+               if os.environ.get("TERM") == "cons25":
+                       columns = columns - 1
                self.term_columns = columns
 
        def __eend(self, caller, errno, msg):