mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
make emote popup emote insertions less risky
This commit is contained in:
parent
92bf1adf88
commit
a733b6975d
1 changed files with 2 additions and 4 deletions
|
@ -155,12 +155,10 @@ void SplitInput::openEmotePopup()
|
||||||
QTextCursor cursor = this->ui_.textEdit->textCursor();
|
QTextCursor cursor = this->ui_.textEdit->textCursor();
|
||||||
QString textToInsert(link.value + " ");
|
QString textToInsert(link.value + " ");
|
||||||
|
|
||||||
auto symbolBeforeCursor =
|
|
||||||
getInputText()[cursor.position() - 1];
|
|
||||||
// If symbol before cursor isn't space or empty
|
// If symbol before cursor isn't space or empty
|
||||||
// Then insert space before emote.
|
// Then insert space before emote.
|
||||||
if (!symbolBeforeCursor.isSpace() &&
|
if (cursor.position() > 0 &&
|
||||||
!symbolBeforeCursor.isNull()) {
|
!this->getInputText()[cursor.position() - 1].isSpace()) {
|
||||||
textToInsert = " " + textToInsert;
|
textToInsert = " " + textToInsert;
|
||||||
}
|
}
|
||||||
this->insertText(textToInsert);
|
this->insertText(textToInsert);
|
||||||
|
|
Loading…
Reference in a new issue