##// END OF EJS Templates
Add color feedback for multiline entry.
Gael Varoquaux -
Show More
@@ -86,10 +86,12 b' class WxController(ConsoleWidget, PrefilterFrontEnd):'
86 86
87 87
88 88 # The buffer being edited.
89 # We are duplicating the defination here because of multiple
89 # We are duplicating the definition here because of multiple
90 90 # inheritence
91 91 def _set_input_buffer(self, string):
92 return ConsoleWidget._set_input_buffer(self, string)
92 ConsoleWidget._set_input_buffer(self, string)
93 wx.Yield()
94 self._colorize_input_buffer()
93 95
94 96 def _get_input_buffer(self):
95 97 """ Returns the text in current edit buffer.
@@ -276,9 +278,11 b' class WxController(ConsoleWidget, PrefilterFrontEnd):'
276 278 self.GotoPos(self.GetLength())
277 279 PrefilterFrontEnd.execute(self, python_string, raw_string=raw_string)
278 280
281 def save_output_hooks(self):
282 self.__old_raw_input = __builtin__.raw_input
283 PrefilterFrontEnd.save_output_hooks(self)
279 284
280 285 def capture_output(self):
281 self.__old_raw_input = __builtin__.raw_input
282 286 __builtin__.raw_input = self.raw_input
283 287 PrefilterFrontEnd.capture_output(self)
284 288
@@ -312,6 +316,8 b' class WxController(ConsoleWidget, PrefilterFrontEnd):'
312 316 """
313 317 self._input_state = 'readline'
314 318 ConsoleWidget.new_prompt(self, prompt)
319 i = self.current_prompt_line
320 self._markers[i] = self.MarkerAdd(i, _INPUT_MARKER)
315 321
316 322
317 323 def write(self, *args, **kwargs):
@@ -415,9 +421,8 b' class WxController(ConsoleWidget, PrefilterFrontEnd):'
415 421 """
416 422 if self.debug:
417 423 print >>sys.__stdout__, repr(self.input_buffer)
418 i = self.GetLineCount()
419 self._markers[i] = self.MarkerAdd(i, _INPUT_MARKER)
420 424 PrefilterFrontEnd._on_enter(self)
425 #self._colorize_input_buffer()
421 426
422 427
423 428 #--------------------------------------------------------------------------
@@ -443,6 +448,15 b' class WxController(ConsoleWidget, PrefilterFrontEnd):'
443 448 self.write(''.join(_out_buffer), refresh=False)
444 449 self._buffer_flush_timer.Stop()
445 450
451 def _colorize_input_buffer(self):
452 """ Keep the input buffer lines at a bright color.
453 """
454 end_line = self.GetCurrentLine() + 1
455 for i in range(self.current_prompt_line, end_line):
456 if i in self._markers:
457 self.MarkerDeleteHandle(self._markers[i])
458 self._markers[i] = self.MarkerAdd(i, _INPUT_MARKER)
459
446 460
447 461 if __name__ == '__main__':
448 462 class MainWindow(wx.Frame):
General Comments 0
You need to be logged in to leave comments. Login now