##// END OF EJS Templates
Capture Xterm title sequence.
Gael Varoquaux -
Show More
@@ -73,6 +73,8 b' class ConsoleWidget(editwindow.EditWindow):'
73 73 keeping the cursor inside the editing line.
74 74 """
75 75
76 title = 'Console'
77
76 78 style = _DEFAULT_STYLE.copy()
77 79
78 80 # Translation table from ANSI escape sequences to color. Override
@@ -158,8 +160,10 b' class ConsoleWidget(editwindow.EditWindow):'
158 160 self.SetMarginWidth(2, 0)
159 161
160 162 self._apply_style()
161
163
164 # Xterm escape sequences
162 165 self.color_pat = re.compile('\x01?\x1b\[(.*?)m\x02?')
166 self.title_pat = re.compile('\x1b]0;(.*?)\x07')
163 167
164 168 #self.SetEdgeMode(stc.STC_EDGE_LINE)
165 169 #self.SetEdgeColumn(80)
@@ -191,11 +195,16 b' class ConsoleWidget(editwindow.EditWindow):'
191 195 """ Write given text to buffer, while translating the ansi escape
192 196 sequences.
193 197 """
198 title = self.title_pat.split(text)
199 if len(title)>0:
200 self.title = title[-1]
201
202 text = self.title_pat.sub('', text)
194 203 segments = self.color_pat.split(text)
195 204 segment = segments.pop(0)
196 205 self.StartStyling(self.GetLength(), 0xFF)
197 206 self.AppendText(segment)
198
207
199 208 if segments:
200 209 ansi_tags = self.color_pat.findall(text)
201 210
General Comments 0
You need to be logged in to leave comments. Login now