Show More
@@ -315,7 +315,7 b" class ConsoleWidget(MetaQObjectHasTraits('NewBase', (LoggingConfigurable, QtGui." | |||||
315 | self._pending_text_flush_interval.setInterval(100) |
|
315 | self._pending_text_flush_interval.setInterval(100) | |
316 | self._pending_text_flush_interval.setSingleShot(True) |
|
316 | self._pending_text_flush_interval.setSingleShot(True) | |
317 | self._pending_text_flush_interval.timeout.connect( |
|
317 | self._pending_text_flush_interval.timeout.connect( | |
318 | self._flush_pending_stream) |
|
318 | self._on_flush_pending_stream_timer) | |
319 |
|
319 | |||
320 | # Set a monospaced font. |
|
320 | # Set a monospaced font. | |
321 | self.reset_font() |
|
321 | self.reset_font() | |
@@ -1491,6 +1491,20 b" class ConsoleWidget(MetaQObjectHasTraits('NewBase', (LoggingConfigurable, QtGui." | |||||
1491 |
|
1491 | |||
1492 | return False |
|
1492 | return False | |
1493 |
|
1493 | |||
|
1494 | def _on_flush_pending_stream_timer(self): | |||
|
1495 | """ Flush the pending stream output and change the | |||
|
1496 | prompt position appropriately. | |||
|
1497 | """ | |||
|
1498 | cursor = self._control.textCursor() | |||
|
1499 | cursor.movePosition(QtGui.QTextCursor.End) | |||
|
1500 | pos = cursor.position() | |||
|
1501 | self._flush_pending_stream() | |||
|
1502 | cursor.movePosition(QtGui.QTextCursor.End) | |||
|
1503 | diff = cursor.position() - pos | |||
|
1504 | if diff > 0: | |||
|
1505 | self._prompt_pos += diff | |||
|
1506 | self._append_before_prompt_pos += diff | |||
|
1507 | ||||
1494 | def _flush_pending_stream(self): |
|
1508 | def _flush_pending_stream(self): | |
1495 | """ Flush out pending text into the widget. """ |
|
1509 | """ Flush out pending text into the widget. """ | |
1496 | text = self._pending_insert_text |
|
1510 | text = self._pending_insert_text | |
@@ -2044,6 +2058,7 b" class ConsoleWidget(MetaQObjectHasTraits('NewBase', (LoggingConfigurable, QtGui." | |||||
2044 | there is not already a newline at the end of the buffer. |
|
2058 | there is not already a newline at the end of the buffer. | |
2045 | """ |
|
2059 | """ | |
2046 | # Save the current end position to support _append*(before_prompt=True). |
|
2060 | # Save the current end position to support _append*(before_prompt=True). | |
|
2061 | self._flush_pending_stream() | |||
2047 | cursor = self._get_end_cursor() |
|
2062 | cursor = self._get_end_cursor() | |
2048 | self._append_before_prompt_pos = cursor.position() |
|
2063 | self._append_before_prompt_pos = cursor.position() | |
2049 |
|
2064 | |||
@@ -2053,6 +2068,7 b" class ConsoleWidget(MetaQObjectHasTraits('NewBase', (LoggingConfigurable, QtGui." | |||||
2053 | QtGui.QTextCursor.KeepAnchor) |
|
2068 | QtGui.QTextCursor.KeepAnchor) | |
2054 | if cursor.selection().toPlainText() != '\n': |
|
2069 | if cursor.selection().toPlainText() != '\n': | |
2055 | self._append_block() |
|
2070 | self._append_block() | |
|
2071 | self._append_before_prompt_pos += 1 | |||
2056 |
|
2072 | |||
2057 | # Write the prompt. |
|
2073 | # Write the prompt. | |
2058 | self._append_plain_text(self._prompt_sep) |
|
2074 | self._append_plain_text(self._prompt_sep) | |
@@ -2070,7 +2086,6 b" class ConsoleWidget(MetaQObjectHasTraits('NewBase', (LoggingConfigurable, QtGui." | |||||
2070 | self._prompt = prompt |
|
2086 | self._prompt = prompt | |
2071 | self._prompt_html = None |
|
2087 | self._prompt_html = None | |
2072 |
|
2088 | |||
2073 | self._flush_pending_stream() |
|
|||
2074 | self._prompt_pos = self._get_end_cursor().position() |
|
2089 | self._prompt_pos = self._get_end_cursor().position() | |
2075 | self._prompt_started() |
|
2090 | self._prompt_started() | |
2076 |
|
2091 |
General Comments 0
You need to be logged in to leave comments.
Login now