Show More
@@ -62,15 +62,27 b' def _restore_term_title():' | |||
|
62 | 62 | pass |
|
63 | 63 | |
|
64 | 64 | |
|
65 | _xterm_term_title_saved = False | |
|
66 | ||
|
67 | ||
|
65 | 68 | def _set_term_title_xterm(title): |
|
66 | 69 | """ Change virtual terminal title in xterm-workalikes """ |
|
67 | # save the current title to the xterm "stack" | |
|
68 | sys.stdout.write('\033[22;0t') | |
|
70 | global _xterm_term_title_saved | |
|
71 | # Only save the title the first time we set, otherwise restore will only | |
|
72 | # go back one title (probably undoing a %cd title change). | |
|
73 | if not _xterm_term_title_saved: | |
|
74 | # save the current title to the xterm "stack" | |
|
75 | sys.stdout.write('\033[22;0t') | |
|
76 | _xterm_term_title_saved = True | |
|
69 | 77 | sys.stdout.write('\033]0;%s\007' % title) |
|
70 | 78 | |
|
71 | 79 | |
|
72 | 80 | def _restore_term_title_xterm(): |
|
81 | # Make sure the restore has at least one accompanying set. | |
|
82 | global _xterm_term_title_saved | |
|
83 | assert _xterm_term_title_saved | |
|
73 | 84 | sys.stdout.write('\033[23;0t') |
|
85 | _xterm_term_title_saved = False | |
|
74 | 86 | |
|
75 | 87 | |
|
76 | 88 | if os.name == 'posix': |
General Comments 0
You need to be logged in to leave comments.
Login now