forked from qt-creator/qt-creator
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:
@@ -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 {};
|
||||||
|
Reference in New Issue
Block a user