From ddf5a1d341b694256f0dc3e551a1848ced820f65 Mon Sep 17 00:00:00 2001 From: jsbautista <42411448+jsbautista@users.noreply.github.com> Date: Thu, 17 Oct 2024 09:29:22 -0500 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Carlos Cordoba --- qtconsole/ansi_code_processor.py | 8 +++++--- qtconsole/console_widget.py | 14 +++++++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/qtconsole/ansi_code_processor.py b/qtconsole/ansi_code_processor.py index 3875c23d..16f2ddde 100644 --- a/qtconsole/ansi_code_processor.py +++ b/qtconsole/ansi_code_processor.py @@ -182,15 +182,17 @@ def set_csi_code(self, command, params=[]): count = params[0] if params else 1 self.actions.append(ScrollAction('scroll', dir, 'line', count)) - elif (command == 'A'): # Move N lines Up + elif command == 'A': # Move N lines Up dir = 'up' count = params[0] if params else 1 self.actions.append(MoveAction('move', dir, 'line', count)) - elif (command == 'B'): # Move N lines Down + + elif command == 'B': # Move N lines Down dir = 'down' count = params[0] if params else 1 self.actions.append(MoveAction('move', dir, 'line', count)) - elif (command == 'F'): # Goes back to the begining of the n-th previous line + + elif command == 'F': # Goes back to the begining of the n-th previous line dir = 'leftup' count = params[0] if params else 1 self.actions.append(MoveAction('move', dir, 'line', count)) diff --git a/qtconsole/console_widget.py b/qtconsole/console_widget.py index 495b3409..aa492baf 100644 --- a/qtconsole/console_widget.py +++ b/qtconsole/console_widget.py @@ -2192,18 +2192,22 @@ def _insert_plain_text(self, cursor, text, flush=False): if act.dir == 'up': for i in range(act.count): cursor.movePosition( - QtGui.QTextCursor.Up) + QtGui.QTextCursor.Up + ) elif act.dir == 'down': for i in range(act.count): cursor.movePosition( - QtGui.QTextCursor.Down) + QtGui.QTextCursor.Down + ) elif act.dir == 'leftup': for i in range(act.count): cursor.movePosition( - QtGui.QTextCursor.Up) + QtGui.QTextCursor.Up + ) cursor.movePosition( - QtGui.QTextCursor.StartOfLine, - QtGui.QTextCursor.MoveAnchor) + QtGui.QTextCursor.StartOfLine, + QtGui.QTextCursor.MoveAnchor + ) elif act.action == 'carriage-return': cursor.movePosition(