diff --git a/CHANGELOG.md b/CHANGELOG.md index fab893258f..738b17586c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -310,6 +310,7 @@ Feature #8109: Expose commitCrime to Lua API Feature #8130: Launcher: Add the ability to open a selected data directory in the file browser Feature #8145: Starter spell flag is not exposed + Feature #8287: Launcher: Special handling for comma in openmw.cfg entries is unintuitive and should be removed Task #5859: User openmw-cs.cfg has comment talking about settings.cfg Task #5896: Do not use deprecated MyGUI properties Task #6085: Replace boost::filesystem with std::filesystem diff --git a/components/config/gamesettings.cpp b/components/config/gamesettings.cpp index 3210716a5c..a5e71326b2 100644 --- a/components/config/gamesettings.cpp +++ b/components/config/gamesettings.cpp @@ -274,9 +274,8 @@ bool Config::GameSettings::isOrderedLine(const QString& line) // - Always ignore a line beginning with '#' or empty lines; added above a config // entry. // -// - If a line in file exists with matching key and first part of value (before ',', -// '\n', etc) also matches, then replace the line with that of mUserSettings. -// - else remove line +// - If a line in file exists with matching key and value, then replace the line with that of mUserSettings. +// - else if only the key matches, remove comment // // - If there is no corresponding line in file, add at the end // @@ -325,7 +324,7 @@ bool Config::GameSettings::writeFileWithComments(QFile& file) // +----------------------------------------------------------+ // // - QRegularExpression settingRegex("^([^=]+)\\s*=\\s*([^,]+)(.*)$"); + QRegularExpression settingRegex("^([^=]+)\\s*=\\s*(.+?)\\s*$"); std::vector comments; auto commentStart = fileCopy.end(); std::map> commentsMap; @@ -395,8 +394,7 @@ bool Config::GameSettings::writeFileWithComments(QFile& file) // look for a key in the line if (!match.hasMatch() || settingRegex.captureCount() < 2) { - // no key or first part of value found in line, replace with a null string which - // will be removed later + // no key or no value found in line, replace with a null string which will be removed later *iter = QString(); comments.clear(); commentStart = fileCopy.end();