Clean up a little bit.

Added options to RegEx.
Fix case insensitive search with RegEx.
Added RegEx to UIDocFindReplace.
This commit is contained in:
Martín Lucas Golini
2024-09-22 21:16:01 -03:00
parent a60cff4d93
commit ffbf3a91d7
9 changed files with 148 additions and 141 deletions

View File

@@ -62,8 +62,8 @@ size_t GlobalSearchController::replaceInFiles( const std::string& replaceText,
}
const ProjectSearch::Result& res = model->getResult();
bool hasCaptures = ( model->isResultFromLuaPattern() || model->isResultFromRegEx() ) &&
LuaPattern::hasMatches( replaceText, "$%d+" );
bool hasCaptures =
model->isResultFromPatternMatch() && LuaPattern::hasMatches( replaceText, "$%d+" );
if ( hasCaptures ) {
for ( const auto& fileResult : res ) {
@@ -678,9 +678,7 @@ void GlobalSearchController::doGlobalSearch( String text, String filter, bool ca
mUISceneNode->runOnMainThread( [this, loader, res, search, searchReplace,
searchAgain, escapeSequence, searchType, filter] {
auto model = ProjectSearch::asModel( res );
model->setResultFromLuaPattern( searchType ==
TextDocument::FindReplaceType::LuaPattern );
model->setResultFromRegEx( searchType == TextDocument::FindReplaceType::RegEx );
model->setOpType( searchType );
updateGlobalSearchHistory( model, search, filter, searchReplace, searchAgain,
escapeSequence );
updateGlobalSearchBarResults( search, model, searchReplace, escapeSequence );