From 21c322f2efb9d9b2fb35658b8c369c15f06a03f1 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 21 Oct 2006 07:52:52 +0000 Subject: [PATCH] For bug #152157, don't send a redundant escape sequence with ${PROMPT_COMMAND}. svn path=/main/trunk/; revision=4782 --- pym/output.py | 10 ++++++---- 1 file 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" -- 2.26.2