Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Martín Lucas Golini
2026-04-25 20:48:35 -03:00
4 changed files with 11 additions and 7 deletions

View File

@@ -63,7 +63,7 @@ class EE_API DocumentView {
void updateCache( Int64 fromLine, Int64 toLine, Int64 numLines );
Config getConfig() const { return mConfig; }
const Config& getConfig() const { return mConfig; }
void setConfig( Config config );

View File

@@ -1219,6 +1219,8 @@ class EE_API UICodeEditor : public UIWidget, public TextDocument::Client {
virtual void onAutoSize();
virtual void onClassChange();
inline bool needsHorizontalLength() const;
};
}} // namespace EE::UI

View File

@@ -657,7 +657,6 @@ Glyph FontTrueType::getGlyphByIndex( Uint32 index, unsigned int characterSize, b
GlyphDrawable* FontTrueType::getGlyphDrawable( Uint32 codePoint, unsigned int characterSize,
bool bold, bool italic,
Float outlineThickness ) const {
// mKeyCache
Page& page = getPage( characterSize );
GlyphDrawableTable& drawables = page.drawables;

View File

@@ -488,7 +488,7 @@ void UICodeEditor::scheduledUpdate( const Time& ) {
invalidateDraw();
}
if ( mDoc && !mDoc->isLoading() && mHorizontalScrollBarEnabled && isVisible() &&
if ( mDoc && !mDoc->isLoading() && needsHorizontalLength() && isVisible() &&
mLongestLineWidthDirty &&
mLongestLineWidthLastUpdate.getElapsedTime() > mFindLongestLineWidthUpdateFrequency ) {
updateLongestLineWidth();
@@ -499,8 +499,7 @@ void UICodeEditor::scheduledUpdate( const Time& ) {
}
void UICodeEditor::updateLongestLineWidth() {
if ( mHorizontalScrollBarEnabled && mDoc && !mDoc->isLoading() &&
!mDoc->isRunningTransaction() ) {
if ( needsHorizontalLength() && mDoc && !mDoc->isLoading() && !mDoc->isRunningTransaction() ) {
Float maxWidth = mLongestLineWidth;
findLongestLine();
mLongestLineWidthLastUpdate.restart();
@@ -2060,7 +2059,7 @@ void UICodeEditor::onPaddingChange() {
std::pair<size_t, Float> UICodeEditor::findLongestLineInRange( const TextRange& range ) {
std::pair<size_t, Float> curRange{ mLongestLineIndex, mLongestLineWidth };
if ( mHorizontalScrollBarEnabled ) {
if ( needsHorizontalLength() ) {
Float longestLineWidth = 0;
for ( Int64 lineIndex = range.start().line(); lineIndex <= range.end().line();
lineIndex++ ) {
@@ -2076,7 +2075,7 @@ std::pair<size_t, Float> UICodeEditor::findLongestLineInRange( const TextRange&
}
void UICodeEditor::findLongestLine() {
if ( mHorizontalScrollBarEnabled ) {
if ( needsHorizontalLength() ) {
auto range = findLongestLineInRange( mDoc->getDocRange() );
mLongestLineIndex = range.first;
mLongestLineWidth = range.second;
@@ -5727,4 +5726,8 @@ void UICodeEditor::onClassChange() {
}
}
bool UICodeEditor::needsHorizontalLength() const {
return mDocView.getConfig().mode == LineWrapMode::NoWrap;
}
}} // namespace EE::UI