fix: cursor position

This commit is contained in:
Richard Ramos 2021-02-08 14:23:03 -04:00 committed by Iuri Matias
parent 9d9f51c080
commit 554128da50
1 changed files with 2 additions and 1 deletions

View File

@ -194,10 +194,11 @@ Rectangle {
// we can only get it in the `released` event // we can only get it in the `released` event
if (paste) { if (paste) {
paste = false; paste = false;
const posBeforeEnd = messageInputField.length - messageInputField.cursorPosition;
const deparsedEmoji = Emoji.deparse(messageInputField.text); const deparsedEmoji = Emoji.deparse(messageInputField.text);
const plainText = chatsModel.plainText(deparsedEmoji); const plainText = chatsModel.plainText(deparsedEmoji);
messageInputField.text = Emoji.parse(plainText.replace(/\n/g, "<br />")); messageInputField.text = Emoji.parse(plainText.replace(/\n/g, "<br />"));
messageInputField.cursorPosition = messageInputField.length; messageInputField.cursorPosition = messageInputField.length - posBeforeEnd;
interrogateMessage(); interrogateMessage();
} }