From aa0c9bc741091f2212955bc3f9dc7d20116c6f9c Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 17 Apr 2023 10:53:32 +0200 Subject: [PATCH] Editor: skip painting selection path out of clip rect Change-Id: Ieec7afbec729708884c24d8de2b4a6c488220a69 Reviewed-by: Christian Stenger --- src/plugins/texteditor/texteditoroverlay.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/texteditor/texteditoroverlay.cpp b/src/plugins/texteditor/texteditoroverlay.cpp index 4a6eda6c2c4..52ab8709de6 100644 --- a/src/plugins/texteditor/texteditoroverlay.cpp +++ b/src/plugins/texteditor/texteditoroverlay.cpp @@ -252,6 +252,8 @@ void TextEditorOverlay::paintSelection(QPainter *painter, return; QPainterPath path = createSelectionPath(begin, end, clip); + if (path.isEmpty()) + return; painter->save(); QColor penColor = fg; @@ -307,6 +309,8 @@ void TextEditorOverlay::fillSelection(QPainter *painter, return; QPainterPath path = createSelectionPath(begin, end, clip); + if (path.isEmpty()) + return; painter->save(); painter->translate(-.5, -.5);