Fix multi-line text selection not rendered correctly anymore

The `CTextCursor::m_LineCount` variable is only updated after the cursor is rendered. For calculating the selection quads we need to check `LineCount` instead, which is updated while the cursor is being rendered. Regression from #7733.
This commit is contained in:
Robert Müller 2024-01-13 23:09:20 +01:00
parent 84cbd362e8
commit a873485643

View file

@ -1867,7 +1867,7 @@ public:
if(SelectionStarted && IsRendered) if(SelectionStarted && IsRendered)
{ {
if(!vSelectionQuads.empty() && SelectionQuadLine == pCursor->m_LineCount) if(!vSelectionQuads.empty() && SelectionQuadLine == LineCount)
{ {
vSelectionQuads.back().m_Width += SelWidth; vSelectionQuads.back().m_Width += SelWidth;
} }
@ -1877,7 +1877,7 @@ public:
const float SelectionY = DrawY + (1.0f - pCursor->m_SelectionHeightFactor) * SelectionHeight; const float SelectionY = DrawY + (1.0f - pCursor->m_SelectionHeightFactor) * SelectionHeight;
const float ScaledSelectionHeight = pCursor->m_SelectionHeightFactor * SelectionHeight; const float ScaledSelectionHeight = pCursor->m_SelectionHeightFactor * SelectionHeight;
vSelectionQuads.emplace_back(SelX, SelectionY, SelWidth, ScaledSelectionHeight); vSelectionQuads.emplace_back(SelX, SelectionY, SelWidth, ScaledSelectionHeight);
SelectionQuadLine = pCursor->m_LineCount; SelectionQuadLine = LineCount;
} }
} }