From 9d3944c5fee2666c3448ad79aefc278b0643b280 Mon Sep 17 00:00:00 2001 From: Geoffray Levasseur Date: Tue, 17 Nov 2026 13:35:27 +0100 Subject: [PATCH] fix help titles --- game/localplayer/Help.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/game/localplayer/Help.cpp b/game/localplayer/Help.cpp index 21a08b2..3c12400 100644 --- a/game/localplayer/Help.cpp +++ b/game/localplayer/Help.cpp @@ -190,7 +190,19 @@ void HelpDlg::prepare(int sbPos) : phrases.lookup(QStringLiteral("FEATURES"), no); break; case LinkCategory::Model: title = helpText.lookup(QStringLiteral("HELPTITLE_MODELLIST")); break; - case LinkCategory::Text: title = helpText.lookupByHandle(no); break; + case LinkCategory::Text: { + // Text pages carry their own "$Caption\" markup prefix (handled by + // addTextual() for the body) - extract just that for the heading + // instead of using the whole raw (multi-paragraph) body as-is. + const QString body = helpText.lookupByHandle(no); + if (!body.isEmpty() && body.at(0) == QLatin1Char('$')) { + const int brk = body.indexOf(QLatin1Char('\\')); + title = brk > 0 ? body.mid(1, brk - 1) : body.mid(1); + } else { + title = body; + } + break; + } case LinkCategory::Misc: switch (static_cast(no)) { case MiscLinkIndex::Main: title = helpText.lookup(QStringLiteral("HELPTITLE_MAIN")); break;