Better formatting for slash commands

This commit is contained in:
Smitty van Bodegom
2021-06-15 20:05:42 -04:00
committed by Carl Schwan
parent 9ad5a7b02b
commit edd5fadbde

View File

@@ -115,6 +115,10 @@ static bool isSpellcheckable(const QStringRef &token)
if (!token.at(0).isLetter() || token.at(0).isUpper() || token.startsWith(QStringLiteral("http"))) {
return false;
}
// part of a slash command
if (token.contains("rainbowme") || token.contains("lenny")) {
return false;
}
// TODO ignore urls and uppercase?
return true;
}
@@ -126,6 +130,11 @@ void SpellcheckHighlighter::highlightBlock(const QString &text)
setFormat(0, text.length(), mQuoteFormat);
return;
}
// Don't spell check certain commands
if (text.startsWith("/join") || text.startsWith("/part") || text.startsWith("/invite")) {
setFormat(0, text.length(), QTextCharFormat{});
return;
}
#ifndef Q_OS_ANDROID
for (const auto &sentenceRef : split(QTextBoundaryFinder::Sentence, text)) {
// Avoid spellchecking quotes