From 1c047808b27acfe56860c79131dc15dfd52a2130 Mon Sep 17 00:00:00 2001 From: rysson Date: Wed, 1 Feb 2023 13:58:26 +0100 Subject: [PATCH] Fix clock preformat T pattern (#1862) --- plugin-worldclock/lxqtworldclock.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugin-worldclock/lxqtworldclock.cpp b/plugin-worldclock/lxqtworldclock.cpp index 94bfc3b11..e9d7f5e2d 100644 --- a/plugin-worldclock/lxqtworldclock.cpp +++ b/plugin-worldclock/lxqtworldclock.cpp @@ -546,13 +546,19 @@ QString LXQtWorldClock::preformat(const QString &format, const QTimeZone &timeZo else replacement.prepend(QLatin1Char('\'')); + int skip = 0; if (result[tz + length] == QLatin1Char('\'')) - ++length; + { + ++length; // skip following apostrophe + apos = result.indexOf(QLatin1Char('\''), tz + length); // next apostrophe (pair to skipped one) + if (apos != -1) + skip = apos - tz - length + 1; // length of text in apostrophes just after T... + } else replacement.append(QLatin1Char('\'')); result.replace(tz, length, replacement); - from = tz + replacement.length(); + from = tz + replacement.length() + skip; } else break;