From 4045b2fa3cbd574467aa2b90b2e813158696a196 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Sat, 11 Apr 2020 15:50:24 -0400 Subject: [PATCH] [TD]"<" symbol embedded in html --- src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp b/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp index 02c25ce9a4..64ff8f49a7 100644 --- a/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp @@ -158,10 +158,19 @@ void QGIViewAnnotation::drawAnnotation() if (it != annoText.begin()) { ss << "
"; } - std::string u8String = Base::Tools::escapedUnicodeToUtf8(*it); -// what madness turns \' into \\\\\'? - std::string apos = std::regex_replace((u8String), std::regex("\\\\\'"), "'"); - ss << apos; + //TODO: there is still a bug here. entering "'" works, save and restore works, but edit after + // save and restore brings "\'" back into text. manually deleting the "\" fixes it until the next + // save/restore/edit cycle. + // a guess is that the editor for propertyStringList is too enthusiastic about substituting. + // the substituting might be necessary for using the strings in Python. + // ' doesn't seem to help in this case. + + std::string u8String = Base::Tools::escapedUnicodeToUtf8(*it); //from \x??\x?? to real utf8 + std::string apos = std::regex_replace((u8String), std::regex("\\\\"), ""); //remove doubles. + apos = std::regex_replace((apos), std::regex("\\'"), "'"); //replace escaped apos + //"less than" symbol chops off line. need to use html sub. + std::string lt = std::regex_replace((apos), std::regex("<"), "<"); + ss << lt; } ss << "

\n\n ";