make emote popup emote insertions less risky
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user