Browse Source

Added space detection for markdown #imdeadinside

pull/2832/head
Andrew Morgan 10 years ago
parent
commit
fd31dd816d
  1. 10
      src/chatlog/chatmessage.cpp

10
src/chatlog/chatmessage.cpp

@ -26,6 +26,8 @@ @@ -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) @@ -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) @@ -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));

Loading…
Cancel
Save