diff --git a/CHANGELOG.md b/CHANGELOG.md index dda3dd504..7926e57f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unversioned -- Major: Added customizable shortcuts. (#2340) +- Major: Added customizable shortcuts. (#2340, #3633) - Minor: Make animated emote playback speed match browser (Firefox and Chrome) behaviour. (#3506) - Minor: Added middle click split to open in browser (#3356) - Minor: Added new search predicate to filter for messages matching a regex (#3282) diff --git a/src/controllers/hotkeys/ActionNames.hpp b/src/controllers/hotkeys/ActionNames.hpp index 88d52e0f8..5470d7dc4 100644 --- a/src/controllers/hotkeys/ActionNames.hpp +++ b/src/controllers/hotkeys/ActionNames.hpp @@ -135,6 +135,7 @@ inline const std::map actionNames{ ActionDefinition{"Choose previously sent message"}}, {"redo", ActionDefinition{"Redo"}}, {"selectAll", ActionDefinition{"Select all"}}, + {"selectWord", ActionDefinition{"Select word"}}, {"sendMessage", ActionDefinition{ "Send message", diff --git a/src/widgets/splits/SplitInput.cpp b/src/widgets/splits/SplitInput.cpp index 437c56e98..7383030db 100644 --- a/src/widgets/splits/SplitInput.cpp +++ b/src/widgets/splits/SplitInput.cpp @@ -456,6 +456,13 @@ void SplitInput::addShortcuts() this->ui_.textEdit->selectAll(); return ""; }}, + {"selectWord", + [this](std::vector) -> QString { + auto cursor = this->ui_.textEdit->textCursor(); + cursor.select(QTextCursor::WordUnderCursor); + this->ui_.textEdit->setTextCursor(cursor); + return ""; + }}, }; this->shortcuts_ = getApp()->hotkeys->shortcutsForCategory(