From 85eea70be41f6ea7f5358aa17e8e004537407e3f Mon Sep 17 00:00:00 2001 From: vaxerski Date: Mon, 3 Oct 2022 16:38:05 +0100 Subject: [PATCH] fix commas in free binds --- src/config/ConfigManager.cpp | 2 +- src/config/ConfigManager.hpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 9dcb21e2..cdc00b9c 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -637,7 +637,7 @@ void CConfigManager::handleBind(const std::string& command, const std::string& v return; } - const auto ARGS = CVarList(value); + const auto ARGS = CVarList(value, 4); if ((ARGS.size() < 4 && !mouse) || (ARGS.size() < 3 && mouse)) { parseError = "bind: too few args"; diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index 8a167e61..8340ef06 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -72,12 +72,12 @@ struct SAnimationPropertyConfig { class CVarList { public: - CVarList(const std::string& in) { + CVarList(const std::string& in, long unsigned int lastArgNo = 0) { std::string curitem = ""; std::string argZ = in; auto nextItem = [&]() { - auto idx = argZ.find_first_of(','); + auto idx = lastArgNo != 0 && m_vArgs.size() >= lastArgNo - 1 ? std::string::npos : argZ.find_first_of(','); if (idx != std::string::npos) { curitem = argZ.substr(0, idx);