From 2d804190ed084771ab7bbd7ddfa1dc4f5e41bf19 Mon Sep 17 00:00:00 2001 From: jsbautista Date: Tue, 12 Nov 2024 00:03:20 -0500 Subject: [PATCH] Clean Code --- qtconsole/history_console_widget.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qtconsole/history_console_widget.py b/qtconsole/history_console_widget.py index 66052cef..12125f8d 100644 --- a/qtconsole/history_console_widget.py +++ b/qtconsole/history_console_widget.py @@ -185,6 +185,7 @@ def _show_history_droplist(self): not (self._get_edited_history(self._history_index)[:pos] == input_buffer[:pos]): self._history_prefix = input_buffer[:pos] items = self._history + items.reverse() if (self._history_prefix): items = [item for item in items if item.startswith(self._history_prefix)] @@ -204,13 +205,11 @@ def _show_history_droplist(self): if len(items) == 1: cursor.setPosition(self._control.textCursor().position(), QtGui.QTextCursor.KeepAnchor) - cursor.insertText(items[0]) elif len(items) > 1: current_pos = self._control.textCursor().position() prefix = os.path.commonprefix(items) if prefix: cursor.setPosition(current_pos, QtGui.QTextCursor.KeepAnchor) - cursor.insertText(prefix) current_pos = cursor.position() self._history_list_widget.show_items(cursor, items, prefix_length=len(prefix))