##// 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 # Standard library imports
1 # Standard library imports
2 import re
2 import sys
3 import sys
3 from textwrap import dedent
4 from textwrap import dedent
4
5
@@ -994,24 +995,31 b' class ConsoleWidget(QtGui.QWidget):'
994 return True
995 return True
995
996
996 def _page(self, text):
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':
1001 if self._page_style == 'none':
1000 self.custom_page_requested.emit(text)
1001 elif self._page_style == 'none':
1002 self._append_plain_text(text)
1002 self._append_plain_text(text)
1003 else:
1003 else:
1004 self._page_control.clear()
1004 line_height = QtGui.QFontMetrics(self.font).height()
1005 cursor = self._page_control.textCursor()
1005 minlines = self._control.viewport().height() / line_height
1006 self._insert_plain_text(cursor, text)
1006 if re.match("(?:[^\n]*\n){%i}" % minlines, text):
1007 self._page_control.moveCursor(QtGui.QTextCursor.Start)
1007 if self._page_style == 'custom':
1008
1008 self.custom_page_requested.emit(text)
1009 self._page_control.viewport().resize(self._control.size())
1009 else:
1010 if self._splitter:
1010 self._page_control.clear()
1011 self._page_control.show()
1011 cursor = self._page_control.textCursor()
1012 self._page_control.setFocus()
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 else:
1021 else:
1014 self.layout().setCurrentWidget(self._page_control)
1022 self._append_plain_text(text)
1015
1023
1016 def _prompt_started(self):
1024 def _prompt_started(self):
1017 """ Called immediately after a new prompt is displayed.
1025 """ Called immediately after a new prompt is displayed.
General Comments 0
You need to be logged in to leave comments. Login now