1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Added space detection for markdown #imdeadinside

This commit is contained in:
Andrew Morgan 2016-01-23 02:49:11 -08:00
parent e15315b618
commit fd31dd816d

View File

@ -26,6 +26,8 @@
#include "content/image.h"
#include "content/notificationicon.h"
#include <QDebug>
#include "src/persistence/settings.h"
#include "src/persistence/smileypack.h"
#include "src/widget/style.h"
@ -202,7 +204,8 @@ QString ChatMessage::detectMarkdown(const QString &str)
int offset = 0;
while ((offset = exp.indexIn(out, offset)) != -1)
{
QString snippet = exp.cap();
QString snipCheck = out.mid(offset-1,exp.cap(0).length()+2);
QString snippet = exp.cap(0).trimmed();
QString htmledSnippet;
@ -219,6 +222,11 @@ QString ChatMessage::detectMarkdown(const QString &str)
if (Settings::getInstance().getMarkdownPreference() == 2)
mul = 2;
if (snippet.length() > 0)
{
qDebug() << "Offset: " << offset << " Grabbed snippet: " << snippet << " exp.cap(7): " << exp.cap(7);
}
// Match captured string to corresponding md format
if (exp.cap(1) == "**") // Bold **text**
htmledSnippet = QString(" <b>%1</b> ").arg(snippet.mid(mul,snippet.length()-2*mul));