##// END OF EJS Templates
Fixed more issues with ConsoleWidget scrollbar management.
epatters -
Show More
@@ -471,7 +471,10 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
471 """ Moves the prompt to the top of the viewport.
471 """ Moves the prompt to the top of the viewport.
472 """
472 """
473 if not self._executing:
473 if not self._executing:
474 self._set_top_cursor(self._get_prompt_cursor())
474 prompt_cursor = self._get_prompt_cursor()
475 if self._get_cursor().blockNumber() < prompt_cursor.blockNumber():
476 self._set_cursor(prompt_cursor)
477 self._set_top_cursor(prompt_cursor)
475
478
476 def redo(self):
479 def redo(self):
477 """ Redo the last operation. If there is no operation to redo, nothing
480 """ Redo the last operation. If there is no operation to redo, nothing
@@ -1370,7 +1373,8 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
1370 self.input_buffer = ''
1373 self.input_buffer = ''
1371
1374
1372 def _page(self, text, html=False):
1375 def _page(self, text, html=False):
1373 """ Displays text using the pager if it exceeds the height of the viewport.
1376 """ Displays text using the pager if it exceeds the height of the
1377 viewport.
1374
1378
1375 Parameters:
1379 Parameters:
1376 -----------
1380 -----------
@@ -1379,7 +1383,8 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
1379 """
1383 """
1380 line_height = QtGui.QFontMetrics(self.font).height()
1384 line_height = QtGui.QFontMetrics(self.font).height()
1381 minlines = self._control.viewport().height() / line_height
1385 minlines = self._control.viewport().height() / line_height
1382 if self.paging != 'none' and re.match("(?:[^\n]*\n){%i}" % minlines, text):
1386 if self.paging != 'none' and \
1387 re.match("(?:[^\n]*\n){%i}" % minlines, text):
1383 if self.paging == 'custom':
1388 if self.paging == 'custom':
1384 self.custom_page_requested.emit(text)
1389 self.custom_page_requested.emit(text)
1385 else:
1390 else:
@@ -1568,7 +1573,7 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
1568 scrollbar.setPageStep(step)
1573 scrollbar.setPageStep(step)
1569 # Compensate for undesirable scrolling that occurs automatically due to
1574 # Compensate for undesirable scrolling that occurs automatically due to
1570 # maximumBlockCount() text truncation.
1575 # maximumBlockCount() text truncation.
1571 if diff < 0:
1576 if diff < 0 and document.blockCount() == document.maximumBlockCount():
1572 scrollbar.setValue(scrollbar.value() + diff)
1577 scrollbar.setValue(scrollbar.value() + diff)
1573
1578
1574 def _cursor_position_changed(self):
1579 def _cursor_position_changed(self):
General Comments 0
You need to be logged in to leave comments. Login now