From faafd21dc8cabab91bb1599368564bc5bd3e5a92 Mon Sep 17 00:00:00 2001 From: tomcw Date: Sun, 27 Sep 2026 18:57:13 +0100 Subject: [PATCH] Save-state: undo the backslash-doubling so that UI only shows single slashes. (#1510) --- source/YamlHelper.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/YamlHelper.cpp b/source/YamlHelper.cpp index 25d7a367..e99ca958 100644 --- a/source/YamlHelper.cpp +++ b/source/YamlHelper.cpp @@ -367,6 +367,21 @@ bool YamlLoadHelper::LoadBool(const std::string key) std::string YamlLoadHelper::LoadString_NoThrow(const std::string& key, bool& bFound) { std::string value = m_yamlHelper.GetMapValue(*m_pMapYaml, key, bFound); + + if (bFound) + { + // Undo any backslash-doubling from a previous save-state, so that UI only shows single-backslashes (GH#1510) + if (value.find("\\\\") != std::string::npos) // String contains a double backslash? + { + size_t pos = 0; + while ((pos = value.find("\\\\", pos)) != std::string::npos) + { + value = value.replace(pos, 2, "\\"); + pos += 1; + } + } + } + return value; }