This patch unifies look of eend used in bash & python code, additionally fixing few inconsistences in bash code. What I've changed is: 1. Removed additional (useless?) space in RC_ENDCOL eend which were overwriting last char of RC_DOT_PATTERN (and adjusted ENDCOL width respectively). 2. Fixed the COLS declaration in unset_colors() to not include screen height as it is set and used that way everywhere else. 3. Moved the 'global' COLS decrease directly into ENDCOL declaration as it was probably useful only for that and broke both non-RC_ENDCOL eend and RC_DOT_PATTERN. 4. Make the COLS-- unconditional as it is useful for curses too (and that couldn't be determined through ${TERM}), it looks better and it certainly won't hurt on other consoles. 5. Adjusted the Python output width to match (visually) the bash one. Not sure about the source of that inconsistence though. I'll investigate that further in a while. 20.03.2010 by Michał Górny diff -dupr portage.orig//bin/isolated-functions.sh portage/bin/isolated-functions.sh --- portage.orig//bin/isolated-functions.sh 2010-03-20 09:35:02.000000000 +0100 +++ portage/bin/isolated-functions.sh 2010-03-20 10:31:16.000000000 +0100 @@ -326,7 +326,7 @@ _eend() { fi if [[ ${RC_ENDCOL} == "yes" ]] ; then - echo -e "${ENDCOL} ${msg}" + echo -e "${ENDCOL} ${msg}" else [[ ${LAST_E_CMD} == ebegin ]] || LAST_E_LEN=0 printf "%$(( COLS - LAST_E_LEN - 6 ))s%b\n" '' "${msg}" @@ -397,7 +397,7 @@ get_KV() { } unset_colors() { - COLS="25 80" + COLS=80 ENDCOL= GOOD= @@ -412,13 +412,13 @@ set_colors() { COLS=${COLUMNS:-0} # bash's internal COLUMNS variable (( 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 || $TERM = dumb ]] && ((COLS--)) + # Adjust COLS so that eend works properly on a standard BSD console + # or in a curses window. + ((COLS--)) # Now, ${ENDCOL} will move us to the end of the # column; irregardless of character width - ENDCOL=$'\e[A\e['$(( COLS - 1 ))'C' + ENDCOL=$'\e[A\e['$(( COLS - 7 ))'C' if [ -n "${PORTAGE_COLORMAP}" ] ; then eval ${PORTAGE_COLORMAP} else diff -dupr portage.orig//pym/portage/output.py portage/pym/portage/output.py --- portage.orig//pym/portage/output.py 2010-03-20 09:35:05.000000000 +0100 +++ portage/pym/portage/output.py 2010-03-20 10:14:52.000000000 +0100 @@ -487,9 +487,9 @@ class EOutput(object): lines, columns = get_term_size() if columns <= 0: columns = 80 - # Adjust columns so that eend works properly on a standard BSD console. - if os.environ.get("TERM") in ("cons25", "dumb"): - columns = columns - 1 + # Adjust columns so that eend works properly on a standard BSD console + # or in a curses window. + columns = columns - 1 self.term_columns = columns sys.stdout.flush() sys.stderr.flush() @@ -518,7 +518,7 @@ class EOutput(object): if not self.quiet: out = sys.stdout self._write(out, - "%*s%s\n" % ((self.term_columns - self.__last_e_len - 6), + "%*s%s\n" % ((self.term_columns - self.__last_e_len - 5), "", status_brackets)) def ebegin(self, msg):