##// END OF EJS Templates
Capture Xterm title sequence.
Gael Varoquaux -
Show More
@@ -73,6 +73,8 b' class ConsoleWidget(editwindow.EditWindow):'
73 keeping the cursor inside the editing line.
73 keeping the cursor inside the editing line.
74 """
74 """
75
75
76 title = 'Console'
77
76 style = _DEFAULT_STYLE.copy()
78 style = _DEFAULT_STYLE.copy()
77
79
78 # Translation table from ANSI escape sequences to color. Override
80 # Translation table from ANSI escape sequences to color. Override
@@ -159,7 +161,9 b' class ConsoleWidget(editwindow.EditWindow):'
159
161
160 self._apply_style()
162 self._apply_style()
161
163
164 # Xterm escape sequences
162 self.color_pat = re.compile('\x01?\x1b\[(.*?)m\x02?')
165 self.color_pat = re.compile('\x01?\x1b\[(.*?)m\x02?')
166 self.title_pat = re.compile('\x1b]0;(.*?)\x07')
163
167
164 #self.SetEdgeMode(stc.STC_EDGE_LINE)
168 #self.SetEdgeMode(stc.STC_EDGE_LINE)
165 #self.SetEdgeColumn(80)
169 #self.SetEdgeColumn(80)
@@ -191,6 +195,11 b' class ConsoleWidget(editwindow.EditWindow):'
191 """ Write given text to buffer, while translating the ansi escape
195 """ Write given text to buffer, while translating the ansi escape
192 sequences.
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 segments = self.color_pat.split(text)
203 segments = self.color_pat.split(text)
195 segment = segments.pop(0)
204 segment = segments.pop(0)
196 self.StartStyling(self.GetLength(), 0xFF)
205 self.StartStyling(self.GetLength(), 0xFF)
General Comments 0
You need to be logged in to leave comments. Login now