Skip to content

Commit

Permalink
Remove extra newlines from github review accidentally applied twice. …
Browse files Browse the repository at this point in the history
…Simplify call path to get font in paint event.
  • Loading branch information
athompson673 committed Jan 4, 2025
1 parent 5a79728 commit 5d1d614
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -474,7 +470,6 @@ def wrapper():
self.multi_cursor_ignore_history = False
self.cursorPositionChanged.emit()


return wrapper

def clears_extra_cursors(self, method):
Expand All @@ -484,7 +479,6 @@ def wrapper():
self.clear_extra_cursors()
method()


return wrapper

def restrict_single_cursor(self, method):
Expand All @@ -494,7 +488,6 @@ def wrapper():
if not self.extra_cursors:
method()


return wrapper

def go_to_next_cell(self):
Expand Down

0 comments on commit 5d1d614

Please sign in to comment.