Skip to content

Commit

Permalink
Merge pull request #618 from dalthviz/follow_up_607
Browse files Browse the repository at this point in the history
Missing code style suggestions from Carriage Return fix PR
  • Loading branch information
ccordoba12 authored Aug 15, 2024
2 parents f79480d + 55b8c2e commit 39cd91b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions qtconsole/console_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,15 +1017,15 @@ def _append_custom(self, insert, input, before_prompt=False, *args, **kwargs):
and self._append_before_prompt_pos != self._get_end_pos():
cursor.setPosition(self._append_before_prompt_pos)

# If we appending on the same line as the prompt, use insert mode
# If we're appending on the same line as the prompt, use insert mode.
# If so, the character at self._append_before_prompt_pos will not be a newline
cursor.movePosition(QtGui.QTextCursor.Right,
QtGui.QTextCursor.KeepAnchor)
if cursor.selection().toPlainText() != '\n':
cursor._insert_mode = True
cursor.movePosition(QtGui.QTextCursor.Left)
else:
# Insert at current printing point
# Insert at current printing point.
# If cursor is before prompt jump to end, but only if there
# is a prompt (before_prompt_pos != end)
if cursor.position() <= self._append_before_prompt_pos \
Expand Down Expand Up @@ -1694,9 +1694,12 @@ def _on_flush_pending_stream_timer(self):
self._flush_pending_stream()

def _flush_pending_stream(self):
""" Flush pending text into the widget. Only applies to text that is pending
when the console is in the running state. Text printed when console is
not running is shown immediately, and does not wait to be flushed.
"""
Flush pending text into the widget.
It only applies to text that is pending when the console is in the
running state. Text printed when console is not running is shown
immediately, and does not wait to be flushed.
"""
text = self._pending_insert_text
self._pending_insert_text = []
Expand Down

0 comments on commit 39cd91b

Please sign in to comment.