From 9a0368af1da88fd593f2afc851dbd86aaa935045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Tue, 30 Jan 2024 18:44:50 -0300 Subject: [PATCH] Minor fixes. --- src/eepp/ui/doc/syntaxdefinitionmanager.cpp | 2 +- src/tools/ecode/plugins/git/gitplugin.cpp | 19 +++++++++++++++++-- src/tools/ecode/plugins/git/gitplugin.hpp | 2 ++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/eepp/ui/doc/syntaxdefinitionmanager.cpp b/src/eepp/ui/doc/syntaxdefinitionmanager.cpp index d54657aa3..90aba5ba0 100644 --- a/src/eepp/ui/doc/syntaxdefinitionmanager.cpp +++ b/src/eepp/ui/doc/syntaxdefinitionmanager.cpp @@ -1140,7 +1140,7 @@ static void addCMake() { { { "[%a_][%w_]*" }, "symbol" }, }, std::move( cmake_symbols ), - "//", + "#", { "^cmake_minimum_required.*%c" } } ); } diff --git a/src/tools/ecode/plugins/git/gitplugin.cpp b/src/tools/ecode/plugins/git/gitplugin.cpp index db7ccc8fd..ffe9ac6bb 100644 --- a/src/tools/ecode/plugins/git/gitplugin.cpp +++ b/src/tools/ecode/plugins/git/gitplugin.cpp @@ -1338,11 +1338,11 @@ void GitPlugin::buildSidePanelTab() { if ( id == "git-commit" ) { commit( repoPath ); } else if ( id == "git-stage-all" ) { - stage( model->getFiles( repoName( repoPath ), + stage( model->getFiles( repoFullName( repoPath ), (Uint32)Git::GitStatusType::Untracked | (Uint32)Git::GitStatusType::Changed ) ); } else if ( id == "git-unstage-all" ) { - unstage( model->getFiles( repoName( repoPath ), + unstage( model->getFiles( repoFullName( repoPath ), (Uint32)Git::GitStatusType::Staged ) ); } } ); @@ -1585,6 +1585,21 @@ std::string GitPlugin::repoName( const std::string& repoPath ) { return ""; } +std::string GitPlugin::repoFullName( const std::string& repoPath ) { + Lock l( mRepoMutex ); + for ( const auto& repo : mRepos ) { + if ( repo.first == repoPath ) { + if ( repoPath != mProjectPath ) { + auto fullName( repo.first ); + FileSystem::filePathRemoveBasePath( mProjectPath, fullName ); + return fullName; + } + return repo.second; + } + } + return ""; +} + std::string GitPlugin::repoPath( const std::string& repoName ) { Lock l( mRepoMutex ); for ( const auto& repo : mRepos ) diff --git a/src/tools/ecode/plugins/git/gitplugin.hpp b/src/tools/ecode/plugins/git/gitplugin.hpp index d8104027a..eb2d5bf7c 100644 --- a/src/tools/ecode/plugins/git/gitplugin.hpp +++ b/src/tools/ecode/plugins/git/gitplugin.hpp @@ -215,6 +215,8 @@ class GitPlugin : public PluginBase { std::string repoPath( const std::string& repoName ); + std::string repoFullName( const std::string& repoPath ); + std::string fixFilePath( const std::string& file ); std::vector fixFilePaths( const std::vector& files );