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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 7 deletions

View file

@ -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)

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;
}