string: respect removeEmpty when VarList input is empty (#7)

This commit is contained in:
Maximilian Seidler 2024-07-04 18:04:41 +02:00 committed by GitHub
parent 1d20063da2
commit 259ecfa098
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ namespace Hyprutils {
@param delim if delimiter is 's', use std::isspace @param delim if delimiter is 's', use std::isspace
@param removeEmpty remove empty args from argv @param removeEmpty remove empty args from argv
*/ */
CVarList(const std::string& in, const size_t maxSize = 0, const char delim = ',', const bool removeEmpty = false); CVarList(const std::string& in, const size_t lastArgNo = 0, const char delim = ',', const bool removeEmpty = false);
~CVarList() = default; ~CVarList() = default;

View File

@ -6,7 +6,7 @@
using namespace Hyprutils::String; using namespace Hyprutils::String;
Hyprutils::String::CVarList::CVarList(const std::string& in, const size_t lastArgNo, const char delim, const bool removeEmpty) { Hyprutils::String::CVarList::CVarList(const std::string& in, const size_t lastArgNo, const char delim, const bool removeEmpty) {
if (in.empty()) if (!removeEmpty && in.empty())
m_vArgs.emplace_back(""); m_vArgs.emplace_back("");
std::string args{in}; std::string args{in};