diff --git a/retroshare-gui/src/util/HandleRichText.cpp b/retroshare-gui/src/util/HandleRichText.cpp index 86ae22a50..6ef9ebc81 100644 --- a/retroshare-gui/src/util/HandleRichText.cpp +++ b/retroshare-gui/src/util/HandleRichText.cpp @@ -345,7 +345,8 @@ static QString saveSpace(const QString text) bool outBrackets=false, echapChar=false; QString keyName = ""; bool getKeyName = false; - + bool firstOutBracket = false; + for(int i=0;i')) { - if(!echapChar && i>0) outBrackets=true; - } else if(cursChar==QLatin1Char('\t')) { - if(outBrackets && (keyName!="style")) savedSpaceText.replace(i, 1, "  "); + if(!echapChar && i>0) {outBrackets=true; firstOutBracket=true;} + } else if(cursChar==QLatin1Char('\t')) { + if(outBrackets && firstOutBracket && (keyName!="style")) savedSpaceText.replace(i, 1, "  "); } else if(cursChar==QLatin1Char(' ')) { - if(outBrackets && (keyName!="style")) savedSpaceText.replace(i, 1, " "); + if(outBrackets && firstOutBracket && (keyName!="style")) savedSpaceText.replace(i, 1, " "); } else if(cursChar==QChar(0xA0)) { - if(outBrackets && (keyName!="style")) savedSpaceText.replace(i, 1, " "); + if(outBrackets && firstOutBracket && (keyName!="style")) savedSpaceText.replace(i, 1, " "); } else if(cursChar==QLatin1Char('<')) { if(!echapChar) {outBrackets=false; getKeyName=true; keyName.clear();} - } + } else firstOutBracket=false; echapChar=(cursChar==QLatin1Char('\\')); - + } return savedSpaceText;