TextEditor: avoid painting annotations over suggestions

Blocks with suggestions are longer than without the suggestion. So we
have to calculate the annotation start position based on the reaplcement
and not the actual document layout.

Change-Id: I32ce81134e1146dd28ae11a70356a98c75529236
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
David Schulz
2023-03-16 06:56:02 +01:00
parent 23513bb714
commit 7f56ccaa9e

View File

@@ -4061,7 +4061,13 @@ static TextMarks availableMarks(const TextMarks &marks,
QRectF TextEditorWidgetPrivate::getLastLineLineRect(const QTextBlock &block) QRectF TextEditorWidgetPrivate::getLastLineLineRect(const QTextBlock &block)
{ {
const QTextLayout *layout = block.layout(); QTextLayout *layout = nullptr;
if (block != m_suggestionBlock)
layout = block.layout();
else if (QTextDocument *replacement = TextDocumentLayout::replacementDocument(block))
layout = replacement->firstBlock().layout();
QTC_ASSERT(layout, layout = block.layout());
const int lineCount = layout->lineCount(); const int lineCount = layout->lineCount();
if (lineCount < 1) if (lineCount < 1)
return {}; return {};