mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-28 17:16:29 +03:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -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 );
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user