From 6db1e5ec431e77424102b49d1bb9b00ea1a41fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Wed, 13 Mar 2024 20:14:41 -0300 Subject: [PATCH] Fix project search error incorrectly counting the result line number when searching with the wholeword flag. A couple of minor fixes. --- src/tools/ecode/ecode.cpp | 26 +++++++++++++---------- src/tools/ecode/plugins/git/gitplugin.cpp | 3 ++- src/tools/ecode/projectsearch.cpp | 1 + 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index 869f8249d..197455d9b 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -3862,19 +3862,23 @@ static void exportLanguages( const std::string& path, const std::string& langs ) std::vector defs; if ( !langs.empty() ) { - auto langss = String::split( langs, ',' ); - for ( const auto& l : langss ) { - const auto& sd = sdm->getByLSPName( l ); + if ( langs == "all" ) { + defs = sdm->getDefinitions(); + } else { + auto langss = String::split( langs, ',' ); + for ( const auto& l : langss ) { + const auto& sd = sdm->getByLSPName( l ); - if ( !sd.getLanguageName().empty() ) { - defs.push_back( sd ); - continue; + if ( !sd.getLanguageName().empty() ) { + defs.push_back( sd ); + continue; + } + + const auto& sd2 = sdm->getByLanguageName( l ); + + if ( !sd2.getLanguageName().empty() ) + defs.push_back( sd2 ); } - - const auto& sd2 = sdm->getByLanguageName( l ); - - if ( !sd2.getLanguageName().empty() ) - defs.push_back( sd2 ); } } diff --git a/src/tools/ecode/plugins/git/gitplugin.cpp b/src/tools/ecode/plugins/git/gitplugin.cpp index 92ba9c896..1c60b4d8c 100644 --- a/src/tools/ecode/plugins/git/gitplugin.cpp +++ b/src/tools/ecode/plugins/git/gitplugin.cpp @@ -92,7 +92,8 @@ GitPlugin::~GitPlugin() { endModelStyler(); - getUISceneNode()->removeActionsByTag( GIT_STATUS_UPDATE_TAG ); + if ( getUISceneNode() ) + getUISceneNode()->removeActionsByTag( GIT_STATUS_UPDATE_TAG ); { Lock l( mGitBranchMutex ); } { Lock l( mGitStatusMutex ); } diff --git a/src/tools/ecode/projectsearch.cpp b/src/tools/ecode/projectsearch.cpp index dd6784cdc..03a54f9ba 100644 --- a/src/tools/ecode/projectsearch.cpp +++ b/src/tools/ecode/projectsearch.cpp @@ -64,6 +64,7 @@ searchInFileHorspool( const std::string& file, const std::string& text, const bo searchRes = String::BMH::find( fileText, text, searchRes, occ ); if ( searchRes != -1 ) { if ( wholeWord && !String::isWholeWord( fileText, text, searchRes ) ) { + totNl += countNewLines( fileText, lSearchRes, searchRes ); lSearchRes = searchRes; searchRes += text.size(); continue;