Skip to content

Commit c66b544

Browse files
committed
Only highlight cursor line after syntax highlighter is finished
This is because cursor line highlight relies on data from syntax highlighting (to apply background colors)
1 parent 2df665d commit c66b544

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • src/calibre/gui2/tweak_book/editor

src/calibre/gui2/tweak_book/editor/text.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,14 +625,17 @@ def go_to_anchor(self, anchor):
625625

626626
# Line numbers and cursor line {{{
627627
def highlight_cursor_line(self):
628+
if self.highlighter.is_working:
629+
QTimer.singleShot(10, self.highlight_cursor_line)
630+
return
628631
sel = QTextEdit.ExtraSelection()
629632
sel.format.setBackground(self.palette().alternateBase())
630633
sel.format.setProperty(QTextFormat.Property.FullWidthSelection, True)
631634
sel.cursor = self.textCursor()
632635
sel.cursor.clearSelection()
633636
self.current_cursor_line = [sel]
634637

635-
# apply any formats that have a backgroud over the cursor line format
638+
# apply any formats that have a background over the cursor line format
636639
# to ensure they are visible
637640
c = self.textCursor()
638641
block = c.block()

0 commit comments

Comments
 (0)