コード例 #1
0
ファイル: test_tools.py プロジェクト: gitter-badger/xonsh
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
コード例 #2
0
ファイル: test_tools.py プロジェクト: gforsyth/xonsh
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
コード例 #3
0
 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))
コード例 #4
0
ファイル: base_shell.py プロジェクト: ArRolin/gitsome
 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))
コード例 #5
0
 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))
コード例 #6
0
ファイル: base_shell.py プロジェクト: migueldvb/xonsh
 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))