summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-10-25 05:57:32 +0000
committerZac Medico <zmedico@gentoo.org>2007-10-25 05:57:32 +0000
commitf14272944803045cc18cf67342984010672e28a1 (patch)
tree5d58d5be7cf73d77bbcaab3883e86546beb60707
parentaa6e0cdf098ae7930daa2b3bc7bad80d0574d377 (diff)
downloadportage-f14272944803045cc18cf67342984010672e28a1.tar.gz
portage-f14272944803045cc18cf67342984010672e28a1.tar.bz2
portage-f14272944803045cc18cf67342984010672e28a1.zip
If the title string is too big then xtermTitle() can
misbehave by causing the terminal to echo some of the characters and generate a "beep" sound. This is easily triggered by doing things like `emerge world` now since all the the atoms are expanded. svn path=/main/trunk/; revision=8289
-rw-r--r--pym/portage/output.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/pym/portage/output.py b/pym/portage/output.py
index f4e90fb8e..ff3e27171 100644
--- a/pym/portage/output.py
+++ b/pym/portage/output.py
@@ -236,6 +236,11 @@ def nc_len(mystr):
def xtermTitle(mystr, raw=False):
if dotitles and "TERM" in os.environ and sys.stderr.isatty():
+ # If the title string is too big then the terminal can
+ # misbehave. Therefore, truncate it if it's too big.
+ max_len = 253
+ if len(mystr) > max_len:
+ mystr = mystr[:max_len]
myt=os.environ["TERM"]
legal_terms = ["xterm","Eterm","aterm","rxvt","screen","kterm","rxvt-unicode","gnome"]
for term in legal_terms: