From 3ee511091d0676920057fdffd3a55cf07128e60a Mon Sep 17 00:00:00 2001 From: dalthviz <16781833+dalthviz@users.noreply.github.com> Date: Mon, 12 Aug 2024 15:27:50 -0500 Subject: [PATCH 1/2] Missing code style suggestions from Carriage Return fix PR Co-authored-by: Carlos Cordoba --- qtconsole/console_widget.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/qtconsole/console_widget.py b/qtconsole/console_widget.py index ebb8d23a..94f6b1cb 100644 --- a/qtconsole/console_widget.py +++ b/qtconsole/console_widget.py @@ -1017,7 +1017,7 @@ 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) @@ -1025,7 +1025,7 @@ def _append_custom(self, insert, input, before_prompt=False, *args, **kwargs): 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 \ @@ -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. + + 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 = [] From 55b8c2e9c2bc683c8fd914228188a1c204cf995b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Althviz=20Mor=C3=A9?= <16781833+dalthviz@users.noreply.github.com> Date: Thu, 15 Aug 2024 14:04:10 -0500 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Carlos Cordoba --- qtconsole/console_widget.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qtconsole/console_widget.py b/qtconsole/console_widget.py index 94f6b1cb..09bd7f71 100644 --- a/qtconsole/console_widget.py +++ b/qtconsole/console_widget.py @@ -1017,7 +1017,7 @@ 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're 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) @@ -1697,7 +1697,7 @@ def _flush_pending_stream(self): """ Flush pending text into the widget. - Only applies to text that is pending when the console is in the + 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. """