##// END OF EJS Templates
Fixed scrolling bugs when using rich text mode. (Work around probable bug in Qt.)
epatters -
Show More
@@ -340,9 +340,13 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
340 cursor.beginEditBlock()
340 cursor.beginEditBlock()
341 cursor.insertText('\n')
341 cursor.insertText('\n')
342 self._insert_continuation_prompt(cursor)
342 self._insert_continuation_prompt(cursor)
343 self._control.moveCursor(QtGui.QTextCursor.End)
344 cursor.endEditBlock()
343 cursor.endEditBlock()
345
344
345 # Do not do this inside the edit block. It works as expected
346 # when using a QPlainTextEdit control, but does not have an
347 # effect when using a QTextEdit. I believe this is a Qt bug.
348 self._control.moveCursor(QtGui.QTextCursor.End)
349
346 return complete
350 return complete
347
351
348 def _get_input_buffer(self):
352 def _get_input_buffer(self):
@@ -714,19 +718,19 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
714 if cursor.selectedText().trimmed().isEmpty():
718 if cursor.selectedText().trimmed().isEmpty():
715 self.execute(interactive=True)
719 self.execute(interactive=True)
716 else:
720 else:
721 # Do this inside an edit block for clean undo/redo.
717 cursor.beginEditBlock()
722 cursor.beginEditBlock()
718 cursor.setPosition(position)
723 cursor.setPosition(position)
719 cursor.insertText('\n')
724 cursor.insertText('\n')
720 self._insert_continuation_prompt(cursor)
725 self._insert_continuation_prompt(cursor)
721
726 cursor.endEditBlock()
727
722 # Ensure that the whole input buffer is visible.
728 # Ensure that the whole input buffer is visible.
723 # FIXME: This will not be usable if the input buffer
729 # FIXME: This will not be usable if the input buffer
724 # is taller than the console widget.
730 # is taller than the console widget.
725 self._control.moveCursor(QtGui.QTextCursor.End)
731 self._control.moveCursor(QtGui.QTextCursor.End)
726 self._control.setTextCursor(cursor)
732 self._control.setTextCursor(cursor)
727
733
728 cursor.endEditBlock()
729
730 elif key == QtCore.Qt.Key_Up:
734 elif key == QtCore.Qt.Key_Up:
731 if self._reading or not self._up_pressed():
735 if self._reading or not self._up_pressed():
732 intercepted = True
736 intercepted = True
@@ -176,7 +176,7 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):'
176 if self._control_key_down(event.modifiers()):
176 if self._control_key_down(event.modifiers()):
177 if key == QtCore.Qt.Key_C and self._executing:
177 if key == QtCore.Qt.Key_C and self._executing:
178 self.interrupt_kernel()
178 self.interrupt_kernel()
179 return True_
179 return True
180 elif key == QtCore.Qt.Key_Period:
180 elif key == QtCore.Qt.Key_Period:
181 message = 'Are you sure you want to restart the kernel?'
181 message = 'Are you sure you want to restart the kernel?'
182 self.restart_kernel(message)
182 self.restart_kernel(message)
General Comments 0
You need to be logged in to leave comments. Login now