##// END OF EJS Templates
The ConsoleWidget now only pages text if it exceeds the height of the visible window.
epatters -
Show More
@@ -1,4 +1,5 b''
1 1 # Standard library imports
2 import re
2 3 import sys
3 4 from textwrap import dedent
4 5
@@ -994,24 +995,31 b' class ConsoleWidget(QtGui.QWidget):'
994 995 return True
995 996
996 997 def _page(self, text):
997 """ Displays text using the pager.
998 """ Displays text using the pager if it exceeds the height of the
999 visible area.
998 1000 """
999 if self._page_style == 'custom':
1000 self.custom_page_requested.emit(text)
1001 elif self._page_style == 'none':
1001 if self._page_style == 'none':
1002 1002 self._append_plain_text(text)
1003 1003 else:
1004 self._page_control.clear()
1005 cursor = self._page_control.textCursor()
1006 self._insert_plain_text(cursor, text)
1007 self._page_control.moveCursor(QtGui.QTextCursor.Start)
1008
1009 self._page_control.viewport().resize(self._control.size())
1010 if self._splitter:
1011 self._page_control.show()
1012 self._page_control.setFocus()
1004 line_height = QtGui.QFontMetrics(self.font).height()
1005 minlines = self._control.viewport().height() / line_height
1006 if re.match("(?:[^\n]*\n){%i}" % minlines, text):
1007 if self._page_style == 'custom':
1008 self.custom_page_requested.emit(text)
1009 else:
1010 self._page_control.clear()
1011 cursor = self._page_control.textCursor()
1012 self._insert_plain_text(cursor, text)
1013 self._page_control.moveCursor(QtGui.QTextCursor.Start)
1014
1015 self._page_control.viewport().resize(self._control.size())
1016 if self._splitter:
1017 self._page_control.show()
1018 self._page_control.setFocus()
1019 else:
1020 self.layout().setCurrentWidget(self._page_control)
1013 1021 else:
1014 self.layout().setCurrentWidget(self._page_control)
1022 self._append_plain_text(text)
1015 1023
1016 1024 def _prompt_started(self):
1017 1025 """ Called immediately after a new prompt is displayed.
General Comments 0
You need to be logged in to leave comments. Login now