From 0a9f7882a501027bfa25c1aa811ecca9327bd27f Mon Sep 17 00:00:00 2001 From: Phenom Date: Thu, 21 May 2020 16:32:25 +0200 Subject: [PATCH] Fix Indent in Chat Message --- retroshare-gui/src/util/HandleRichText.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/retroshare-gui/src/util/HandleRichText.cpp b/retroshare-gui/src/util/HandleRichText.cpp index d8870eb50..466e540de 100644 --- a/retroshare-gui/src/util/HandleRichText.cpp +++ b/retroshare-gui/src/util/HandleRichText.cpp @@ -31,6 +31,8 @@ #include "gui/RetroShareLink.h" #include "util/ObjectPainter.h" #include "util/imageutil.h" + +#include "util/rsdebug.h" #include "util/rstime.h" #ifdef USE_CMARK @@ -40,6 +42,8 @@ #include +//#define DEBUG_SAVESPACE 1 + /** * The type of embedding we'd like to do */ @@ -554,18 +558,24 @@ static QString saveSpace(const QString text) if(cursChar==QLatin1Char('>')) { if(!echapChar && i>0) {outBrackets=true; firstOutBracket=true;} } else if(cursChar==QLatin1Char('\t')) { - if(outBrackets && firstOutBracket && (keyName!="style")) savedSpaceText.replace(i, 1, "  "); + if(outBrackets && firstOutBracket && (keyName!="style")) { savedSpaceText.replace(i, 1, "  "); i+= 11; } } else if(cursChar==QLatin1Char(' ')) { - if(outBrackets && firstOutBracket && (keyName!="style")) savedSpaceText.replace(i, 1, " "); + if(outBrackets && firstOutBracket && (keyName!="style")) { savedSpaceText.replace(i, 1, " "); i+= 5; } } else if(cursChar==QChar(0xA0)) { - if(outBrackets && firstOutBracket && (keyName!="style")) savedSpaceText.replace(i, 1, " "); + if(outBrackets && firstOutBracket && (keyName!="style")) { savedSpaceText.replace(i, 1, " "); i+= 5; } } else if(cursChar==QLatin1Char('<')) { if(!echapChar) {outBrackets=false; getKeyName=true; keyName.clear();} } else firstOutBracket=false; echapChar=(cursChar==QLatin1Char('\\')); } - +#ifdef DEBUG_SAVESPACE + RsDbg() << __PRETTY_FUNCTION__ << "Text to save:" << std::endl + << text.toStdString() << std::endl + << "---------------------- Saved Text:" << std::endl + << savedSpaceText.toStdString() << std::endl; +#endif + return savedSpaceText; }