Show More
@@ -402,16 +402,21 b' class ConsoleWidget(QtGui.QPlainTextEdit):' | |||||
402 | def _set_input_buffer(self, string): |
|
402 | def _set_input_buffer(self, string): | |
403 | """ Replaces the text in the input buffer with 'string'. |
|
403 | """ Replaces the text in the input buffer with 'string'. | |
404 | """ |
|
404 | """ | |
405 | # Add continuation prompts where necessary. |
|
405 | # Remove old text. | |
406 | lines = string.splitlines() |
|
|||
407 | for i in xrange(1, len(lines)): |
|
|||
408 | lines[i] = self._continuation_prompt + lines[i] |
|
|||
409 | string = '\n'.join(lines) |
|
|||
410 |
|
||||
411 | # Replace buffer with new text. |
|
|||
412 | cursor = self._get_end_cursor() |
|
406 | cursor = self._get_end_cursor() | |
413 | cursor.setPosition(self._prompt_pos, QtGui.QTextCursor.KeepAnchor) |
|
407 | cursor.setPosition(self._prompt_pos, QtGui.QTextCursor.KeepAnchor) | |
414 |
cursor. |
|
408 | cursor.removeSelectedText() | |
|
409 | ||||
|
410 | # Insert new text with continuation prompts. | |||
|
411 | lines = string.splitlines(True) | |||
|
412 | if lines: | |||
|
413 | self.appendPlainText(lines[0]) | |||
|
414 | for i in xrange(1, len(lines)): | |||
|
415 | if self._continuation_prompt_html is None: | |||
|
416 | self.appendPlainText(self._continuation_prompt) | |||
|
417 | else: | |||
|
418 | self.appendHtml(self._continuation_prompt_html) | |||
|
419 | self.appendPlainText(lines[i]) | |||
415 | self.moveCursor(QtGui.QTextCursor.End) |
|
420 | self.moveCursor(QtGui.QTextCursor.End) | |
416 |
|
421 | |||
417 | input_buffer = property(_get_input_buffer, _set_input_buffer) |
|
422 | input_buffer = property(_get_input_buffer, _set_input_buffer) |
General Comments 0
You need to be logged in to leave comments.
Login now