Commit b2e0cf4d authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Fix html tags appearing in ctags-goto-symbol

parent 52d65f69
...@@ -47,7 +47,7 @@ QVariant GotoGlobalSymbolModel::data(const QModelIndex &index, int role) const ...@@ -47,7 +47,7 @@ QVariant GotoGlobalSymbolModel::data(const QModelIndex &index, int role) const
const Tags::TagEntry &row = m_rows.at(index.row()); const Tags::TagEntry &row = m_rows.at(index.row());
if (role == Qt::DisplayRole) { if (role == Qt::DisplayRole) {
if (index.column() == 0) if (index.column() == 0)
return QString(filterName(row.tag) + QStringLiteral("&nbsp;<sub style=\"font-size: 16px;color: gray;\">") + QFileInfo(row.file).fileName() + QStringLiteral("</sub>")); return filterName(row.tag);
} else if (role == Qt::UserRole) { } else if (role == Qt::UserRole) {
return row.tag; return row.tag;
} else if (role == Qt::DecorationRole) { } else if (role == Qt::DecorationRole) {
......
...@@ -73,10 +73,18 @@ public: ...@@ -73,10 +73,18 @@ public:
QString str = index.data().toString(); QString str = index.data().toString();
for (const auto& string : m_filterStrings) { for (const auto& string : m_filterStrings) {
// FIXME: need to do to better here
if (string == QLatin1String("b"))
continue;
const QRegularExpression re (QStringLiteral("(")+QRegularExpression::escape(string)+QStringLiteral(")"), QRegularExpression::CaseInsensitiveOption); const QRegularExpression re (QStringLiteral("(")+QRegularExpression::escape(string)+QStringLiteral(")"), QRegularExpression::CaseInsensitiveOption);
str.replace(re, QStringLiteral("<b>\\1</b>")); str.replace(re, QStringLiteral("<b>\\1</b>"));
} }
auto file = index.data(GotoGlobalSymbolModel::FileUrl).toString();
// this will be empty for local symbol mode
if (!file.isEmpty())
str += QStringLiteral(" &nbsp;<span style=\"color: gray;\">") + QFileInfo(file).fileName() + QStringLiteral("</span>");
doc.setHtml(str); doc.setHtml(str);
doc.setDocumentMargin(2); doc.setDocumentMargin(2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment