From 29af981345a92594ff3975ea0ee583738df93f34 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Thu, 9 Jan 2025 15:21:14 +0000 Subject: [PATCH 1/3] Don't give commas special meaning when matching comments to openmw.cfg values Previously, comments would be associated with the openmw.cfg line that followed them, but only up to the first comma. This meant that if you had fallback=thing,otherthing and fallback=thing,thirdthing, comments above the thirdthing line would be moved above the otherthing line, even though both lines would be kept when the file was written out. This seemed to be an attempt at a feature when cc9cii first implemented the comment preservation system, but it only seems to cause confusion. --- components/config/gamesettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/config/gamesettings.cpp b/components/config/gamesettings.cpp index 3210716a5c..bf8cdef933 100644 --- a/components/config/gamesettings.cpp +++ b/components/config/gamesettings.cpp @@ -325,7 +325,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; From e1208b64e71b8150b0359086a73c1a11ca3e6578 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Thu, 9 Jan 2025 17:16:06 +0000 Subject: [PATCH 2/3] Update comments --- components/config/gamesettings.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/components/config/gamesettings.cpp b/components/config/gamesettings.cpp index bf8cdef933..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 // @@ -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(); From e908f28cb79bc5965fd79e1f710c0dab3ad9ffcf Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Sat, 11 Jan 2025 17:27:12 +0000 Subject: [PATCH 3/3] c h a n g e l o g --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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