From 2ed0cdd3c90fbce9d8f337619f645e4dd544dba2 Mon Sep 17 00:00:00 2001 From: "Martin T. H. Sandsmark" Date: Mon, 22 Nov 2021 18:03:46 +0100 Subject: [PATCH] We don't need to paint the rect twice --- src/terminalDisplay/TerminalPainter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/terminalDisplay/TerminalPainter.cpp b/src/terminalDisplay/TerminalPainter.cpp index af2af3c3..246946f0 100644 --- a/src/terminalDisplay/TerminalPainter.cpp +++ b/src/terminalDisplay/TerminalPainter.cpp @@ -549,13 +549,14 @@ void TerminalPainter::drawCursor(QPainter &painter, const QRect &rect, const QCo painter.setPen(pen); if (display->cursorShape() == Enum::BlockCursor) { - painter.drawRect(cursorRect.adjusted(halfWidth, halfWidth, -halfWidth, -halfWidth)); if (display->hasFocus()) { painter.fillRect(cursorRect, cursorColor); QColor cursorTextColor = display->terminalColor()->cursorTextColor(); characterColor = cursorTextColor.isValid() ? cursorTextColor : backgroundColor; + } else { + painter.drawRect(cursorRect.adjusted(halfWidth, halfWidth, -halfWidth, -halfWidth)); } } else if (display->cursorShape() == Enum::UnderlineCursor) { QLineF line(cursorRect.left() + halfWidth, cursorRect.bottom() - halfWidth, cursorRect.right() - halfWidth, cursorRect.bottom() - halfWidth);