Show More
@@ -1528,13 +1528,21 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||||
1528 | scrollbar = self._control.verticalScrollBar() |
|
1528 | scrollbar = self._control.verticalScrollBar() | |
1529 | viewport_height = self._control.viewport().height() |
|
1529 | viewport_height = self._control.viewport().height() | |
1530 | if isinstance(self._control, QtGui.QPlainTextEdit): |
|
1530 | if isinstance(self._control, QtGui.QPlainTextEdit): | |
1531 |
|
|
1531 | maximum = max(0, document.lineCount() - 1) | |
1532 | step = viewport_height / self._control.fontMetrics().lineSpacing() |
|
1532 | step = viewport_height / self._control.fontMetrics().lineSpacing() | |
1533 | else: |
|
1533 | else: | |
1534 | high = document.size().height() |
|
1534 | # QTextEdit does not do line-based layout and blocks will not in | |
|
1535 | # general have the same height. Therefore it does not make sense to | |||
|
1536 | # attempt to scroll in line height increments. | |||
|
1537 | maximum = document.size().height() | |||
1535 | step = viewport_height |
|
1538 | step = viewport_height | |
1536 | scrollbar.setRange(0, high) |
|
1539 | diff = maximum - scrollbar.maximum() | |
|
1540 | scrollbar.setRange(0, maximum) | |||
1537 | scrollbar.setPageStep(step) |
|
1541 | scrollbar.setPageStep(step) | |
|
1542 | # Compensate for undesirable scrolling that occurs automatically due to | |||
|
1543 | # maximumBlockCount() text truncation. | |||
|
1544 | if diff < 0: | |||
|
1545 | scrollbar.setValue(scrollbar.value() + diff) | |||
1538 |
|
1546 | |||
1539 | def _cursor_position_changed(self): |
|
1547 | def _cursor_position_changed(self): | |
1540 | """ Clears the temporary buffer based on the cursor position. |
|
1548 | """ Clears the temporary buffer based on the cursor position. |
General Comments 0
You need to be logged in to leave comments.
Login now