From 5d1d614fef4eb0fa361dfa7a73c47604b5b8b0ae Mon Sep 17 00:00:00 2001 From: athompson673 Date: Fri, 3 Jan 2025 19:55:35 -0500 Subject: [PATCH] Remove extra newlines from github review accidentally applied twice. Simplify call path to get font in paint event. --- .../editor/widgets/codeeditor/multicursor_mixin.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/spyder/plugins/editor/widgets/codeeditor/multicursor_mixin.py b/spyder/plugins/editor/widgets/codeeditor/multicursor_mixin.py index 022df2baf2a..b05817bc7b2 100644 --- a/spyder/plugins/editor/widgets/codeeditor/multicursor_mixin.py +++ b/spyder/plugins/editor/widgets/codeeditor/multicursor_mixin.py @@ -305,7 +305,6 @@ def handle_multi_cursor_keypress(self, event: QKeyEvent): # Update edited extra_cursors new_cursors.append(self.textCursor()) - self.extra_cursors = new_cursors[:-1] self.merge_extra_cursors(increasing_position) self.textCursor().endEditBlock() @@ -325,7 +324,7 @@ def _on_cursor_blinktimer_timeout(self): def paint_cursors(self, event): """Paint all cursors""" if self.overwrite_mode: - font = self.textCursor().block().charFormat().font() + font = self.font() cursor_width = QFontMetrics(font).horizontalAdvance(" ") else: cursor_width = self.cursor_width @@ -426,18 +425,15 @@ def multi_cursor_paste(self, clip_text): self.sig_will_paste_text.emit(clip_text) lines = clip_text.splitlines() - if len(lines) == 1: lines = itertools.repeat(lines[0]) - self.multi_cursor_ignore_history = True for cursor, text in zip(cursors, lines): self.setTextCursor(cursor) cursor.insertText(text) # handle extra lines or extra cursors? - self.setTextCursor(main_cursor) self.multi_cursor_ignore_history = False self.cursorPositionChanged.emit() @@ -474,7 +470,6 @@ def wrapper(): self.multi_cursor_ignore_history = False self.cursorPositionChanged.emit() - return wrapper def clears_extra_cursors(self, method): @@ -484,7 +479,6 @@ def wrapper(): self.clear_extra_cursors() method() - return wrapper def restrict_single_cursor(self, method): @@ -494,7 +488,6 @@ def wrapper(): if not self.extra_cursors: method() - return wrapper def go_to_next_cell(self):