summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-10-21 07:52:52 +0000
committerZac Medico <zmedico@gentoo.org>2006-10-21 07:52:52 +0000
commit21c322f2efb9d9b2fb35658b8c369c15f06a03f1 (patch)
tree4ebd77b6b4e5ded4ead88fde8fc4963cf195ba3e
parent9c2a491aca429157b0e592d08e6de74f37d416ad (diff)
downloadportage-21c322f2efb9d9b2fb35658b8c369c15f06a03f1.tar.gz
portage-21c322f2efb9d9b2fb35658b8c369c15f06a03f1.tar.bz2
portage-21c322f2efb9d9b2fb35658b8c369c15f06a03f1.zip
For bug #152157, don't send a redundant escape sequence with ${PROMPT_COMMAND}.
svn path=/main/trunk/; revision=4782
-rw-r--r--pym/output.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/pym/output.py b/pym/output.py
index ff40325b0..4ff7ce5f7 100644
--- a/pym/output.py
+++ b/pym/output.py
@@ -173,13 +173,15 @@ def nc_len(mystr):
tmp = re.sub(esc_seq + "^m]+m", "", mystr);
return len(tmp)
-def xtermTitle(mystr):
+def xtermTitle(mystr, raw=False):
if havecolor and dotitles and os.environ.has_key("TERM") and sys.stderr.isatty():
myt=os.environ["TERM"]
legal_terms = ["xterm","Eterm","aterm","rxvt","screen","kterm","rxvt-unicode","gnome"]
for term in legal_terms:
if myt.startswith(term):
- sys.stderr.write("\x1b]0;"+str(mystr)+"\x07")
+ if not raw:
+ mystr = "\x1b]0;%s\x07" % mystr
+ sys.stderr.write(mystr)
sys.stderr.flush()
break
@@ -198,9 +200,9 @@ def xtermTitleReset():
home = os.getenv('HOME', '')
if home != '' and pwd.startswith(home):
pwd = '~' + pwd[len(home):]
- default_xterm_title = '%s@%s:%s' % (
+ default_xterm_title = '\x1b]0;%s@%s:%s\x07' % (
os.getenv('LOGNAME', ''), os.getenv('HOSTNAME', '').split('.', 1)[0], pwd)
- xtermTitle(default_xterm_title)
+ xtermTitle(default_xterm_title, raw=True)
def notitles():
"turn off title setting"