Add Shift+Right Click Shortcut to Reply to a Message (#4424)

Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Daniel Sage
2023-03-25 11:00:21 -04:00
committed by GitHub
parent d59076520a
commit 8048dcdd1f
2 changed files with 20 additions and 7 deletions
+19 -7
View File
@@ -2091,13 +2091,25 @@ void ChannelView::handleMouseClick(QMouseEvent *event,
if (link.type == Link::UserInfo)
{
const bool commaMention =
getSettings()->mentionUsersWithComma;
const bool isFirstWord =
split && split->getInput().isEditFirstWord();
auto userMention = formatUserMention(
link.value, isFirstWord, commaMention);
insertText("@" + userMention + " ");
if (hoveredElement->getFlags().has(
MessageElementFlag::Username) &&
event->modifiers() == Qt::ShiftModifier)
{
// Start a new reply if Shift+Right-clicking the message username
this->setInputReply(layout->getMessagePtr());
}
else
{
// Insert @username into split input
const bool commaMention =
getSettings()->mentionUsersWithComma;
const bool isFirstWord =
split && split->getInput().isEditFirstWord();
auto userMention = formatUserMention(
link.value, isFirstWord, commaMention);
insertText("@" + userMention + " ");
}
return;
}