1
0
mirror of synced 2025-01-10 21:41:53 +01:00

fix: Jittery scrolling in Text Editor

This commit is contained in:
WerWolv 2024-12-23 11:44:34 +01:00
parent f6bc3d4650
commit 470523cc86

View File

@ -894,9 +894,9 @@ void TextEditor::Render() {
if (mSetTopLine)
SetTopLine();
else
mTopLine = std::max(0,(int)(std::floor((scrollY-mTopMargin) / mCharAdvance.y)));
auto lineNo = mTopLine;
auto globalLineMax = (int)mLines.size();
mTopLine = std::max<int>(0, std::floor((scrollY-mTopMargin) / mCharAdvance.y) - 1);
auto lineNo = mTopLine;
int globalLineMax = mLines.size();
auto lineMax = std::clamp(lineNo + mNumberOfLinesDisplayed, 0, globalLineMax - 1);
mLongest = GetLongestLineLength() * mCharAdvance.x;