Skip to content

Commit

Permalink
Merge pull request #368 from impact27/non_executing_scrolling
Browse files Browse the repository at this point in the history
Scroll when adding text even when not executing
  • Loading branch information
ccordoba12 committed Aug 27, 2019
2 parents 9d0ffb6 + d48e37e commit 4842ace
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions qtconsole/console_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -2018,12 +2018,11 @@ def _insert_plain_text(self, cursor, text, flush=False):
if buffer_size > 0:
text = self._get_last_lines(text, buffer_size)

if self._executing:
viewport = self._control.viewport()
end_scroll_pos = self._control.cursorForPosition(
QtCore.QPoint(viewport.width()-1, viewport.height()-1)
).position()
end_doc_pos = self._get_end_pos()
viewport = self._control.viewport()
end_scroll_pos = self._control.cursorForPosition(
QtCore.QPoint(viewport.width()-1, viewport.height()-1)
).position()
end_doc_pos = self._get_end_pos()

cursor.beginEditBlock()
if self.ansi_codes:
Expand Down Expand Up @@ -2085,7 +2084,7 @@ def _insert_plain_text(self, cursor, text, flush=False):
cursor.insertText(text)
cursor.endEditBlock()

if self._executing and end_doc_pos - end_scroll_pos <= 1:
if end_doc_pos - end_scroll_pos <= 1:
end_scroll = (self._control.verticalScrollBar().maximum()
- self._control.verticalScrollBar().pageStep())
# Only scroll down
Expand Down

0 comments on commit 4842ace

Please sign in to comment.