From 8048dcdd1f9d73db0862a9dd4e0cd5c125dc2037 Mon Sep 17 00:00:00 2001 From: Daniel Sage <24928223+dnsge@users.noreply.github.com> Date: Sat, 25 Mar 2023 11:00:21 -0400 Subject: [PATCH] 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 --- CHANGELOG.md | 1 + src/widgets/helper/ChannelView.cpp | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc322a69..168dd605 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Minor: Include normally-stripped mention in replies in logs. (#4420) - Minor: Added support for FrankerFaceZ animated emotes. (#4434) - Minor: Added a local backup of the Twitch Badges API in case the request fails. (#4463) +- Minor: Added the ability to reply to a message by `Shift + Right Click`ing the username. (#4424) - Bugfix: Fixed an issue where animated emotes would render on top of zero-width emotes. (#4314) - Bugfix: Fixed an issue where it was difficult to hover a zero-width emote. (#4314) - Bugfix: Fixed an issue where context-menu items for zero-width emotes displayed the wrong provider. (#4460) diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 137c45fb..a534db3e 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -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; }