From ba08197d3b54d33edd02cf682eaaaf85522f7c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= <159546+serprex@users.noreply.github.com> Date: Sun, 12 Jul 2026 17:51:55 +0000 Subject: [PATCH] Avoid double line break when revealing MQness of spirit temple (#6912) --- .../custom-message/CustomMessageManager.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp b/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp index 0b3fb17cf8..b52ee24cc2 100644 --- a/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp +++ b/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp @@ -506,7 +506,10 @@ size_t CustomMessage::FindNEWLINE(std::string& str, size_t lastNewline) const { bool CustomMessage::AddBreakString(std::string& str, size_t pos, std::string breakString) const { if (str[pos] == ' ' || str[pos] == '&') { - str.replace(pos, 1, breakString); + // don't add a break next to an existing newline + if (str[pos] != ' ' || (str[pos + 1] != '&' && str[pos + 1] != NEWLINE()[0])) { + str.replace(pos, 1, breakString); + } return false; } else { if (pos <= str.size() - 1) { @@ -515,7 +518,10 @@ bool CustomMessage::AddBreakString(std::string& str, size_t pos, std::string bre return false; // otherwise, if it is a line break or space, replace it } else if (str[pos + 1] == ' ' || str[pos + 1] == '&') { - str.replace(pos + 1, 1, breakString); + // don't add a break next to an existing newline + if (str[pos + 1] != ' ' || (str[pos + 2] != '&' && str[pos + 2] != NEWLINE()[0])) { + str.replace(pos + 1, 1, breakString); + } return false; } }