def test_escape_windows_title_string(): cases = [('', ''), ('foo', 'foo'), ('foo&bar', 'foo^&bar'), ('foo$?-/_"\\', 'foo$?-/_"\\'), ('^&<>|', '^^^&^<^>^|'), ('this /?', 'this /.')] for st, esc in cases: obs = escape_windows_title_string(st) yield assert_equal, esc, obs
def test_escape_windows_title_string(): cases = [ ('', ''), ('foo', 'foo'), ('foo&bar', 'foo^&bar'), ('foo$?-/_"\\', 'foo$?-/_"\\'), ('^&<>|', '^^^&^<^>^|'), ('this /?', 'this /.') ] for st, esc in cases: obs = escape_windows_title_string(st) yield assert_equal, esc, obs
def settitle(self): """Sets terminal title.""" env = builtins.__xonsh_env__ term = env.get('TERM', None) if term is None or term == 'linux': return t = 'gitsome' if ON_WINDOWS and 'ANSICON' not in env: t = escape_windows_title_string(t) os.system('title {}'.format(t)) else: sys.stdout.write("\x1b]2;{0}\x07".format(t))
def settitle(self): """Sets terminal title.""" env = builtins.__xonsh_env__ term = env.get('TERM', None) # Shells running in emacs sets TERM to "dumb" or "eterm-color". # Do not set title for these to avoid garbled prompt. if term is None or term in ['dumb', 'eterm-color', 'linux']: return t = env.get('TITLE') if t is None: return t = format_prompt(t) if ON_WINDOWS and 'ANSICON' not in env: t = escape_windows_title_string(t) os.system('title {}'.format(t)) else: sys.stdout.write("\x1b]2;{0}\x07".format(t))