Minor improvement in the UICodeEditor minimap scrolling.

ecode: AutoCompleteModule minor optimizations.
This commit is contained in:
Martín Lucas Golini
2022-04-19 23:04:03 -03:00
parent 1f0df28b81
commit 9c6251dff6
2 changed files with 9 additions and 2 deletions

View File

@@ -972,6 +972,11 @@ Uint32 UICodeEditor::onMouseDown( const Vector2i& position, const Uint32& flags
mVScrollBar->setEnabled( false );
return 1;
} else if ( mMinimapDragging ) {
if ( mMouseDown ) {
scrollTo( { calculateMinimapClickedLine( position ) - mMinimapScrollOffset, 0 },
false, true );
getUISceneNode()->setCursor( Cursor::Arrow );
}
return 1;
}
}

View File

@@ -190,7 +190,7 @@ void AutoCompleteModule::updateDocCache( TextDocument* doc ) {
Lock l( mDocMutex );
Clock clock;
auto docCache = mDocCache.find( doc );
if ( docCache == mDocCache.end() )
if ( docCache == mDocCache.end() || mClosing )
return;
auto& cache = docCache->second;
cache.changeId = doc->getCurrentChangeId();
@@ -410,7 +410,7 @@ AutoCompleteModule::SymbolsList AutoCompleteModule::getDocumentSymbols( TextDocu
LuaPattern pattern( mSymbolPattern );
AutoCompleteModule::SymbolsList symbols;
Int64 lc = doc->linesCount();
if ( lc == 0 )
if ( lc == 0 || lc > 50000 || mClosing )
return symbols;
std::string current( getPartialSymbol( doc ) );
TextPosition end = doc->getSelection().end();
@@ -423,6 +423,8 @@ AutoCompleteModule::SymbolsList AutoCompleteModule::getDocumentSymbols( TextDocu
continue;
symbols.insert( std::move( matchStr ) );
}
if ( mClosing )
break;
}
return symbols;
}