mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -04:00
Add whitespaces around smileys.
Only replace smileys with an image when they are surrounded by whitespaces. This fixes smileys in links and other text that happen to include the sequence for a smiley.
This commit is contained in:
parent
f1f111f096
commit
54f9912c32
2 changed files with 49 additions and 3 deletions
|
@ -1391,7 +1391,13 @@ void ChatWidget::smileyWidget()
|
|||
|
||||
void ChatWidget::addSmiley()
|
||||
{
|
||||
ui->chatTextEdit->textCursor().insertText(qobject_cast<QPushButton*>(sender())->toolTip().split("|").first());
|
||||
QString smiley = qobject_cast<QPushButton*>(sender())->toolTip().split("|").first();
|
||||
// add trailing space
|
||||
smiley += QString(" ");
|
||||
// add preceding space when needed (not at start of text or preceding space already exists)
|
||||
if(!ui->chatTextEdit->textCursor().atStart() && ui->chatTextEdit->toPlainText()[ui->chatTextEdit->textCursor().position() - 1] != QChar(' '))
|
||||
smiley = QString(" ") + smiley;
|
||||
ui->chatTextEdit->textCursor().insertText(smiley);
|
||||
}
|
||||
|
||||
void ChatWidget::clearChatHistory()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue