Merge pull request #1957 from PhenomRetroShare/Fix_IndentInChatMessage

Fix Indent in Chat Message
This commit is contained in:
defnax 2020-05-22 12:19:53 +02:00 committed by GitHub
commit e460a02f54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 <iostream>
//#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, "&nbsp;&nbsp;");
if(outBrackets && firstOutBracket && (keyName!="style")) { savedSpaceText.replace(i, 1, "&nbsp;&nbsp;"); i+= 11; }
} else if(cursChar==QLatin1Char(' ')) {
if(outBrackets && firstOutBracket && (keyName!="style")) savedSpaceText.replace(i, 1, "&nbsp;");
if(outBrackets && firstOutBracket && (keyName!="style")) { savedSpaceText.replace(i, 1, "&nbsp;"); i+= 5; }
} else if(cursChar==QChar(0xA0)) {
if(outBrackets && firstOutBracket && (keyName!="style")) savedSpaceText.replace(i, 1, "&nbsp;");
if(outBrackets && firstOutBracket && (keyName!="style")) { savedSpaceText.replace(i, 1, "&nbsp;"); 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;
}