From a8115a900015abf538e3105e2520196bf67aded2 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Thu, 4 Jun 2020 03:41:11 +0100 Subject: [PATCH] Escape regexp meta-characters in search strings This resolves the regression where Highlight Callsign UDP messages fail when the callsign contains a '+' character. --- widgets/displaytext.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/widgets/displaytext.cpp b/widgets/displaytext.cpp index ae865bc9d..ef91761fc 100644 --- a/widgets/displaytext.cpp +++ b/widgets/displaytext.cpp @@ -553,7 +553,14 @@ void DisplayText::highlight_callsign (QString const& callsign, QColor const& bg, { return; } - QRegularExpression target {QString {"?"}, QRegularExpression::DontCaptureOption}; + auto regexp = callsign; + // allow for hashed callsigns and escape any regexp metacharacters + QRegularExpression target {QString {"?"} + , QRegularExpression::DontCaptureOption}; QTextCharFormat old_format {currentCharFormat ()}; QTextCursor cursor {document ()}; if (last_period_only)