internal: fix handling of escaped #

This commit is contained in:
Vaxry 2024-02-10 01:50:22 +00:00
parent 335d0c65e1
commit c1f5b0ab48
2 changed files with 2 additions and 1 deletions

View File

@ -404,6 +404,7 @@ CParseResult CConfig::parseLine(std::string line, bool dynamic) {
line = line.substr(0, commentPos);
break;
} else {
line = line.substr(0, commentPos + 1) + line.substr(commentPos + 2);
commentPos = line.find('#', lastHashPos);
}
}

View File

@ -129,7 +129,7 @@ int main(int argc, char** argv, char** envp) {
EXPECT(std::any_cast<float>(config.getConfigValue("testFloat")), 123.456f);
auto EXP = Hyprlang::SVector2D{69, 420};
EXPECT(std::any_cast<Hyprlang::SVector2D>(config.getConfigValue("testVec")), EXP);
EXPECT(std::any_cast<const char*>(config.getConfigValue("testString")), std::string{"Hello World! ## This is not a comment!"});
EXPECT(std::any_cast<const char*>(config.getConfigValue("testString")), std::string{"Hello World! # This is not a comment!"});
EXPECT(std::any_cast<const char*>(config.getConfigValue("testStringQuotes")), std::string{"\"Hello World!\""});
EXPECT(std::any_cast<int64_t>(config.getConfigValue("testCategory:testValueInt")), 123456L);
EXPECT(std::any_cast<int64_t>(config.getConfigValue("testCategory:testValueHex")), 0xFFFFAABBL);